diff options
author | David Sterba <dsterba@suse.com> | 2017-01-30 17:14:03 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-03-08 13:00:46 +0100 |
commit | c45a060f3e2d7a46935f92397bf561cd56d3127f (patch) | |
tree | 182874de20565bf67da0f22572fba81529d8e055 /convert/source-ext2.c | |
parent | 9368a774560c8c913c46f7cdf36bb11da5688338 (diff) |
btrfs-progs: convert: use helper for special inode number check
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'convert/source-ext2.c')
-rw-r--r-- | convert/source-ext2.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/convert/source-ext2.c b/convert/source-ext2.c index 29222a37..fb93fc77 100644 --- a/convert/source-ext2.c +++ b/convert/source-ext2.c @@ -802,6 +802,13 @@ static int ext2_copy_single_inode(struct btrfs_trans_handle *trans, return btrfs_insert_inode(trans, root, objectid, &btrfs_inode); } +static int ext2_is_special_inode(ext2_ino_t ino) +{ + if (ino < EXT2_GOOD_OLD_FIRST_INO && ino != EXT2_ROOT_INO) + return 1; + return 0; +} + /* * scan ext2's inode bitmap and copy all used inodes. */ @@ -831,9 +838,7 @@ static int ext2_copy_inodes(struct btrfs_convert_context *cctx, /* no more inodes */ if (ext2_ino == 0) break; - /* skip special inode in ext2fs */ - if (ext2_ino < EXT2_GOOD_OLD_FIRST_INO && - ext2_ino != EXT2_ROOT_INO) + if (ext2_is_special_inode(ext2_ino)) continue; objectid = ext2_ino + INO_OFFSET; ret = ext2_copy_single_inode(trans, root, |