[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1392904131-71320-2-git-send-email-hare@suse.de>
Date: Thu, 20 Feb 2014 14:48:50 +0100
From: Hannes Reinecke <hare@...e.de>
To: Theodore Tso <tytso@....edu>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Alexander Graf <agraf@...e.de>, Jens Axboe <axboe@...nel.dk>,
Hannes Reinecke <hare@...e.de>
Subject: [PATCH 1/2] loop: Display correct physical blocksize
When running on files the physical blocksize is actually 4k,
so we should be announcing it as such.
Signed-off-by: Hannes Reinecke <hare@...e.de>
---
drivers/block/loop.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 66e8c3b..6965e5a 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -199,6 +199,7 @@ figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit)
lo->lo_offset = offset;
if (lo->lo_sizelimit != sizelimit)
lo->lo_sizelimit = sizelimit;
+ blk_queue_physical_block_size(lo->lo_queue, lo->lo_blocksize);
set_capacity(lo->lo_disk, x);
bd_set_size(bdev, (loff_t)get_capacity(bdev->bd_disk) << 9);
/* let user-space know about the new size */
@@ -366,7 +367,7 @@ lo_direct_splice_actor(struct pipe_inode_info *pipe, struct splice_desc *sd)
static ssize_t
do_lo_receive(struct loop_device *lo,
- struct bio_vec *bvec, int bsize, loff_t pos)
+ struct bio_vec *bvec, loff_t pos)
{
struct lo_read_data cookie;
struct splice_desc sd;
@@ -376,7 +377,7 @@ do_lo_receive(struct loop_device *lo,
cookie.lo = lo;
cookie.page = bvec->bv_page;
cookie.offset = bvec->bv_offset;
- cookie.bsize = bsize;
+ cookie.bsize = lo->lo_blocksize;
sd.len = 0;
sd.total_len = bvec->bv_len;
@@ -391,14 +392,14 @@ do_lo_receive(struct loop_device *lo,
}
static int
-lo_receive(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos)
+lo_receive(struct loop_device *lo, struct bio *bio, loff_t pos)
{
struct bio_vec bvec;
struct bvec_iter iter;
ssize_t s;
bio_for_each_segment(bvec, bio, iter) {
- s = do_lo_receive(lo, &bvec, bsize, pos);
+ s = do_lo_receive(lo, &bvec, pos);
if (s < 0)
return s;
@@ -460,7 +461,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio)
ret = -EIO;
}
} else
- ret = lo_receive(lo, bio, lo->lo_blocksize, pos);
+ ret = lo_receive(lo, bio, pos);
out:
return ret;
@@ -898,6 +899,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync)
blk_queue_flush(lo->lo_queue, REQ_FLUSH);
+ blk_queue_physical_block_size(lo->lo_queue, lo->lo_blocksize);
set_capacity(lo->lo_disk, size);
bd_set_size(bdev, size << 9);
loop_sysfs_init(lo);
--
1.7.12.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists