diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-12-08 16:40:21 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-12-08 16:40:21 -0500 |
commit | c3027eb5523d6983f12628f3fe13d8a7576db701 (patch) | |
tree | 6a912094818ff261667228a4f6d83ecc4513ac43 /fs/btrfs/inode.c | |
parent | 934d375bacf9ea8a37fbfff5f3cf1c093f324095 (diff) |
Btrfs: Add inode sequence number for NFS and reserved space in a few structs
This adds a sequence number to the btrfs inode that is increased on
every update. NFS will be able to use that to detect when an inode has
changed, without relying on inaccurate time fields.
While we're here, this also:
Puts reserved space into the super block and inode
Adds a log root transid to the super so we can pick the newest super
based on the fsync log as well as the main transaction ID. For now
the log root transid is always zero, but that'll get fixed.
Adds a starting offset to the dev_item. This will let us do better
alignment calculations if we know the start of a partition on the disk.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c03d847b8c4e..932d8c0b2c05 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1963,6 +1963,7 @@ void btrfs_read_locked_inode(struct inode *inode) | |||
1963 | 1963 | ||
1964 | inode_set_bytes(inode, btrfs_inode_nbytes(leaf, inode_item)); | 1964 | inode_set_bytes(inode, btrfs_inode_nbytes(leaf, inode_item)); |
1965 | BTRFS_I(inode)->generation = btrfs_inode_generation(leaf, inode_item); | 1965 | BTRFS_I(inode)->generation = btrfs_inode_generation(leaf, inode_item); |
1966 | BTRFS_I(inode)->sequence = btrfs_inode_sequence(leaf, inode_item); | ||
1966 | inode->i_generation = BTRFS_I(inode)->generation; | 1967 | inode->i_generation = BTRFS_I(inode)->generation; |
1967 | inode->i_rdev = 0; | 1968 | inode->i_rdev = 0; |
1968 | rdev = btrfs_inode_rdev(leaf, inode_item); | 1969 | rdev = btrfs_inode_rdev(leaf, inode_item); |
@@ -2043,6 +2044,7 @@ static void fill_inode_item(struct btrfs_trans_handle *trans, | |||
2043 | 2044 | ||
2044 | btrfs_set_inode_nbytes(leaf, item, inode_get_bytes(inode)); | 2045 | btrfs_set_inode_nbytes(leaf, item, inode_get_bytes(inode)); |
2045 | btrfs_set_inode_generation(leaf, item, BTRFS_I(inode)->generation); | 2046 | btrfs_set_inode_generation(leaf, item, BTRFS_I(inode)->generation); |
2047 | btrfs_set_inode_sequence(leaf, item, BTRFS_I(inode)->sequence); | ||
2046 | btrfs_set_inode_transid(leaf, item, trans->transid); | 2048 | btrfs_set_inode_transid(leaf, item, trans->transid); |
2047 | btrfs_set_inode_rdev(leaf, item, inode->i_rdev); | 2049 | btrfs_set_inode_rdev(leaf, item, inode->i_rdev); |
2048 | btrfs_set_inode_flags(leaf, item, BTRFS_I(inode)->flags); | 2050 | btrfs_set_inode_flags(leaf, item, BTRFS_I(inode)->flags); |
@@ -2945,6 +2947,7 @@ static noinline void init_btrfs_i(struct inode *inode) | |||
2945 | bi->i_default_acl = NULL; | 2947 | bi->i_default_acl = NULL; |
2946 | 2948 | ||
2947 | bi->generation = 0; | 2949 | bi->generation = 0; |
2950 | bi->sequence = 0; | ||
2948 | bi->last_trans = 0; | 2951 | bi->last_trans = 0; |
2949 | bi->logged_trans = 0; | 2952 | bi->logged_trans = 0; |
2950 | bi->delalloc_bytes = 0; | 2953 | bi->delalloc_bytes = 0; |
@@ -2959,7 +2962,6 @@ static noinline void init_btrfs_i(struct inode *inode) | |||
2959 | inode->i_mapping, GFP_NOFS); | 2962 | inode->i_mapping, GFP_NOFS); |
2960 | INIT_LIST_HEAD(&BTRFS_I(inode)->delalloc_inodes); | 2963 | INIT_LIST_HEAD(&BTRFS_I(inode)->delalloc_inodes); |
2961 | btrfs_ordered_inode_tree_init(&BTRFS_I(inode)->ordered_tree); | 2964 | btrfs_ordered_inode_tree_init(&BTRFS_I(inode)->ordered_tree); |
2962 | mutex_init(&BTRFS_I(inode)->csum_mutex); | ||
2963 | mutex_init(&BTRFS_I(inode)->extent_mutex); | 2965 | mutex_init(&BTRFS_I(inode)->extent_mutex); |
2964 | mutex_init(&BTRFS_I(inode)->log_mutex); | 2966 | mutex_init(&BTRFS_I(inode)->log_mutex); |
2965 | } | 2967 | } |