summaryrefslogtreecommitdiff
path: root/mkfs/rootdir.c
diff options
context:
space:
mode:
authorGu Jinxiang <gujx@cn.fujitsu.com>2018-01-26 15:26:02 +0800
committerDavid Sterba <dsterba@suse.com>2018-02-02 16:01:57 +0100
commitc9581107856ac932817c4bb832042c968af45394 (patch)
treef733bc34c719da20c9f1bbdaf6994a70b579d75f /mkfs/rootdir.c
parent3809b36d855fd13aad31c3a426a4d7434180003a (diff)
btrfs-progs: Sync code with kernel for BTRFS_MAX_INLINE_DATA_SIZE
Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_MAX_INLINE_DATA_SIZE, since maybe in some situation we do not know root, but just know fs_info. Change macro to inline function to be consistent with kernel. And change the function body to match kernel. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'mkfs/rootdir.c')
-rw-r--r--mkfs/rootdir.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mkfs/rootdir.c b/mkfs/rootdir.c
index 9be4bcbf..022d1185 100644
--- a/mkfs/rootdir.c
+++ b/mkfs/rootdir.c
@@ -139,7 +139,7 @@ static int fill_inode_item(struct btrfs_trans_handle *trans,
}
if (S_ISREG(src->st_mode)) {
btrfs_set_stack_inode_size(dst, (u64)src->st_size);
- if (src->st_size <= BTRFS_MAX_INLINE_DATA_SIZE(root))
+ if (src->st_size <= BTRFS_MAX_INLINE_DATA_SIZE(root->fs_info))
btrfs_set_stack_inode_nbytes(dst, src->st_size);
else {
blocks = src->st_size / sectorsize;
@@ -327,7 +327,7 @@ static int add_file_items(struct btrfs_trans_handle *trans,
if (st->st_size % sectorsize)
blocks += 1;
- if (st->st_size <= BTRFS_MAX_INLINE_DATA_SIZE(root)) {
+ if (st->st_size <= BTRFS_MAX_INLINE_DATA_SIZE(root->fs_info)) {
char *buffer = malloc(st->st_size);
if (!buffer) {