diff options
-rw-r--r-- | fs/btrfs/btrfs_inode.h | 6 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 26 | ||||
-rw-r--r-- | fs/btrfs/file.c | 1 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 4 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 1 |
5 files changed, 34 insertions, 4 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 0b2e623cf421..1b9ec1ab1f68 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -49,9 +49,6 @@ struct btrfs_inode { | |||
49 | */ | 49 | */ |
50 | struct extent_io_tree io_failure_tree; | 50 | struct extent_io_tree io_failure_tree; |
51 | 51 | ||
52 | /* held while inserting checksums to avoid races */ | ||
53 | struct mutex csum_mutex; | ||
54 | |||
55 | /* held while inesrting or deleting extents from files */ | 52 | /* held while inesrting or deleting extents from files */ |
56 | struct mutex extent_mutex; | 53 | struct mutex extent_mutex; |
57 | 54 | ||
@@ -79,6 +76,9 @@ struct btrfs_inode { | |||
79 | */ | 76 | */ |
80 | u64 generation; | 77 | u64 generation; |
81 | 78 | ||
79 | /* sequence number for NFS changes */ | ||
80 | u64 sequence; | ||
81 | |||
82 | /* | 82 | /* |
83 | * transid of the trans_handle that last modified this inode | 83 | * transid of the trans_handle that last modified this inode |
84 | */ | 84 | */ |
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); | |||
1001 | BTRFS_SETGET_FUNCS(device_bytes_used, struct btrfs_dev_item, bytes_used, 64); | 1022 | BTRFS_SETGET_FUNCS(device_bytes_used, struct btrfs_dev_item, bytes_used, 64); |
1002 | BTRFS_SETGET_FUNCS(device_io_align, struct btrfs_dev_item, io_align, 32); | 1023 | BTRFS_SETGET_FUNCS(device_io_align, struct btrfs_dev_item, io_align, 32); |
1003 | BTRFS_SETGET_FUNCS(device_io_width, struct btrfs_dev_item, io_width, 32); | 1024 | BTRFS_SETGET_FUNCS(device_io_width, struct btrfs_dev_item, io_width, 32); |
1025 | BTRFS_SETGET_FUNCS(device_start_offset, struct btrfs_dev_item, | ||
1026 | start_offset, 64); | ||
1004 | BTRFS_SETGET_FUNCS(device_sector_size, struct btrfs_dev_item, sector_size, 32); | 1027 | BTRFS_SETGET_FUNCS(device_sector_size, struct btrfs_dev_item, sector_size, 32); |
1005 | BTRFS_SETGET_FUNCS(device_id, struct btrfs_dev_item, devid, 64); | 1028 | BTRFS_SETGET_FUNCS(device_id, struct btrfs_dev_item, devid, 64); |
1006 | BTRFS_SETGET_FUNCS(device_group, struct btrfs_dev_item, dev_group, 32); | 1029 | BTRFS_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 */ |
1137 | BTRFS_SETGET_FUNCS(inode_generation, struct btrfs_inode_item, generation, 64); | 1160 | BTRFS_SETGET_FUNCS(inode_generation, struct btrfs_inode_item, generation, 64); |
1161 | BTRFS_SETGET_FUNCS(inode_sequence, struct btrfs_inode_item, sequence, 64); | ||
1138 | BTRFS_SETGET_FUNCS(inode_transid, struct btrfs_inode_item, transid, 64); | 1162 | BTRFS_SETGET_FUNCS(inode_transid, struct btrfs_inode_item, transid, 64); |
1139 | BTRFS_SETGET_FUNCS(inode_size, struct btrfs_inode_item, size, 64); | 1163 | BTRFS_SETGET_FUNCS(inode_size, struct btrfs_inode_item, size, 64); |
1140 | BTRFS_SETGET_FUNCS(inode_nbytes, struct btrfs_inode_item, nbytes, 64); | 1164 | BTRFS_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); |
1520 | BTRFS_SETGET_STACK_FUNCS(super_log_root, struct btrfs_super_block, | 1544 | BTRFS_SETGET_STACK_FUNCS(super_log_root, struct btrfs_super_block, |
1521 | log_root, 64); | 1545 | log_root, 64); |
1546 | BTRFS_SETGET_STACK_FUNCS(super_log_root_transid, struct btrfs_super_block, | ||
1547 | log_root_transid, 64); | ||
1522 | BTRFS_SETGET_STACK_FUNCS(super_log_root_level, struct btrfs_super_block, | 1548 | BTRFS_SETGET_STACK_FUNCS(super_log_root_level, struct btrfs_super_block, |
1523 | log_root_level, 8); | 1549 | log_root_level, 8); |
1524 | BTRFS_SETGET_STACK_FUNCS(super_total_bytes, struct btrfs_super_block, | 1550 | BTRFS_SETGET_STACK_FUNCS(super_total_bytes, struct btrfs_super_block, |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 1c9243560eab..b5a6a2b6f668 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1055,6 +1055,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf, | |||
1055 | pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL); | 1055 | pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL); |
1056 | 1056 | ||
1057 | mutex_lock(&inode->i_mutex); | 1057 | mutex_lock(&inode->i_mutex); |
1058 | BTRFS_I(inode)->sequence++; | ||
1058 | first_index = pos >> PAGE_CACHE_SHIFT; | 1059 | first_index = pos >> PAGE_CACHE_SHIFT; |
1059 | last_index = (pos + count) >> PAGE_CACHE_SHIFT; | 1060 | last_index = (pos + count) >> PAGE_CACHE_SHIFT; |
1060 | 1061 | ||
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 | } |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 825364fae690..4d210a731d40 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -890,6 +890,7 @@ int btrfs_add_device(struct btrfs_trans_handle *trans, | |||
890 | btrfs_set_device_group(leaf, dev_item, 0); | 890 | btrfs_set_device_group(leaf, dev_item, 0); |
891 | btrfs_set_device_seek_speed(leaf, dev_item, 0); | 891 | btrfs_set_device_seek_speed(leaf, dev_item, 0); |
892 | btrfs_set_device_bandwidth(leaf, dev_item, 0); | 892 | btrfs_set_device_bandwidth(leaf, dev_item, 0); |
893 | btrfs_set_device_start_offset(leaf, dev_item, 0); | ||
893 | 894 | ||
894 | ptr = (unsigned long)btrfs_device_uuid(dev_item); | 895 | ptr = (unsigned long)btrfs_device_uuid(dev_item); |
895 | write_extent_buffer(leaf, device->uuid, ptr, BTRFS_UUID_SIZE); | 896 | write_extent_buffer(leaf, device->uuid, ptr, BTRFS_UUID_SIZE); |