btrfs: use round_down while calculating start position in btrfs_dirty_pages()
authorGoldwyn Rodrigues <rgoldwyn@suse.com>
Wed, 14 Oct 2020 14:55:44 +0000 (09:55 -0500)
committerDavid Sterba <dsterba@suse.com>
Tue, 8 Dec 2020 14:53:38 +0000 (15:53 +0100)
round_down looks prettier than the bit mask operations.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/file.c

index 7c5e3d40657412f454dc40ec414e88857a81cdec..c7ed30edf1cd4009c087bc25a176ee10218625ab 100644 (file)
@@ -474,7 +474,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);