diff options
Diffstat (limited to 'fs/xfs/xfs_dir_leaf.h')
-rw-r--r-- | fs/xfs/xfs_dir_leaf.h | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/fs/xfs/xfs_dir_leaf.h b/fs/xfs/xfs_dir_leaf.h index ab6b09eef9ab..eb8cd9a4667f 100644 --- a/fs/xfs/xfs_dir_leaf.h +++ b/fs/xfs/xfs_dir_leaf.h | |||
@@ -67,34 +67,38 @@ struct xfs_trans; | |||
67 | */ | 67 | */ |
68 | #define XFS_DIR_LEAF_MAPSIZE 3 /* how many freespace slots */ | 68 | #define XFS_DIR_LEAF_MAPSIZE 3 /* how many freespace slots */ |
69 | 69 | ||
70 | typedef struct xfs_dir_leaf_map { /* RLE map of free bytes */ | ||
71 | __uint16_t base; /* base of free region */ | ||
72 | __uint16_t size; /* run length of free region */ | ||
73 | } xfs_dir_leaf_map_t; | ||
74 | |||
75 | typedef struct xfs_dir_leaf_hdr { /* constant-structure header block */ | ||
76 | xfs_da_blkinfo_t info; /* block type, links, etc. */ | ||
77 | __uint16_t count; /* count of active leaf_entry's */ | ||
78 | __uint16_t namebytes; /* num bytes of name strings stored */ | ||
79 | __uint16_t firstused; /* first used byte in name area */ | ||
80 | __uint8_t holes; /* != 0 if blk needs compaction */ | ||
81 | __uint8_t pad1; | ||
82 | xfs_dir_leaf_map_t freemap[XFS_DIR_LEAF_MAPSIZE]; | ||
83 | } xfs_dir_leaf_hdr_t; | ||
84 | |||
85 | typedef struct xfs_dir_leaf_entry { /* sorted on key, not name */ | ||
86 | xfs_dahash_t hashval; /* hash value of name */ | ||
87 | __uint16_t nameidx; /* index into buffer of name */ | ||
88 | __uint8_t namelen; /* length of name string */ | ||
89 | __uint8_t pad2; | ||
90 | } xfs_dir_leaf_entry_t; | ||
91 | |||
92 | typedef struct xfs_dir_leaf_name { | ||
93 | xfs_dir_ino_t inumber; /* inode number for this key */ | ||
94 | __uint8_t name[1]; /* name string itself */ | ||
95 | } xfs_dir_leaf_name_t; | ||
96 | |||
70 | typedef struct xfs_dir_leafblock { | 97 | typedef struct xfs_dir_leafblock { |
71 | struct xfs_dir_leaf_hdr { /* constant-structure header block */ | 98 | xfs_dir_leaf_hdr_t hdr; /* constant-structure header block */ |
72 | xfs_da_blkinfo_t info; /* block type, links, etc. */ | 99 | xfs_dir_leaf_entry_t entries[1]; /* var sized array */ |
73 | __uint16_t count; /* count of active leaf_entry's */ | 100 | xfs_dir_leaf_name_t namelist[1]; /* grows from bottom of buf */ |
74 | __uint16_t namebytes; /* num bytes of name strings stored */ | ||
75 | __uint16_t firstused; /* first used byte in name area */ | ||
76 | __uint8_t holes; /* != 0 if blk needs compaction */ | ||
77 | __uint8_t pad1; | ||
78 | struct xfs_dir_leaf_map {/* RLE map of free bytes */ | ||
79 | __uint16_t base; /* base of free region */ | ||
80 | __uint16_t size; /* run length of free region */ | ||
81 | } freemap[XFS_DIR_LEAF_MAPSIZE]; /* N largest free regions */ | ||
82 | } hdr; | ||
83 | struct xfs_dir_leaf_entry { /* sorted on key, not name */ | ||
84 | xfs_dahash_t hashval; /* hash value of name */ | ||
85 | __uint16_t nameidx; /* index into buffer of name */ | ||
86 | __uint8_t namelen; /* length of name string */ | ||
87 | __uint8_t pad2; | ||
88 | } entries[1]; /* var sized array */ | ||
89 | struct xfs_dir_leaf_name { | ||
90 | xfs_dir_ino_t inumber; /* inode number for this key */ | ||
91 | __uint8_t name[1]; /* name string itself */ | ||
92 | } namelist[1]; /* grows from bottom of buf */ | ||
93 | } xfs_dir_leafblock_t; | 101 | } xfs_dir_leafblock_t; |
94 | typedef struct xfs_dir_leaf_hdr xfs_dir_leaf_hdr_t; | ||
95 | typedef struct xfs_dir_leaf_map xfs_dir_leaf_map_t; | ||
96 | typedef struct xfs_dir_leaf_entry xfs_dir_leaf_entry_t; | ||
97 | typedef struct xfs_dir_leaf_name xfs_dir_leaf_name_t; | ||
98 | 102 | ||
99 | /* | 103 | /* |
100 | * Length of name for which a 512-byte block filesystem | 104 | * Length of name for which a 512-byte block filesystem |
@@ -126,11 +130,10 @@ typedef union { | |||
126 | #define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \ | 130 | #define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \ |
127 | ((c).s.be = XFS_DA_MAKE_BNOENTRY(mp, bno, entry), (c).s.h = (hash)) | 131 | ((c).s.be = XFS_DA_MAKE_BNOENTRY(mp, bno, entry), (c).s.h = (hash)) |
128 | 132 | ||
129 | typedef struct xfs_dir_put_args | 133 | typedef struct xfs_dir_put_args { |
130 | { | ||
131 | xfs_dircook_t cook; /* cookie of (next) entry */ | 134 | xfs_dircook_t cook; /* cookie of (next) entry */ |
132 | xfs_intino_t ino; /* inode number */ | 135 | xfs_intino_t ino; /* inode number */ |
133 | struct xfs_dirent *dbp; /* buffer pointer */ | 136 | struct xfs_dirent *dbp; /* buffer pointer */ |
134 | char *name; /* directory entry name */ | 137 | char *name; /* directory entry name */ |
135 | int namelen; /* length of name */ | 138 | int namelen; /* length of name */ |
136 | int done; /* output: set if value was stored */ | 139 | int done; /* output: set if value was stored */ |
@@ -138,7 +141,8 @@ typedef struct xfs_dir_put_args | |||
138 | struct uio *uio; /* uio control structure */ | 141 | struct uio *uio; /* uio control structure */ |
139 | } xfs_dir_put_args_t; | 142 | } xfs_dir_put_args_t; |
140 | 143 | ||
141 | #define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) xfs_dir_leaf_entsize_byname(len) | 144 | #define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) \ |
145 | xfs_dir_leaf_entsize_byname(len) | ||
142 | static inline int xfs_dir_leaf_entsize_byname(int len) | 146 | static inline int xfs_dir_leaf_entsize_byname(int len) |
143 | { | 147 | { |
144 | return (uint)sizeof(xfs_dir_leaf_name_t)-1 + len; | 148 | return (uint)sizeof(xfs_dir_leaf_name_t)-1 + len; |