diff options
author | Mark Fasheh <mfasheh@suse.com> | 2008-12-10 20:36:25 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:40:34 -0500 |
commit | 87d35a74b15ec703910a63e0667692fb5e267be0 (patch) | |
tree | 39f18bcf38b855fa7ec806803567532f214129f0 /fs/ocfs2/ocfs2_fs.h | |
parent | 84008972491ca91b240f106191519781dabb8016 (diff) |
ocfs2: Add directory block trailers.
Future ocfs2 features metaecc and indexed directories need to store a
little bit of data in each dirblock. For compatibility, we place this
in a trailer at the end of the dirblock. The trailer plays itself as an
empty dirent, so that if the features are turned off, it can be reused
without requiring a tunefs scan.
This code adds the trailer and validates it when the block is read in.
[ Mark is the original author, but I reinserted this code before his
dir index work. -- Joel ]
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/ocfs2_fs.h')
-rw-r--r-- | fs/ocfs2/ocfs2_fs.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index 290fa26fba6e..af0013b9c17f 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -65,6 +65,7 @@ | |||
65 | #define OCFS2_EXTENT_BLOCK_SIGNATURE "EXBLK01" | 65 | #define OCFS2_EXTENT_BLOCK_SIGNATURE "EXBLK01" |
66 | #define OCFS2_GROUP_DESC_SIGNATURE "GROUP01" | 66 | #define OCFS2_GROUP_DESC_SIGNATURE "GROUP01" |
67 | #define OCFS2_XATTR_BLOCK_SIGNATURE "XATTR01" | 67 | #define OCFS2_XATTR_BLOCK_SIGNATURE "XATTR01" |
68 | #define OCFS2_DIR_TRAILER_SIGNATURE "DIRTRL1" | ||
68 | 69 | ||
69 | /* Compatibility flags */ | 70 | /* Compatibility flags */ |
70 | #define OCFS2_HAS_COMPAT_FEATURE(sb,mask) \ | 71 | #define OCFS2_HAS_COMPAT_FEATURE(sb,mask) \ |
@@ -752,6 +753,34 @@ struct ocfs2_dir_entry { | |||
752 | } __attribute__ ((packed)); | 753 | } __attribute__ ((packed)); |
753 | 754 | ||
754 | /* | 755 | /* |
756 | * Per-block record for the unindexed directory btree. This is carefully | ||
757 | * crafted so that the rec_len and name_len records of an ocfs2_dir_entry are | ||
758 | * mirrored. That way, the directory manipulation code needs a minimal amount | ||
759 | * of update. | ||
760 | * | ||
761 | * NOTE: Keep this structure aligned to a multiple of 4 bytes. | ||
762 | */ | ||
763 | struct ocfs2_dir_block_trailer { | ||
764 | /*00*/ __le64 db_compat_inode; /* Always zero. Was inode */ | ||
765 | |||
766 | __le16 db_compat_rec_len; /* Backwards compatible with | ||
767 | * ocfs2_dir_entry. */ | ||
768 | __u8 db_compat_name_len; /* Always zero. Was name_len */ | ||
769 | __u8 db_reserved0; | ||
770 | __le16 db_reserved1; | ||
771 | __le16 db_free_rec_len; /* Size of largest empty hole | ||
772 | * in this block. (unused) */ | ||
773 | /*10*/ __u8 db_signature[8]; /* Signature for verification */ | ||
774 | __le64 db_reserved2; | ||
775 | __le64 db_free_next; /* Next block in list (unused) */ | ||
776 | /*20*/ __le64 db_blkno; /* Offset on disk, in blocks */ | ||
777 | __le64 db_parent_dinode; /* dinode which owns me, in | ||
778 | blocks */ | ||
779 | /*30*/ __le64 db_check; /* Error checking */ | ||
780 | /*40*/ | ||
781 | }; | ||
782 | |||
783 | /* | ||
755 | * On disk allocator group structure for OCFS2 | 784 | * On disk allocator group structure for OCFS2 |
756 | */ | 785 | */ |
757 | struct ocfs2_group_desc | 786 | struct ocfs2_group_desc |