@@ -722,17 +722,27 @@ static int btrfs_write_inode(struct inode *inode, int wait)
722
722
{
723
723
struct btrfs_root * root = BTRFS_I (inode )-> root ;
724
724
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 ;
726
740
727
741
mutex_lock (& root -> fs_info -> fs_mutex );
728
742
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 );
734
745
mutex_unlock (& root -> fs_info -> fs_mutex );
735
- return ret ;
736
746
}
737
747
738
748
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)
2390
2400
buf -> f_type = BTRFS_SUPER_MAGIC ;
2391
2401
return 0 ;
2392
2402
}
2403
+
2393
2404
static struct file_system_type btrfs_fs_type = {
2394
2405
.owner = THIS_MODULE ,
2395
2406
.name = "btrfs" ,
@@ -2405,6 +2416,7 @@ static struct super_operations btrfs_super_ops = {
2405
2416
.write_super = btrfs_write_super ,
2406
2417
.sync_fs = btrfs_sync_fs ,
2407
2418
.write_inode = btrfs_write_inode ,
2419
+ .dirty_inode = btrfs_dirty_inode ,
2408
2420
.alloc_inode = btrfs_alloc_inode ,
2409
2421
.destroy_inode = btrfs_destroy_inode ,
2410
2422
.statfs = btrfs_statfs ,
0 commit comments