Skip to content

Commit 6a9e1d1

Browse files
fdmananakdave
authored andcommitted
btrfs: store and use node size in local variable in check_eb_alignment()
Instead of dereferencing fs_info every time we need to access the node size, store in a local variable to make the code less verbose and avoid a line split too. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 26baec6 commit 6a9e1d1

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

fs/btrfs/extent_io.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3226,29 +3226,30 @@ static struct extent_buffer *grab_extent_buffer(struct btrfs_fs_info *fs_info,
32263226
*/
32273227
static bool check_eb_alignment(struct btrfs_fs_info *fs_info, u64 start)
32283228
{
3229+
const u32 nodesize = fs_info->nodesize;
3230+
32293231
if (!IS_ALIGNED(start, fs_info->sectorsize)) {
32303232
btrfs_err(fs_info, "bad tree block start %llu", start);
32313233
return true;
32323234
}
32333235

3234-
if (fs_info->nodesize < PAGE_SIZE && !IS_ALIGNED(start, fs_info->nodesize)) {
3236+
if (nodesize < PAGE_SIZE && !IS_ALIGNED(start, nodesize)) {
32353237
btrfs_err(fs_info,
32363238
"tree block is not nodesize aligned, start %llu nodesize %u",
3237-
start, fs_info->nodesize);
3239+
start, nodesize);
32383240
return true;
32393241
}
3240-
if (fs_info->nodesize >= PAGE_SIZE &&
3241-
!PAGE_ALIGNED(start)) {
3242+
if (nodesize >= PAGE_SIZE && !PAGE_ALIGNED(start)) {
32423243
btrfs_err(fs_info,
32433244
"tree block is not page aligned, start %llu nodesize %u",
3244-
start, fs_info->nodesize);
3245+
start, nodesize);
32453246
return true;
32463247
}
3247-
if (!IS_ALIGNED(start, fs_info->nodesize) &&
3248+
if (!IS_ALIGNED(start, nodesize) &&
32483249
!test_and_set_bit(BTRFS_FS_UNALIGNED_TREE_BLOCK, &fs_info->flags)) {
32493250
btrfs_warn(fs_info,
32503251
"tree block not nodesize aligned, start %llu nodesize %u, can be resolved by a full metadata balance",
3251-
start, fs_info->nodesize);
3252+
start, nodesize);
32523253
}
32533254
return false;
32543255
}

0 commit comments

Comments
 (0)