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
2525 /*
2626 * tunables
2727 */
28−static int cfq_quantum = 4; /* max queue in one round of service */
29−static int cfq_queued = 8; /* minimum rq allocate limit per-queue*/
30−static int cfq_fifo_expire[2] = { HZ / 4, HZ / 8 };
31−static int cfq_back_max = 16 * 1024; /* maximum backwards seek, in KiB */
32−static int cfq_back_penalty = 2; /* penalty of a backwards seek */
28+static const int cfq_quantum = 4; /* max queue in one round of service */
29+static const int cfq_queued = 8; /* minimum rq allocate limit per-queue*/
30+static const int cfq_fifo_expire[2] = { HZ / 4, HZ / 8 };
31+static const int cfq_back_max = 16 * 1024; /* maximum backwards seek, in KiB */
32+static const int cfq_back_penalty = 2; /* penalty of a backwards seek */
3333
34−static int cfq_slice_sync = HZ / 10;
34+static const int cfq_slice_sync = HZ / 10;
3535 static int cfq_slice_async = HZ / 25;
36−static int cfq_slice_async_rq = 2;
36+static const int cfq_slice_async_rq = 2;
3737 static int cfq_slice_idle = HZ / 100;
3838
3939 #define CFQ_IDLE_GRACE (HZ / 10)
@@ -45,7 +45,7 @@ static int cfq_slice_idle = HZ / 100; · 5 unmodified lines
4545 /*
4646 * disable queueing at the driver/hardware level
4747 */
48−static int cfq_max_depth = 2;
48+static const int cfq_max_depth = 2;
4949
5050 /*
5151 * for the hash of cfqq inside the cfqd
block/deadline-iosched.c+4−4
@@ -19,10 +19,10 @@ · 18 unmodified lines
1919 /*
2020 * See Documentation/block/deadline-iosched.txt
2121 */
22−static int read_expire = HZ / 2; /* max time before a read is submitted. */
23−static int write_expire = 5 * HZ; /* ditto for writes, these limits are SOFT! */
24−static int writes_starved = 2; /* max times reads can starve a write */
25−static int fifo_batch = 16; /* # of sequential requests treated as one
22+static const int read_expire = HZ / 2; /* max time before a read is submitted. */
23+static const int write_expire = 5 * HZ; /* ditto for writes, these limits are SOFT! */
24+static const int writes_starved = 2; /* max times reads can starve a write */
25+static const int fifo_batch = 16; /* # of sequential requests treated as one
2626 by the above parameters. For throughput. */
2727
2828 static 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
10391039
10401040 EXPORT_SYMBOL(blk_queue_invalidate_tags);
10411041
1042−static char *rq_flags[] = {
1042+static const char * const rq_flags[] = {
10431043 "REQ_RW",
10441044 "REQ_FAILFAST",
10451045 "REQ_SORTED",
block/scsi_ioctl.c+1−1
@@ -46,7 +46,7 @@ EXPORT_SYMBOL(scsi_command_size); · 45 unmodified lines
4646
4747 static int sg_get_version(int __user *p)
4848 {
49− static int sg_version_num = 30527;
49+ static const int sg_version_num = 30527;
5050 return put_user(sg_version_num, p);
5151 }
5252

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