Re: [PATCH 3/7] btrfs: use i_size_read() instead of open code
On Tue, Nov 07, 2017 at 07:44:59AM +0800, Anand Jain wrote: > > > On 11/07/2017 12:52 AM, David Sterba wrote: > > On Mon, Nov 06, 2017 at 04:36:14PM +0800, Anand Jain wrote: > >> As i_size_read() takes care of 32bit smp or preempt cases as well. > > > > Can bdev->bd_inode->i_size change so that we need to use the > > i_size_read()? My answer is 'no'. > > Hm. Right I was looking at it only from the theoretical point of view. > > And I presume you mean to say disk resize at the block layer is not > really a practically achievable concern. There are some safety checks, at least if there are bios in flight on the partition when it's mounted. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/7] btrfs: use i_size_read() instead of open code
On 11/07/2017 12:52 AM, David Sterba wrote: On Mon, Nov 06, 2017 at 04:36:14PM +0800, Anand Jain wrote: As i_size_read() takes care of 32bit smp or preempt cases as well. Can bdev->bd_inode->i_size change so that we need to use the i_size_read()? My answer is 'no'. Hm. Right I was looking at it only from the theoretical point of view. And I presume you mean to say disk resize at the block layer is not really a practically achievable concern. Thanks, Anand -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/7] btrfs: use i_size_read() instead of open code
On Mon, Nov 06, 2017 at 04:36:14PM +0800, Anand Jain wrote: > As i_size_read() takes care of 32bit smp or preempt cases as well. Can bdev->bd_inode->i_size change so that we need to use the i_size_read()? My answer is 'no'. You haven't provided any reasoning why it should be otherwise. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/7] btrfs: use i_size_read() instead of open code
As i_size_read() takes care of 32bit smp or preempt cases as well. Signed-off-by: Anand Jain--- fs/btrfs/ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index b0465020972a..86e7f5abd740 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1532,7 +1532,7 @@ static noinline int btrfs_ioctl_resize(struct file *file, } if (!new_size) - new_size = device->bdev->bd_inode->i_size; + new_size = i_size_read(device->bdev->bd_inode); old_size = btrfs_device_get_total_bytes(device); @@ -1554,7 +1554,7 @@ static noinline int btrfs_ioctl_resize(struct file *file, ret = -EINVAL; goto out_mutex; } - if (new_size > device->bdev->bd_inode->i_size) { + if (new_size > i_size_read(device->bdev->bd_inode)) { ret = -EFBIG; goto out_mutex; } -- 2.13.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html