OSDN Git Service

btrfs: use PAGE_ALIGNED instead of IS_ALIGNED
authorFanjun Kong <bh1scw@gmail.com>
Thu, 26 May 2022 14:35:40 +0000 (22:35 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Jul 2022 15:44:33 +0000 (17:44 +0200)
The <linux/mm.h> already provides the PAGE_ALIGNED macro. Let's
use it instead of IS_ALIGNED and passing PAGE_SIZE directly.

Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Fanjun Kong <bh1scw@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c
fs/btrfs/inode.c

index f03ab5d..c4c1e65 100644 (file)
@@ -6206,7 +6206,7 @@ static int check_eb_alignment(struct btrfs_fs_info *fs_info, u64 start)
                return -EINVAL;
        }
        if (fs_info->nodesize >= PAGE_SIZE &&
-           !IS_ALIGNED(start, PAGE_SIZE)) {
+           !PAGE_ALIGNED(start)) {
                btrfs_err(fs_info,
                "tree block is not page aligned, start %llu nodesize %u",
                          start, fs_info->nodesize);
index 77a0015..332b8f1 100644 (file)
@@ -560,8 +560,8 @@ static inline int inode_need_compress(struct btrfs_inode *inode, u64 start,
         * will unlock the full page.
         */
        if (fs_info->sectorsize < PAGE_SIZE) {
-               if (!IS_ALIGNED(start, PAGE_SIZE) ||
-                   !IS_ALIGNED(end + 1, PAGE_SIZE))
+               if (!PAGE_ALIGNED(start) ||
+                   !PAGE_ALIGNED(end + 1))
                        return 0;
        }
 
@@ -678,8 +678,8 @@ again:
         * Thus we must also check against @actual_end, not just @end.
         */
        if (blocksize < PAGE_SIZE) {
-               if (!IS_ALIGNED(start, PAGE_SIZE) ||
-                   !IS_ALIGNED(round_up(actual_end, blocksize), PAGE_SIZE))
+               if (!PAGE_ALIGNED(start) ||
+                   !PAGE_ALIGNED(round_up(actual_end, blocksize)))
                        goto cleanup_and_bail_uncompressed;
        }