aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin K. Petersen2012-09-18 11:19:27 -0500
committerJens Axboe2012-09-20 07:31:45 -0500
commit4363ac7c13a9a4b763c6e8d9fdbfc2468f3b8ca4 (patch)
tree010b05699eb9544b9cdfe5e1b3affdaea80132e7 /block/blk-sysfs.c
parentf31dc1cd490539e2b62a126bc4dc2495b165d772 (diff)
downloadkernel-common-4363ac7c13a9a4b763c6e8d9fdbfc2468f3b8ca4.tar.gz
kernel-common-4363ac7c13a9a4b763c6e8d9fdbfc2468f3b8ca4.tar.xz
kernel-common-4363ac7c13a9a4b763c6e8d9fdbfc2468f3b8ca4.zip
block: Implement support for WRITE SAME
The WRITE SAME command supported on some SCSI devices allows the same block to be efficiently replicated throughout a block range. Only a single logical block is transferred from the host and the storage device writes the same data to all blocks described by the I/O. This patch implements support for WRITE SAME in the block layer. The blkdev_issue_write_same() function can be used by filesystems and block drivers to replicate a buffer across a block range. This can be used to efficiently initialize software RAID devices, etc. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r--block/blk-sysfs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index ea51d827a0b..247dbfd4262 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -180,6 +180,13 @@ static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *pag
180 return queue_var_show(queue_discard_zeroes_data(q), page); 180 return queue_var_show(queue_discard_zeroes_data(q), page);
181} 181}
182 182
183static ssize_t queue_write_same_max_show(struct request_queue *q, char *page)
184{
185 return sprintf(page, "%llu\n",
186 (unsigned long long)q->limits.max_write_same_sectors << 9);
187}
188
189
183static ssize_t 190static ssize_t
184queue_max_sectors_store(struct request_queue *q, const char *page, size_t count) 191queue_max_sectors_store(struct request_queue *q, const char *page, size_t count)
185{ 192{
@@ -385,6 +392,11 @@ static struct queue_sysfs_entry queue_discard_zeroes_data_entry = {
385 .show = queue_discard_zeroes_data_show, 392 .show = queue_discard_zeroes_data_show,
386}; 393};
387 394
395static struct queue_sysfs_entry queue_write_same_max_entry = {
396 .attr = {.name = "write_same_max_bytes", .mode = S_IRUGO },
397 .show = queue_write_same_max_show,
398};
399
388static struct queue_sysfs_entry queue_nonrot_entry = { 400static struct queue_sysfs_entry queue_nonrot_entry = {
389 .attr = {.name = "rotational", .mode = S_IRUGO | S_IWUSR }, 401 .attr = {.name = "rotational", .mode = S_IRUGO | S_IWUSR },
390 .show = queue_show_nonrot, 402 .show = queue_show_nonrot,
@@ -432,6 +444,7 @@ static struct attribute *default_attrs[] = {
432 &queue_discard_granularity_entry.attr, 444 &queue_discard_granularity_entry.attr,
433 &queue_discard_max_entry.attr, 445 &queue_discard_max_entry.attr,
434 &queue_discard_zeroes_data_entry.attr, 446 &queue_discard_zeroes_data_entry.attr,
447 &queue_write_same_max_entry.attr,
435 &queue_nonrot_entry.attr, 448 &queue_nonrot_entry.attr,
436 &queue_nomerges_entry.attr, 449 &queue_nomerges_entry.attr,
437 &queue_rq_affinity_entry.attr, 450 &queue_rq_affinity_entry.attr,