mirror of https://gitee.com/openkylin/linux.git
[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. Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Jens Axboe <axboe@suse.de>
This commit is contained in:
parent
80cfd548ee
commit
64100099ed
|
@ -25,15 +25,15 @@
|
||||||
/*
|
/*
|
||||||
* tunables
|
* tunables
|
||||||
*/
|
*/
|
||||||
static int cfq_quantum = 4; /* max queue in one round of service */
|
static const int cfq_quantum = 4; /* max queue in one round of service */
|
||||||
static int cfq_queued = 8; /* minimum rq allocate limit per-queue*/
|
static const int cfq_queued = 8; /* minimum rq allocate limit per-queue*/
|
||||||
static int cfq_fifo_expire[2] = { HZ / 4, HZ / 8 };
|
static const int cfq_fifo_expire[2] = { HZ / 4, HZ / 8 };
|
||||||
static int cfq_back_max = 16 * 1024; /* maximum backwards seek, in KiB */
|
static const int cfq_back_max = 16 * 1024; /* maximum backwards seek, in KiB */
|
||||||
static int cfq_back_penalty = 2; /* penalty of a backwards seek */
|
static const int cfq_back_penalty = 2; /* penalty of a backwards seek */
|
||||||
|
|
||||||
static int cfq_slice_sync = HZ / 10;
|
static const int cfq_slice_sync = HZ / 10;
|
||||||
static int cfq_slice_async = HZ / 25;
|
static int cfq_slice_async = HZ / 25;
|
||||||
static int cfq_slice_async_rq = 2;
|
static const int cfq_slice_async_rq = 2;
|
||||||
static int cfq_slice_idle = HZ / 100;
|
static int cfq_slice_idle = HZ / 100;
|
||||||
|
|
||||||
#define CFQ_IDLE_GRACE (HZ / 10)
|
#define CFQ_IDLE_GRACE (HZ / 10)
|
||||||
|
@ -45,7 +45,7 @@ static int cfq_slice_idle = HZ / 100;
|
||||||
/*
|
/*
|
||||||
* disable queueing at the driver/hardware level
|
* disable queueing at the driver/hardware level
|
||||||
*/
|
*/
|
||||||
static int cfq_max_depth = 2;
|
static const int cfq_max_depth = 2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for the hash of cfqq inside the cfqd
|
* for the hash of cfqq inside the cfqd
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
/*
|
/*
|
||||||
* See Documentation/block/deadline-iosched.txt
|
* See Documentation/block/deadline-iosched.txt
|
||||||
*/
|
*/
|
||||||
static int read_expire = HZ / 2; /* max time before a read is submitted. */
|
static const int read_expire = HZ / 2; /* max time before a read is submitted. */
|
||||||
static int write_expire = 5 * HZ; /* ditto for writes, these limits are SOFT! */
|
static const int write_expire = 5 * HZ; /* ditto for writes, these limits are SOFT! */
|
||||||
static int writes_starved = 2; /* max times reads can starve a write */
|
static const int writes_starved = 2; /* max times reads can starve a write */
|
||||||
static int fifo_batch = 16; /* # of sequential requests treated as one
|
static const int fifo_batch = 16; /* # of sequential requests treated as one
|
||||||
by the above parameters. For throughput. */
|
by the above parameters. For throughput. */
|
||||||
|
|
||||||
static const int deadline_hash_shift = 5;
|
static const int deadline_hash_shift = 5;
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ void blk_queue_invalidate_tags(request_queue_t *q)
|
||||||
|
|
||||||
EXPORT_SYMBOL(blk_queue_invalidate_tags);
|
EXPORT_SYMBOL(blk_queue_invalidate_tags);
|
||||||
|
|
||||||
static char *rq_flags[] = {
|
static const char * const rq_flags[] = {
|
||||||
"REQ_RW",
|
"REQ_RW",
|
||||||
"REQ_FAILFAST",
|
"REQ_FAILFAST",
|
||||||
"REQ_SORTED",
|
"REQ_SORTED",
|
||||||
|
|
|
@ -46,7 +46,7 @@ EXPORT_SYMBOL(scsi_command_size);
|
||||||
|
|
||||||
static int sg_get_version(int __user *p)
|
static int sg_get_version(int __user *p)
|
||||||
{
|
{
|
||||||
static int sg_version_num = 30527;
|
static const int sg_version_num = 30527;
|
||||||
return put_user(sg_version_num, p);
|
return put_user(sg_version_num, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue