* [PATCH] VFS buffer: calculate block-size correctly
@ 2010-08-24 7:39 ` Cong Meng
0 siblings, 0 replies; 2+ messages in thread
From: Cong Meng @ 2010-08-24 7:39 UTC (permalink / raw)
To: Alexander Viro, Christoph Hellwig, Jens Axboe, Nick Piggin,
Andrew Morton, linux-fsdevel, linux-kernel
the invocation of __getblk(bdev, block, size) will cause kernel stall if
the @size parameter is not equal to the block size of the block device
saved in the inode struct.
submit_bh() has the similar problem.
this patch calculates the blocksize by the value i_blkbits saved in the
inode struct.
Signed-off-by: Cong Meng <mcpacino@gmail.com>
---
fs/buffer.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 3e7dca2..f7f9d33 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1051,10 +1051,7 @@ grow_buffers(struct block_device *bdev, sector_t block, int size)
pgoff_t index;
int sizebits;
- sizebits = -1;
- do {
- sizebits++;
- } while ((size << sizebits) < PAGE_SIZE);
+ sizebits = PAGE_CACHE_SHIFT - bdev->bd_inode->i_blkbits;
index = block >> sizebits;
@@ -2924,7 +2921,7 @@ int submit_bh(int rw, struct buffer_head * bh)
*/
bio = bio_alloc(GFP_NOIO, 1);
- bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9);
+ bio->bi_sector = bh->b_blocknr << (bh->b_bdev->bd_inode->i_blkbits - 9);
bio->bi_bdev = bh->b_bdev;
bio->bi_io_vec[0].bv_page = bh->b_page;
bio->bi_io_vec[0].bv_len = bh->b_size;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] VFS buffer: calculate block-size correctly
@ 2010-08-24 7:39 ` Cong Meng
0 siblings, 0 replies; 2+ messages in thread
From: Cong Meng @ 2010-08-24 7:39 UTC (permalink / raw)
To: Alexander Viro, Christoph Hellwig, Jens Axboe, Nick Piggin,
Andrew Morton
the invocation of __getblk(bdev, block, size) will cause kernel stall if
the @size parameter is not equal to the block size of the block device
saved in the inode struct.
submit_bh() has the similar problem.
this patch calculates the blocksize by the value i_blkbits saved in the
inode struct.
Signed-off-by: Cong Meng <mcpacino@gmail.com>
---
fs/buffer.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 3e7dca2..f7f9d33 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1051,10 +1051,7 @@ grow_buffers(struct block_device *bdev, sector_t block, int size)
pgoff_t index;
int sizebits;
- sizebits = -1;
- do {
- sizebits++;
- } while ((size << sizebits) < PAGE_SIZE);
+ sizebits = PAGE_CACHE_SHIFT - bdev->bd_inode->i_blkbits;
index = block >> sizebits;
@@ -2924,7 +2921,7 @@ int submit_bh(int rw, struct buffer_head * bh)
*/
bio = bio_alloc(GFP_NOIO, 1);
- bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9);
+ bio->bi_sector = bh->b_blocknr << (bh->b_bdev->bd_inode->i_blkbits - 9);
bio->bi_bdev = bh->b_bdev;
bio->bi_io_vec[0].bv_page = bh->b_page;
bio->bi_io_vec[0].bv_len = bh->b_size;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-24 7:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-24 7:39 [PATCH] VFS buffer: calculate block-size correctly Cong Meng
2010-08-24 7:39 ` Cong Meng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.