Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332528
b: refs/heads/master
c: 46d8bc3
h: refs/heads/master
v: v3
  • Loading branch information
Liu Bo authored and Chris Mason committed Oct 1, 2012
1 parent e63a77b commit 5ce91a3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 321f0e70225abc792d74902a2bc4a60164265fd4
refs/heads/master: 46d8bc34248f3a94dea910137d1ddf5fb1e3a1cc
14 changes: 6 additions & 8 deletions trunk/fs/btrfs/btrfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ struct btrfs_inode {
/* flags field from the on disk inode */
u32 flags;

/* a local copy of root's last_log_commit */
unsigned long last_log_commit;

/*
* Counters to keep track of the number of extent item's we may use due
* to delalloc and such. outstanding_extents is the number of extent
Expand Down Expand Up @@ -203,15 +206,10 @@ static inline bool btrfs_is_free_space_inode(struct inode *inode)

static inline int btrfs_inode_in_log(struct inode *inode, u64 generation)
{
struct btrfs_root *root = BTRFS_I(inode)->root;
int ret = 0;

mutex_lock(&root->log_mutex);
if (BTRFS_I(inode)->logged_trans == generation &&
BTRFS_I(inode)->last_sub_trans <= root->last_log_commit)
ret = 1;
mutex_unlock(&root->log_mutex);
return ret;
BTRFS_I(inode)->last_sub_trans <= BTRFS_I(inode)->last_log_commit)
return 1;
return 0;
}

#endif
2 changes: 2 additions & 0 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6774,6 +6774,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)

BTRFS_I(inode)->last_trans = root->fs_info->generation;
BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid;
BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->root->last_log_commit;

unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS);

Expand Down Expand Up @@ -7018,6 +7019,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
ei->csum_bytes = 0;
ei->index_cnt = (u64)-1;
ei->last_unlink_trans = 0;
ei->last_log_commit = 0;

spin_lock_init(&ei->lock);
ei->outstanding_extents = 0;
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/btrfs/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans,
{
BTRFS_I(inode)->last_trans = trans->transaction->transid;
BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid;
BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->root->last_log_commit;
}

int btrfs_end_transaction(struct btrfs_trans_handle *trans,
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -3185,6 +3185,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
}
}
BTRFS_I(inode)->logged_trans = trans->transid;
BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans;
out_unlock:
mutex_unlock(&BTRFS_I(inode)->log_mutex);

Expand Down

0 comments on commit 5ce91a3

Please sign in to comment.