Skip to content

Commit a124232

Browse files
Qu Wenruokdave
Qu Wenruo
authored andcommitted
btrfs-progs: Refactor sectorsize users in file.c
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
1 parent 4925e1b commit a124232

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

file.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ int btrfs_read_file(struct btrfs_root *root, u64 ino, u64 start, int len,
193193
int read = 0;
194194
int ret;
195195

196-
if (!IS_ALIGNED(start, root->sectorsize) ||
197-
!IS_ALIGNED(len, root->sectorsize)) {
196+
if (!IS_ALIGNED(start, root->fs_info->sectorsize) ||
197+
!IS_ALIGNED(len, root->fs_info->sectorsize)) {
198198
warning("@start and @len must be aligned to %u for function %s",
199-
root->sectorsize, __func__);
199+
root->fs_info->sectorsize, __func__);
200200
return -EINVAL;
201201
}
202202

@@ -260,7 +260,7 @@ int btrfs_read_file(struct btrfs_root *root, u64 ino, u64 start, int len,
260260
goto next;
261261
read_extent_buffer(leaf, dest,
262262
btrfs_file_extent_inline_start(fi), extent_len);
263-
read += round_up(extent_len, root->sectorsize);
263+
read += round_up(extent_len, root->fs_info->sectorsize);
264264
break;
265265
}
266266

@@ -319,7 +319,7 @@ int btrfs_read_file(struct btrfs_root *root, u64 ino, u64 start, int len,
319319
ii = btrfs_item_ptr(path.nodes[0], path.slots[0],
320320
struct btrfs_inode_item);
321321
isize = round_up(btrfs_inode_size(path.nodes[0], ii),
322-
root->sectorsize);
322+
root->fs_info->sectorsize);
323323
read = min_t(u64, isize - start, len);
324324
}
325325
out:

0 commit comments

Comments
 (0)