aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-12-08 16:40:21 -0500
committerChris Mason <chris.mason@oracle.com>2008-12-08 16:40:21 -0500
commitc3027eb5523d6983f12628f3fe13d8a7576db701 (patch)
tree6a912094818ff261667228a4f6d83ecc4513ac43 /fs/btrfs/ctree.h
parent934d375bacf9ea8a37fbfff5f3cf1c093f324095 (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/ctree.h')
-rw-r--r--fs/btrfs/ctree.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 242b961ae6de..f72b43819349 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -196,6 +196,12 @@ struct btrfs_dev_item {
196 /* expected generation for this device */ 196 /* expected generation for this device */
197 __le64 generation; 197 __le64 generation;
198 198
199 /*
200 * starting byte of this partition on the device,
201 * to allowr for stripe alignment in the future
202 */
203 __le64 start_offset;
204
199 /* grouping information for allocation decisions */ 205 /* grouping information for allocation decisions */
200 __le32 dev_group; 206 __le32 dev_group;
201 207
@@ -311,6 +317,9 @@ struct btrfs_super_block {
311 __le64 root; 317 __le64 root;
312 __le64 chunk_root; 318 __le64 chunk_root;
313 __le64 log_root; 319 __le64 log_root;
320
321 /* this will help find the new super based on the log root */
322 __le64 log_root_transid;
314 __le64 total_bytes; 323 __le64 total_bytes;
315 __le64 bytes_used; 324 __le64 bytes_used;
316 __le64 root_dir_objectid; 325 __le64 root_dir_objectid;
@@ -329,7 +338,11 @@ struct btrfs_super_block {
329 u8 chunk_root_level; 338 u8 chunk_root_level;
330 u8 log_root_level; 339 u8 log_root_level;
331 struct btrfs_dev_item dev_item; 340 struct btrfs_dev_item dev_item;
341
332 char label[BTRFS_LABEL_SIZE]; 342 char label[BTRFS_LABEL_SIZE];
343
344 /* future expansion */
345 __le64 reserved[32];
333 u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE]; 346 u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
334} __attribute__ ((__packed__)); 347} __attribute__ ((__packed__));
335 348
@@ -463,6 +476,14 @@ struct btrfs_inode_item {
463 __le64 rdev; 476 __le64 rdev;
464 __le64 flags; 477 __le64 flags;
465 478
479 /* modification sequence number for NFS */
480 __le64 sequence;
481
482 /*
483 * a little future expansion, for more than this we can
484 * just grow the inode item and version it
485 */
486 __le64 reserved[4];
466 struct btrfs_timespec atime; 487 struct btrfs_timespec atime;
467 struct btrfs_timespec ctime; 488 struct btrfs_timespec ctime;
468 struct btrfs_timespec mtime; 489 struct btrfs_timespec mtime;
@@ -1001,6 +1022,8 @@ BTRFS_SETGET_FUNCS(device_total_bytes, struct btrfs_dev_item, total_bytes, 64);
1001BTRFS_SETGET_FUNCS(device_bytes_used, struct btrfs_dev_item, bytes_used, 64); 1022BTRFS_SETGET_FUNCS(device_bytes_used, struct btrfs_dev_item, bytes_used, 64);
1002BTRFS_SETGET_FUNCS(device_io_align, struct btrfs_dev_item, io_align, 32); 1023BTRFS_SETGET_FUNCS(device_io_align, struct btrfs_dev_item, io_align, 32);
1003BTRFS_SETGET_FUNCS(device_io_width, struct btrfs_dev_item, io_width, 32); 1024BTRFS_SETGET_FUNCS(device_io_width, struct btrfs_dev_item, io_width, 32);
1025BTRFS_SETGET_FUNCS(device_start_offset, struct btrfs_dev_item,
1026 start_offset, 64);
1004BTRFS_SETGET_FUNCS(device_sector_size, struct btrfs_dev_item, sector_size, 32); 1027BTRFS_SETGET_FUNCS(device_sector_size, struct btrfs_dev_item, sector_size, 32);
1005BTRFS_SETGET_FUNCS(device_id, struct btrfs_dev_item, devid, 64); 1028BTRFS_SETGET_FUNCS(device_id, struct btrfs_dev_item, devid, 64);
1006BTRFS_SETGET_FUNCS(device_group, struct btrfs_dev_item, dev_group, 32); 1029BTRFS_SETGET_FUNCS(device_group, struct btrfs_dev_item, dev_group, 32);
@@ -1135,6 +1158,7 @@ BTRFS_SETGET_FUNCS(inode_ref_index, struct btrfs_inode_ref, index, 64);
1135 1158
1136/* struct btrfs_inode_item */ 1159/* struct btrfs_inode_item */
1137BTRFS_SETGET_FUNCS(inode_generation, struct btrfs_inode_item, generation, 64); 1160BTRFS_SETGET_FUNCS(inode_generation, struct btrfs_inode_item, generation, 64);
1161BTRFS_SETGET_FUNCS(inode_sequence, struct btrfs_inode_item, sequence, 64);
1138BTRFS_SETGET_FUNCS(inode_transid, struct btrfs_inode_item, transid, 64); 1162BTRFS_SETGET_FUNCS(inode_transid, struct btrfs_inode_item, transid, 64);
1139BTRFS_SETGET_FUNCS(inode_size, struct btrfs_inode_item, size, 64); 1163BTRFS_SETGET_FUNCS(inode_size, struct btrfs_inode_item, size, 64);
1140BTRFS_SETGET_FUNCS(inode_nbytes, struct btrfs_inode_item, nbytes, 64); 1164BTRFS_SETGET_FUNCS(inode_nbytes, struct btrfs_inode_item, nbytes, 64);
@@ -1519,6 +1543,8 @@ BTRFS_SETGET_STACK_FUNCS(super_chunk_root_level, struct btrfs_super_block,
1519 chunk_root_level, 8); 1543 chunk_root_level, 8);
1520BTRFS_SETGET_STACK_FUNCS(super_log_root, struct btrfs_super_block, 1544BTRFS_SETGET_STACK_FUNCS(super_log_root, struct btrfs_super_block,
1521 log_root, 64); 1545 log_root, 64);
1546BTRFS_SETGET_STACK_FUNCS(super_log_root_transid, struct btrfs_super_block,
1547 log_root_transid, 64);
1522BTRFS_SETGET_STACK_FUNCS(super_log_root_level, struct btrfs_super_block, 1548BTRFS_SETGET_STACK_FUNCS(super_log_root_level, struct btrfs_super_block,
1523 log_root_level, 8); 1549 log_root_level, 8);
1524BTRFS_SETGET_STACK_FUNCS(super_total_bytes, struct btrfs_super_block, 1550BTRFS_SETGET_STACK_FUNCS(super_total_bytes, struct btrfs_super_block,