diff options
| -rw-r--r-- | fs/btrfs/btrfs_inode.h | 14 | ||||
| -rw-r--r-- | fs/btrfs/inode.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/transaction.h | 1 | ||||
| -rw-r--r-- | fs/btrfs/tree-log.c | 1 |
4 files changed, 10 insertions, 8 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 7c7bf818f3c1..ed8ca7ca5eff 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
| @@ -144,6 +144,9 @@ struct btrfs_inode { | |||
| 144 | /* flags field from the on disk inode */ | 144 | /* flags field from the on disk inode */ |
| 145 | u32 flags; | 145 | u32 flags; |
| 146 | 146 | ||
| 147 | /* a local copy of root's last_log_commit */ | ||
| 148 | unsigned long last_log_commit; | ||
| 149 | |||
| 147 | /* | 150 | /* |
| 148 | * Counters to keep track of the number of extent item's we may use due | 151 | * Counters to keep track of the number of extent item's we may use due |
| 149 | * to delalloc and such. outstanding_extents is the number of extent | 152 | * to delalloc and such. outstanding_extents is the number of extent |
| @@ -203,15 +206,10 @@ static inline bool btrfs_is_free_space_inode(struct inode *inode) | |||
| 203 | 206 | ||
| 204 | static inline int btrfs_inode_in_log(struct inode *inode, u64 generation) | 207 | static inline int btrfs_inode_in_log(struct inode *inode, u64 generation) |
| 205 | { | 208 | { |
| 206 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
| 207 | int ret = 0; | ||
| 208 | |||
| 209 | mutex_lock(&root->log_mutex); | ||
| 210 | if (BTRFS_I(inode)->logged_trans == generation && | 209 | if (BTRFS_I(inode)->logged_trans == generation && |
| 211 | BTRFS_I(inode)->last_sub_trans <= root->last_log_commit) | 210 | BTRFS_I(inode)->last_sub_trans <= BTRFS_I(inode)->last_log_commit) |
| 212 | ret = 1; | 211 | return 1; |
| 213 | mutex_unlock(&root->log_mutex); | 212 | return 0; |
| 214 | return ret; | ||
| 215 | } | 213 | } |
| 216 | 214 | ||
| 217 | #endif | 215 | #endif |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a6824bd04493..24745b8f2745 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -6774,6 +6774,7 @@ again: | |||
| 6774 | 6774 | ||
| 6775 | BTRFS_I(inode)->last_trans = root->fs_info->generation; | 6775 | BTRFS_I(inode)->last_trans = root->fs_info->generation; |
| 6776 | BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid; | 6776 | BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid; |
| 6777 | BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->root->last_log_commit; | ||
| 6777 | 6778 | ||
| 6778 | unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS); | 6779 | unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS); |
| 6779 | 6780 | ||
| @@ -7018,6 +7019,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb) | |||
| 7018 | ei->csum_bytes = 0; | 7019 | ei->csum_bytes = 0; |
| 7019 | ei->index_cnt = (u64)-1; | 7020 | ei->index_cnt = (u64)-1; |
| 7020 | ei->last_unlink_trans = 0; | 7021 | ei->last_unlink_trans = 0; |
| 7022 | ei->last_log_commit = 0; | ||
| 7021 | 7023 | ||
| 7022 | spin_lock_init(&ei->lock); | 7024 | spin_lock_init(&ei->lock); |
| 7023 | ei->outstanding_extents = 0; | 7025 | ei->outstanding_extents = 0; |
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h index e8b8416c688b..1a138bfb8f13 100644 --- a/fs/btrfs/transaction.h +++ b/fs/btrfs/transaction.h | |||
| @@ -88,6 +88,7 @@ static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans, | |||
| 88 | { | 88 | { |
| 89 | BTRFS_I(inode)->last_trans = trans->transaction->transid; | 89 | BTRFS_I(inode)->last_trans = trans->transaction->transid; |
| 90 | BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid; | 90 | BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid; |
| 91 | BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->root->last_log_commit; | ||
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, | 94 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 71e71539ffb7..fc0df95c2862 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
| @@ -3185,6 +3185,7 @@ next_slot: | |||
| 3185 | } | 3185 | } |
| 3186 | } | 3186 | } |
| 3187 | BTRFS_I(inode)->logged_trans = trans->transid; | 3187 | BTRFS_I(inode)->logged_trans = trans->transid; |
| 3188 | BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans; | ||
| 3188 | out_unlock: | 3189 | out_unlock: |
| 3189 | mutex_unlock(&BTRFS_I(inode)->log_mutex); | 3190 | mutex_unlock(&BTRFS_I(inode)->log_mutex); |
| 3190 | 3191 | ||
