diff options
author | Tao Ma <tao.ma@oracle.com> | 2008-08-18 05:38:50 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-10-13 19:57:03 -0400 |
commit | 0c044f0b24b9128ba8c297149d88bd81f2e36af3 (patch) | |
tree | 2a0d6a34fca5e5a8bdfde0d1068cb56d4252e864 /fs/ocfs2/ocfs2_fs.h | |
parent | ba492615f0d32d0210b02c14b24512b4372b13d6 (diff) |
ocfs2: Add xattr bucket iteration for large numbers of EAs
Ocfs2 breaks up xattr index tree leaves into 4k regions, called buckets.
Attributes are stored within a given bucket, depending on hash value.
After a discussion with Mark, we decided that the per-bucket index
(xe_entry[]) would only exist in the 1st block of a bucket. Likewise,
name/value pairs will not straddle more than one block. This allows the
majority of operations to work directly on the buffer heads in a leaf block.
This patch adds code to iterate the buckets in an EA. A new abstration of
ocfs2_xattr_bucket is added. It records the bhs in this bucket and
ocfs2_xattr_header. This keeps the code neat, improving readibility.
Signed-off-by: Tao Ma <tao.ma@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 | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index 98e1f8bba0e1..8d5e72f2c5cf 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -755,8 +755,13 @@ struct ocfs2_xattr_header { | |||
755 | __le16 xh_count; /* contains the count of how | 755 | __le16 xh_count; /* contains the count of how |
756 | many records are in the | 756 | many records are in the |
757 | local xattr storage. */ | 757 | local xattr storage. */ |
758 | __le16 xh_reserved1; | 758 | __le16 xh_free_start; /* current offset for storing |
759 | __le32 xh_reserved2; | 759 | xattr. */ |
760 | __le16 xh_name_value_len; /* total length of name/value | ||
761 | length in this bucket. */ | ||
762 | __le16 xh_num_buckets; /* bucket nums in one extent | ||
763 | record, only valid in the | ||
764 | first bucket. */ | ||
760 | __le64 xh_csum; | 765 | __le64 xh_csum; |
761 | struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */ | 766 | struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */ |
762 | }; | 767 | }; |
@@ -793,6 +798,10 @@ struct ocfs2_xattr_tree_root { | |||
793 | #define OCFS2_XATTR_SIZE(size) (((size) + OCFS2_XATTR_ROUND) & \ | 798 | #define OCFS2_XATTR_SIZE(size) (((size) + OCFS2_XATTR_ROUND) & \ |
794 | ~(OCFS2_XATTR_ROUND)) | 799 | ~(OCFS2_XATTR_ROUND)) |
795 | 800 | ||
801 | #define OCFS2_XATTR_BUCKET_SIZE 4096 | ||
802 | #define OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET (OCFS2_XATTR_BUCKET_SIZE \ | ||
803 | / OCFS2_MIN_BLOCKSIZE) | ||
804 | |||
796 | /* | 805 | /* |
797 | * On disk structure for xattr block. | 806 | * On disk structure for xattr block. |
798 | */ | 807 | */ |
@@ -963,6 +972,17 @@ static inline u64 ocfs2_backup_super_blkno(struct super_block *sb, int index) | |||
963 | return 0; | 972 | return 0; |
964 | 973 | ||
965 | } | 974 | } |
975 | |||
976 | static inline u16 ocfs2_xattr_recs_per_xb(struct super_block *sb) | ||
977 | { | ||
978 | int size; | ||
979 | |||
980 | size = sb->s_blocksize - | ||
981 | offsetof(struct ocfs2_xattr_block, | ||
982 | xb_attrs.xb_root.xt_list.l_recs); | ||
983 | |||
984 | return size / sizeof(struct ocfs2_extent_rec); | ||
985 | } | ||
966 | #else | 986 | #else |
967 | static inline int ocfs2_fast_symlink_chars(int blocksize) | 987 | static inline int ocfs2_fast_symlink_chars(int blocksize) |
968 | { | 988 | { |
@@ -1046,6 +1066,17 @@ static inline uint64_t ocfs2_backup_super_blkno(int blocksize, int index) | |||
1046 | 1066 | ||
1047 | return 0; | 1067 | return 0; |
1048 | } | 1068 | } |
1069 | |||
1070 | static inline int ocfs2_xattr_recs_per_xb(int blocksize) | ||
1071 | { | ||
1072 | int size; | ||
1073 | |||
1074 | size = blocksize - | ||
1075 | offsetof(struct ocfs2_xattr_block, | ||
1076 | xb_attrs.xb_root.xt_list.l_recs); | ||
1077 | |||
1078 | return size / sizeof(struct ocfs2_extent_rec); | ||
1079 | } | ||
1049 | #endif /* __KERNEL__ */ | 1080 | #endif /* __KERNEL__ */ |
1050 | 1081 | ||
1051 | 1082 | ||