History

[BLOCK] mark some block/ variables cons

the patch below marks various read-only variables in block/* as const, so that gcc can optimize the use of them; eg gcc will replace the use by the value directly now and will even remove the memory usage of these.

Arjan van de Ven committed 20 years ago

Commit 64100091 parent 80cfd544 files · +14 −14Browse files

Unified · Split

4 files
  1. block/cfq-iosched.c +8 −8
  2. block/deadline-iosched.c +4 −4
  3. block/ll_rw_blk.c +1 −1
  4. block/scsi_ioctl.c +1 −1
block/cfq-iosched.c+8−8
@@ -25,15 +25,15 @@ · 24 unmodified lines
25/*25/*
26 * tunables26 * tunables
27 */27 */
28static int cfq_quantum = 4; /* max queue in one round of service */28static const int cfq_quantum = 4; /* max queue in one round of service */
29static int cfq_queued = 8; /* minimum rq allocate limit per-queue*/29static const int cfq_queued = 8; /* minimum rq allocate limit per-queue*/
30static int cfq_fifo_expire[2] = { HZ / 4, HZ / 8 };30static const int cfq_fifo_expire[2] = { HZ / 4, HZ / 8 };
31static int cfq_back_max = 16 * 1024; /* maximum backwards seek, in KiB */31static const int cfq_back_max = 16 * 1024; /* maximum backwards seek, in KiB */
32static int cfq_back_penalty = 2; /* penalty of a backwards seek */32static const int cfq_back_penalty = 2; /* penalty of a backwards seek */
33 33
34static int cfq_slice_sync = HZ / 10;34static const int cfq_slice_sync = HZ / 10;
35static int cfq_slice_async = HZ / 25;35static int cfq_slice_async = HZ / 25;
36static int cfq_slice_async_rq = 2;36static const int cfq_slice_async_rq = 2;
37static int cfq_slice_idle = HZ / 100;37static int cfq_slice_idle = HZ / 100;
38 38
39#define CFQ_IDLE_GRACE (HZ / 10)39#define CFQ_IDLE_GRACE (HZ / 10)
@@ -45,7 +45,7 @@ static int cfq_slice_idle = HZ / 100; · 5 unmodified lines
45/*45/*
46 * disable queueing at the driver/hardware level46 * disable queueing at the driver/hardware level
47 */47 */
48static int cfq_max_depth = 2;48static const int cfq_max_depth = 2;
49 49
50/*50/*
51 * for the hash of cfqq inside the cfqd51 * for the hash of cfqq inside the cfqd
block/deadline-iosched.c+4−4
@@ -19,10 +19,10 @@ · 18 unmodified lines
19/*19/*
20 * See Documentation/block/deadline-iosched.txt20 * See Documentation/block/deadline-iosched.txt
21 */21 */
22static int read_expire = HZ / 2; /* max time before a read is submitted. */22static const int read_expire = HZ / 2; /* max time before a read is submitted. */
23static int write_expire = 5 * HZ; /* ditto for writes, these limits are SOFT! */23static const int write_expire = 5 * HZ; /* ditto for writes, these limits are SOFT! */
24static int writes_starved = 2; /* max times reads can starve a write */24static const int writes_starved = 2; /* max times reads can starve a write */
25static int fifo_batch = 16; /* # of sequential requests treated as one25static const int fifo_batch = 16; /* # of sequential requests treated as one
26 by the above parameters. For throughput. */26 by the above parameters. For throughput. */
27 27
28static const int deadline_hash_shift = 5;28static const int deadline_hash_shift = 5;
block/ll_rw_blk.c+1−1
@@ -1039,7 +1039,7 @@ void blk_queue_invalidate_tags(request_queue_t *q) · 1038 unmodified lines
1039 1039
1040EXPORT_SYMBOL(blk_queue_invalidate_tags);1040EXPORT_SYMBOL(blk_queue_invalidate_tags);
1041 1041
1042static char *rq_flags[] = {1042static const char * const rq_flags[] = {
1043 "REQ_RW",1043 "REQ_RW",
1044 "REQ_FAILFAST",1044 "REQ_FAILFAST",
1045 "REQ_SORTED",1045 "REQ_SORTED",
block/scsi_ioctl.c+1−1
@@ -46,7 +46,7 @@ EXPORT_SYMBOL(scsi_command_size); · 45 unmodified lines
46 46
47static int sg_get_version(int __user *p)47static int sg_get_version(int __user *p)
48{48{
49 static int sg_version_num = 30527;49 static const int sg_version_num = 30527;
50 return put_user(sg_version_num, p);50 return put_user(sg_version_num, p);
51}51}
52 52

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t