Commit a50376bd authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] expose backing dev max read-ahead

From: Jens Axboe <axboe@suse.de>

Expose the blockdev's VM readahead in /sys/block/hda/queue/read_ahead_kbytes

This duplicates `blockdev --setra', but we're trying to get away from
ioctls.

It would be nice to have a readahead-setting mechanism which also allows,
say, NFS to be tuned.  But there is no common exposure point for
backing_dev_infos.  One option might be per-superblock:

	mount -o remount,read_ahead_kbytes=64

but the generic remount code also has no visibility of the backing_dev, so it
would need a new super_block operation.  One which doesn't accidentally modify
default_backing_dev_info.
parent 0575b04a
...@@ -2997,14 +2997,41 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count) ...@@ -2997,14 +2997,41 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)
return ret; return ret;
} }
static ssize_t queue_ra_show(struct request_queue *q, char *page)
{
int ra_kb = q->backing_dev_info.ra_pages << (PAGE_CACHE_SHIFT - 10);
return queue_var_show(ra_kb, (page));
}
static ssize_t
queue_ra_store(struct request_queue *q, const char *page, size_t count)
{
unsigned long ra_kb;
ssize_t ret = queue_var_store(&ra_kb, page, count);
if (ra_kb > (q->max_sectors >> 1))
ra_kb = (q->max_sectors >> 1);
q->backing_dev_info.ra_pages = ra_kb >> (PAGE_CACHE_SHIFT - 10);
return ret;
}
static struct queue_sysfs_entry queue_requests_entry = { static struct queue_sysfs_entry queue_requests_entry = {
.attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
.show = queue_requests_show, .show = queue_requests_show,
.store = queue_requests_store, .store = queue_requests_store,
}; };
static struct queue_sysfs_entry queue_ra_entry = {
.attr = {.name = "read_ahead_kb", .mode = S_IRUGO | S_IWUSR },
.show = queue_ra_show,
.store = queue_ra_store,
};
static struct attribute *default_attrs[] = { static struct attribute *default_attrs[] = {
&queue_requests_entry.attr, &queue_requests_entry.attr,
&queue_ra_entry.attr,
NULL, NULL,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment