Skip to content

Commit b513386

Browse files
chrismason-xxDavid Woodhouse
authored andcommitted
Btrfs: add dirty_inode call
Signed-off-by: Chris Mason <[email protected]>
1 parent 5e82849 commit b513386

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

fs/btrfs/super.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -722,17 +722,27 @@ static int btrfs_write_inode(struct inode *inode, int wait)
722722
{
723723
struct btrfs_root *root = BTRFS_I(inode)->root;
724724
struct btrfs_trans_handle *trans;
725-
int ret;
725+
int ret = 0;
726+
727+
if (wait) {
728+
mutex_lock(&root->fs_info->fs_mutex);
729+
trans = btrfs_start_transaction(root, 1);
730+
ret = btrfs_commit_transaction(trans, root);
731+
mutex_unlock(&root->fs_info->fs_mutex);
732+
}
733+
return ret;
734+
}
735+
736+
static void btrfs_dirty_inode(struct inode *inode)
737+
{
738+
struct btrfs_root *root = BTRFS_I(inode)->root;
739+
struct btrfs_trans_handle *trans;
726740

727741
mutex_lock(&root->fs_info->fs_mutex);
728742
trans = btrfs_start_transaction(root, 1);
729-
ret = btrfs_update_inode(trans, root, inode);
730-
if (wait)
731-
btrfs_commit_transaction(trans, root);
732-
else
733-
btrfs_end_transaction(trans, root);
743+
btrfs_update_inode(trans, root, inode);
744+
btrfs_end_transaction(trans, root);
734745
mutex_unlock(&root->fs_info->fs_mutex);
735-
return ret;
736746
}
737747

738748
static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
@@ -2390,6 +2400,7 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
23902400
buf->f_type = BTRFS_SUPER_MAGIC;
23912401
return 0;
23922402
}
2403+
23932404
static struct file_system_type btrfs_fs_type = {
23942405
.owner = THIS_MODULE,
23952406
.name = "btrfs",
@@ -2405,6 +2416,7 @@ static struct super_operations btrfs_super_ops = {
24052416
.write_super = btrfs_write_super,
24062417
.sync_fs = btrfs_sync_fs,
24072418
.write_inode = btrfs_write_inode,
2419+
.dirty_inode = btrfs_dirty_inode,
24082420
.alloc_inode = btrfs_alloc_inode,
24092421
.destroy_inode = btrfs_destroy_inode,
24102422
.statfs = btrfs_statfs,

0 commit comments

Comments
 (0)