Message ID | 49cfd0aca92177345f59f3f700f6d43f8445f405.1370534938.git.sbehrens@giantdisaster.de (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
On Fri, Jun 07, 2013 at 04:27:51AM -0600, Stefan Behrens wrote: > In order to be able to detect the case that a filesystem is mounted > with an old kernel, add a uuid-tree-gen field like the free space > cache is doing it. It is part of the super block and written with > each commit. Old kernels do not know this field and don't update it. > So to get around the whole crashing before we finish creating the uuid tree maybe set some flag or something that doesn't actually set the super->uuid_tree_generation until _after_ it finishes populating the tree, and then have the scan deal with having a half populated tree. Just an idea, but we have to deal with it some way. Thanks, Josef -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 06/07/2013 16:39, Josef Bacik wrote: > On Fri, Jun 07, 2013 at 04:27:51AM -0600, Stefan Behrens wrote: >> In order to be able to detect the case that a filesystem is mounted >> with an old kernel, add a uuid-tree-gen field like the free space >> cache is doing it. It is part of the super block and written with >> each commit. Old kernels do not know this field and don't update it. >> > > So to get around the whole crashing before we finish creating the uuid tree > maybe set some flag or something that doesn't actually set the > super->uuid_tree_generation until _after_ it finishes populating the tree, and > then have the scan deal with having a half populated tree. Just an idea, but we > have to deal with it some way. Thanks, That's what the patch 7/8 is doing. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Jun 07, 2013 at 08:41:52AM -0600, Stefan Behrens wrote: > On 06/07/2013 16:39, Josef Bacik wrote: > > On Fri, Jun 07, 2013 at 04:27:51AM -0600, Stefan Behrens wrote: > >> In order to be able to detect the case that a filesystem is mounted > >> with an old kernel, add a uuid-tree-gen field like the free space > >> cache is doing it. It is part of the super block and written with > >> each commit. Old kernels do not know this field and don't update it. > >> > > > > So to get around the whole crashing before we finish creating the uuid tree > > maybe set some flag or something that doesn't actually set the > > super->uuid_tree_generation until _after_ it finishes populating the tree, and > > then have the scan deal with having a half populated tree. Just an idea, but we > > have to deal with it some way. Thanks, > > That's what the patch 7/8 is doing. > Yeah I just noticed that, thanks. Josef -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 9393228..b4dfcde 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -482,9 +482,10 @@ struct btrfs_super_block { char label[BTRFS_LABEL_SIZE]; __le64 cache_generation; + __le64 uuid_tree_generation; /* future expansion */ - __le64 reserved[31]; + __le64 reserved[30]; u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE]; struct btrfs_root_backup super_roots[BTRFS_NUM_BACKUP_ROOTS]; } __attribute__ ((__packed__)); @@ -2848,6 +2849,8 @@ BTRFS_SETGET_STACK_FUNCS(super_csum_type, struct btrfs_super_block, csum_type, 16); BTRFS_SETGET_STACK_FUNCS(super_cache_generation, struct btrfs_super_block, cache_generation, 64); +BTRFS_SETGET_STACK_FUNCS(super_uuid_tree_generation, struct btrfs_super_block, + uuid_tree_generation, 64); static inline int btrfs_super_csum_size(struct btrfs_super_block *s) { diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index ce6cfd0..43e2102 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1373,6 +1373,7 @@ static void update_super_roots(struct btrfs_root *root) super->root_level = root_item->level; if (btrfs_test_opt(root, SPACE_CACHE)) super->cache_generation = root_item->generation; + super->uuid_tree_generation = root_item->generation; } int btrfs_transaction_in_commit(struct btrfs_fs_info *info)
In order to be able to detect the case that a filesystem is mounted with an old kernel, add a uuid-tree-gen field like the free space cache is doing it. It is part of the super block and written with each commit. Old kernels do not know this field and don't update it. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> --- fs/btrfs/ctree.h | 5 ++++- fs/btrfs/transaction.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)