* [PATCH 1/7] block: use i_size_write() in bd_set_size() [not found] <1359111382-12654-1-git-send-email-yan@linux.vnet.ibm.com> @ 2013-01-25 10:56 ` Guo Chao 2013-01-25 10:56 ` [PATCH 2/7] block: remove redundant check to bd_openers Guo Chao 1 sibling, 0 replies; 2+ messages in thread From: Guo Chao @ 2013-01-25 10:56 UTC (permalink / raw) To: axboe; +Cc: linux-kernel, Alexander Viro, linux-fsdevel blkdev_ioctl(GETBLKSIZE) uses i_size_read() to read size of block device. If we update block size directly, reader may see intermediate result in some machines and configurations. Use i_size_write() instead. Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com> --- fs/block_dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 172f849..82b7c9a 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1032,7 +1032,9 @@ void bd_set_size(struct block_device *bdev, loff_t size) { unsigned bsize = bdev_logical_block_size(bdev); - bdev->bd_inode->i_size = size; + mutex_lock(&bdev->bd_inode->i_mutex); + i_size_write(bdev->bd_inode, size); + mutex_unlock(&bdev->bd_inode->i_mutex); while (bsize < PAGE_CACHE_SIZE) { if (size & bsize) break; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/7] block: remove redundant check to bd_openers [not found] <1359111382-12654-1-git-send-email-yan@linux.vnet.ibm.com> 2013-01-25 10:56 ` [PATCH 1/7] block: use i_size_write() in bd_set_size() Guo Chao @ 2013-01-25 10:56 ` Guo Chao 1 sibling, 0 replies; 2+ messages in thread From: Guo Chao @ 2013-01-25 10:56 UTC (permalink / raw) To: axboe; +Cc: linux-kernel, Alexander Viro, linux-fsdevel bd_openers is stable under bd_mutex, no need to check it twice. Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com> --- fs/block_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 82b7c9a..2f70584 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1119,7 +1119,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) } } - if (!ret && !bdev->bd_openers) { + if (!ret) { bd_set_size(bdev,(loff_t)get_capacity(disk)<<9); bdi = blk_get_backing_dev_info(bdev); if (bdi == NULL) -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-25 10:56 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1359111382-12654-1-git-send-email-yan@linux.vnet.ibm.com> 2013-01-25 10:56 ` [PATCH 1/7] block: use i_size_write() in bd_set_size() Guo Chao 2013-01-25 10:56 ` [PATCH 2/7] block: remove redundant check to bd_openers Guo Chao
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).