Commit 6ef06d27 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Make btrfs_i_size_write take btrfs_inode

Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 877574e2
...@@ -237,10 +237,10 @@ static inline u64 btrfs_ino(struct btrfs_inode *inode) ...@@ -237,10 +237,10 @@ static inline u64 btrfs_ino(struct btrfs_inode *inode)
return ino; return ino;
} }
static inline void btrfs_i_size_write(struct inode *inode, u64 size) static inline void btrfs_i_size_write(struct btrfs_inode *inode, u64 size)
{ {
i_size_write(inode, size); i_size_write(&inode->vfs_inode, size);
BTRFS_I(inode)->disk_i_size = size; inode->disk_i_size = size;
} }
static inline bool btrfs_is_free_space_inode(struct inode *inode) static inline bool btrfs_is_free_space_inode(struct inode *inode)
......
...@@ -1790,7 +1790,7 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev) ...@@ -1790,7 +1790,7 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev)
i_uid_write(inode, btrfs_stack_inode_uid(inode_item)); i_uid_write(inode, btrfs_stack_inode_uid(inode_item));
i_gid_write(inode, btrfs_stack_inode_gid(inode_item)); i_gid_write(inode, btrfs_stack_inode_gid(inode_item));
btrfs_i_size_write(inode, btrfs_stack_inode_size(inode_item)); btrfs_i_size_write(BTRFS_I(inode), btrfs_stack_inode_size(inode_item));
inode->i_mode = btrfs_stack_inode_mode(inode_item); inode->i_mode = btrfs_stack_inode_mode(inode_item);
set_nlink(inode, btrfs_stack_inode_nlink(inode_item)); set_nlink(inode, btrfs_stack_inode_nlink(inode_item));
inode_set_bytes(inode, btrfs_stack_inode_nbytes(inode_item)); inode_set_bytes(inode, btrfs_stack_inode_nbytes(inode_item));
......
...@@ -260,7 +260,7 @@ int btrfs_truncate_free_space_cache(struct btrfs_trans_handle *trans, ...@@ -260,7 +260,7 @@ int btrfs_truncate_free_space_cache(struct btrfs_trans_handle *trans,
btrfs_free_path(path); btrfs_free_path(path);
} }
btrfs_i_size_write(inode, 0); btrfs_i_size_write(BTRFS_I(inode), 0);
truncate_pagecache(inode, 0); truncate_pagecache(inode, 0);
/* /*
......
...@@ -3617,7 +3617,7 @@ static int btrfs_read_locked_inode(struct inode *inode) ...@@ -3617,7 +3617,7 @@ static int btrfs_read_locked_inode(struct inode *inode)
set_nlink(inode, btrfs_inode_nlink(leaf, inode_item)); set_nlink(inode, btrfs_inode_nlink(leaf, inode_item));
i_uid_write(inode, btrfs_inode_uid(leaf, inode_item)); i_uid_write(inode, btrfs_inode_uid(leaf, inode_item));
i_gid_write(inode, btrfs_inode_gid(leaf, inode_item)); i_gid_write(inode, btrfs_inode_gid(leaf, inode_item));
btrfs_i_size_write(inode, btrfs_inode_size(leaf, inode_item)); btrfs_i_size_write(BTRFS_I(inode), btrfs_inode_size(leaf, inode_item));
inode->i_atime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->atime); inode->i_atime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->atime);
inode->i_atime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->atime); inode->i_atime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->atime);
...@@ -3988,8 +3988,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans, ...@@ -3988,8 +3988,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
if (ret) if (ret)
goto out; goto out;
btrfs_i_size_write(&dir->vfs_inode, btrfs_i_size_write(dir, dir->vfs_inode.i_size - name_len * 2);
dir->vfs_inode.i_size - name_len * 2);
inode_inc_iversion(&inode->vfs_inode); inode_inc_iversion(&inode->vfs_inode);
inode_inc_iversion(&dir->vfs_inode); inode_inc_iversion(&dir->vfs_inode);
inode->vfs_inode.i_ctime = dir->vfs_inode.i_mtime = inode->vfs_inode.i_ctime = dir->vfs_inode.i_mtime =
...@@ -4137,7 +4136,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, ...@@ -4137,7 +4136,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
goto out; goto out;
} }
btrfs_i_size_write(dir, dir->i_size - name_len * 2); btrfs_i_size_write(BTRFS_I(dir), dir->i_size - name_len * 2);
inode_inc_iversion(dir); inode_inc_iversion(dir);
dir->i_mtime = dir->i_ctime = current_time(dir); dir->i_mtime = dir->i_ctime = current_time(dir);
ret = btrfs_update_inode_fallback(trans, root, dir); ret = btrfs_update_inode_fallback(trans, root, dir);
...@@ -4184,7 +4183,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -4184,7 +4183,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
BTRFS_I(d_inode(dentry)), dentry->d_name.name, BTRFS_I(d_inode(dentry)), dentry->d_name.name,
dentry->d_name.len); dentry->d_name.len);
if (!err) { if (!err) {
btrfs_i_size_write(inode, 0); btrfs_i_size_write(BTRFS_I(inode), 0);
/* /*
* Propagate the last_unlink_trans value of the deleted dir to * Propagate the last_unlink_trans value of the deleted dir to
* its parent directory. This is to prevent an unrecoverable * its parent directory. This is to prevent an unrecoverable
...@@ -5221,7 +5220,7 @@ void btrfs_evict_inode(struct inode *inode) ...@@ -5221,7 +5220,7 @@ void btrfs_evict_inode(struct inode *inode)
rsv->failfast = 1; rsv->failfast = 1;
global_rsv = &fs_info->global_block_rsv; global_rsv = &fs_info->global_block_rsv;
btrfs_i_size_write(inode, 0); btrfs_i_size_write(BTRFS_I(inode), 0);
/* /*
* This is a bit simpler than btrfs_truncate since we've already * This is a bit simpler than btrfs_truncate since we've already
...@@ -6285,7 +6284,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans, ...@@ -6285,7 +6284,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
return ret; return ret;
} }
btrfs_i_size_write(parent_inode, parent_inode->i_size + btrfs_i_size_write(BTRFS_I(parent_inode), parent_inode->i_size +
name_len * 2); name_len * 2);
inode_inc_iversion(parent_inode); inode_inc_iversion(parent_inode);
parent_inode->i_mtime = parent_inode->i_ctime = parent_inode->i_mtime = parent_inode->i_ctime =
...@@ -6589,7 +6588,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ...@@ -6589,7 +6588,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
if (err) if (err)
goto out_fail_inode; goto out_fail_inode;
btrfs_i_size_write(inode, 0); btrfs_i_size_write(BTRFS_I(inode), 0);
err = btrfs_update_inode(trans, root, inode); err = btrfs_update_inode(trans, root, inode);
if (err) if (err)
goto out_fail_inode; goto out_fail_inode;
...@@ -9205,7 +9204,7 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, ...@@ -9205,7 +9204,7 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
inode->i_fop = &btrfs_dir_file_operations; inode->i_fop = &btrfs_dir_file_operations;
set_nlink(inode, 1); set_nlink(inode, 1);
btrfs_i_size_write(inode, 0); btrfs_i_size_write(BTRFS_I(inode), 0);
unlock_new_inode(inode); unlock_new_inode(inode);
err = btrfs_subvol_inherit_props(trans, new_root, parent_root); err = btrfs_subvol_inherit_props(trans, new_root, parent_root);
...@@ -10232,7 +10231,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, ...@@ -10232,7 +10231,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
inode_nohighmem(inode); inode_nohighmem(inode);
inode->i_mapping->a_ops = &btrfs_symlink_aops; inode->i_mapping->a_ops = &btrfs_symlink_aops;
inode_set_bytes(inode, name_len); inode_set_bytes(inode, name_len);
btrfs_i_size_write(inode, name_len); btrfs_i_size_write(BTRFS_I(inode), name_len);
err = btrfs_update_inode(trans, root, inode); err = btrfs_update_inode(trans, root, inode);
/* /*
* Last step, add directory indexes for our symlink inode. This is the * Last step, add directory indexes for our symlink inode. This is the
......
...@@ -594,7 +594,7 @@ static noinline int create_subvol(struct inode *dir, ...@@ -594,7 +594,7 @@ static noinline int create_subvol(struct inode *dir,
goto fail; goto fail;
} }
btrfs_i_size_write(dir, dir->i_size + namelen * 2); btrfs_i_size_write(BTRFS_I(dir), dir->i_size + namelen * 2);
ret = btrfs_update_inode(trans, root, dir); ret = btrfs_update_inode(trans, root, dir);
BUG_ON(ret); BUG_ON(ret);
...@@ -3298,7 +3298,7 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans, ...@@ -3298,7 +3298,7 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans,
if (endoff > destoff + olen) if (endoff > destoff + olen)
endoff = destoff + olen; endoff = destoff + olen;
if (endoff > inode->i_size) if (endoff > inode->i_size)
btrfs_i_size_write(inode, endoff); btrfs_i_size_write(BTRFS_I(inode), endoff);
ret = btrfs_update_inode(trans, root, inode); ret = btrfs_update_inode(trans, root, inode);
if (ret) { if (ret) {
......
...@@ -1653,7 +1653,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, ...@@ -1653,7 +1653,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
goto fail; goto fail;
} }
btrfs_i_size_write(parent_inode, parent_inode->i_size + btrfs_i_size_write(BTRFS_I(parent_inode), parent_inode->i_size +
dentry->d_name.len * 2); dentry->d_name.len * 2);
parent_inode->i_mtime = parent_inode->i_ctime = parent_inode->i_mtime = parent_inode->i_ctime =
current_time(parent_inode); current_time(parent_inode);
......
...@@ -1780,7 +1780,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, ...@@ -1780,7 +1780,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
out: out:
btrfs_release_path(path); btrfs_release_path(path);
if (!ret && update_size) { if (!ret && update_size) {
btrfs_i_size_write(dir, dir->i_size + name_len * 2); btrfs_i_size_write(BTRFS_I(dir), dir->i_size + name_len * 2);
ret = btrfs_update_inode(trans, root, dir); ret = btrfs_update_inode(trans, root, dir);
} }
kfree(name); kfree(name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment