Message ID | 20201014145545.10878-1-rgoldwyn@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: Use round_down while calculating start position in btrfs_dirty_pages() | expand |
On 14.10.20 г. 17:55 ч., Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues <rgoldwyn@suse.com> > > round_down looks prettier than the bit mask operations. > > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com>
On 2020/10/14 下午10:55, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues <rgoldwyn@suse.com> > > round_down looks prettier than the bit mask operations. > > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > fs/btrfs/file.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c > index 0ff659455b1e..6e52e2360d8e 100644 > --- a/fs/btrfs/file.c > +++ b/fs/btrfs/file.c > @@ -514,7 +514,7 @@ int btrfs_dirty_pages(struct btrfs_inode *inode, struct page **pages, > loff_t isize = i_size_read(&inode->vfs_inode); > unsigned int extra_bits = 0; > > - start_pos = pos & ~((u64) fs_info->sectorsize - 1); > + start_pos = round_down(pos, fs_info->sectorsize); > num_bytes = round_up(write_bytes + pos - start_pos, > fs_info->sectorsize); > >
On Wed, Oct 14, 2020 at 09:55:44AM -0500, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues <rgoldwyn@suse.com> > > round_down looks prettier than the bit mask operations. > > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> 1 and 2 added to misc-next, thanks.
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 0ff659455b1e..6e52e2360d8e 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -514,7 +514,7 @@ int btrfs_dirty_pages(struct btrfs_inode *inode, struct page **pages, loff_t isize = i_size_read(&inode->vfs_inode); unsigned int extra_bits = 0; - start_pos = pos & ~((u64) fs_info->sectorsize - 1); + start_pos = round_down(pos, fs_info->sectorsize); num_bytes = round_up(write_bytes + pos - start_pos, fs_info->sectorsize);