Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc. |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 3 | * Copyright (c) 2013 Red Hat, Inc. |
Nathan Scott | aa82daa | 2005-11-02 10:33:33 +1100 | [diff] [blame] | 4 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * published by the Free Software Foundation. |
| 9 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 10 | * This program is distributed in the hope that it would be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write the Free Software Foundation, |
| 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | */ |
| 19 | #ifndef __XFS_ATTR_LEAF_H__ |
| 20 | #define __XFS_ATTR_LEAF_H__ |
| 21 | |
| 22 | /* |
| 23 | * Attribute storage layout, internal structure, access macros, etc. |
| 24 | * |
| 25 | * Attribute lists are structured around Btrees where all the data |
| 26 | * elements are in the leaf nodes. Attribute names are hashed into an int, |
| 27 | * then that int is used as the index into the Btree. Since the hashval |
| 28 | * of an attribute name may not be unique, we may have duplicate keys. The |
| 29 | * internal links in the Btree are logical block offsets into the file. |
| 30 | */ |
| 31 | |
| 32 | struct attrlist; |
| 33 | struct attrlist_cursor_kern; |
Christoph Hellwig | ad9b463 | 2008-06-23 13:23:48 +1000 | [diff] [blame] | 34 | struct xfs_attr_list_context; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | struct xfs_da_args; |
| 36 | struct xfs_da_state; |
| 37 | struct xfs_da_state_blk; |
| 38 | struct xfs_inode; |
| 39 | struct xfs_trans; |
| 40 | |
| 41 | /*======================================================================== |
| 42 | * Attribute structure when equal to XFS_LBSIZE(mp) bytes. |
| 43 | *========================================================================*/ |
| 44 | |
| 45 | /* |
| 46 | * This is the structure of the leaf nodes in the Btree. |
| 47 | * |
| 48 | * Struct leaf_entry's are packed from the top. Name/values grow from the |
| 49 | * bottom but are not packed. The freemap contains run-length-encoded entries |
| 50 | * for the free bytes after the leaf_entry's, but only the N largest such, |
| 51 | * smaller runs are dropped. When the freemap doesn't show enough space |
| 52 | * for an allocation, we compact the name/value area and try again. If we |
| 53 | * still don't have enough space, then we have to split the block. The |
| 54 | * name/value structs (both local and remote versions) must be 32bit aligned. |
| 55 | * |
| 56 | * Since we have duplicate hash keys, for each key that matches, compare |
| 57 | * the actual name string. The root and intermediate node search always |
| 58 | * takes the first-in-the-block key match found, so we should only have |
| 59 | * to work "forw"ard. If none matches, continue with the "forw"ard leaf |
| 60 | * nodes until the hash key changes or the attribute name is found. |
| 61 | * |
| 62 | * We store the fact that an attribute is a ROOT/USER/SECURE attribute in |
| 63 | * the leaf_entry. The namespaces are independent only because we also look |
| 64 | * at the namespace bit when we are looking for a matching attribute name. |
| 65 | * |
Nathan Scott | 3762ec6 | 2006-01-12 10:29:53 +1100 | [diff] [blame] | 66 | * We also store an "incomplete" bit in the leaf_entry. It shows that an |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | * attribute is in the middle of being created and should not be shown to |
| 68 | * the user if we crash during the time that the bit is set. We clear the |
| 69 | * bit when we have finished setting up the attribute. We do this because |
| 70 | * we cannot create some large attributes inside a single transaction, and we |
| 71 | * need some indication that we weren't finished if we crash in the middle. |
| 72 | */ |
| 73 | #define XFS_ATTR_LEAF_MAPSIZE 3 /* how many freespace slots */ |
| 74 | |
Nathan Scott | 3762ec6 | 2006-01-12 10:29:53 +1100 | [diff] [blame] | 75 | typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */ |
Nathan Scott | 918ae42 | 2006-03-17 17:28:54 +1100 | [diff] [blame] | 76 | __be16 base; /* base of free region */ |
| 77 | __be16 size; /* length of free region */ |
Nathan Scott | 3762ec6 | 2006-01-12 10:29:53 +1100 | [diff] [blame] | 78 | } xfs_attr_leaf_map_t; |
| 79 | |
| 80 | typedef struct xfs_attr_leaf_hdr { /* constant-structure header block */ |
| 81 | xfs_da_blkinfo_t info; /* block type, links, etc. */ |
Nathan Scott | 918ae42 | 2006-03-17 17:28:54 +1100 | [diff] [blame] | 82 | __be16 count; /* count of active leaf_entry's */ |
| 83 | __be16 usedbytes; /* num bytes of names/values stored */ |
| 84 | __be16 firstused; /* first used byte in name area */ |
| 85 | __u8 holes; /* != 0 if blk needs compaction */ |
| 86 | __u8 pad1; |
Nathan Scott | 3762ec6 | 2006-01-12 10:29:53 +1100 | [diff] [blame] | 87 | xfs_attr_leaf_map_t freemap[XFS_ATTR_LEAF_MAPSIZE]; |
| 88 | /* N largest free regions */ |
| 89 | } xfs_attr_leaf_hdr_t; |
| 90 | |
| 91 | typedef struct xfs_attr_leaf_entry { /* sorted on key, not name */ |
Nathan Scott | 6b19f2d | 2006-03-17 17:29:02 +1100 | [diff] [blame] | 92 | __be32 hashval; /* hash value of name */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 93 | __be16 nameidx; /* index into buffer of name/value */ |
Nathan Scott | 6b19f2d | 2006-03-17 17:29:02 +1100 | [diff] [blame] | 94 | __u8 flags; /* LOCAL/ROOT/SECURE/INCOMPLETE flag */ |
| 95 | __u8 pad2; /* unused pad byte */ |
Nathan Scott | 3762ec6 | 2006-01-12 10:29:53 +1100 | [diff] [blame] | 96 | } xfs_attr_leaf_entry_t; |
| 97 | |
| 98 | typedef struct xfs_attr_leaf_name_local { |
Nathan Scott | 053b575 | 2006-03-17 17:29:09 +1100 | [diff] [blame] | 99 | __be16 valuelen; /* number of bytes in value */ |
| 100 | __u8 namelen; /* length of name bytes */ |
| 101 | __u8 nameval[1]; /* name/value bytes */ |
Nathan Scott | 3762ec6 | 2006-01-12 10:29:53 +1100 | [diff] [blame] | 102 | } xfs_attr_leaf_name_local_t; |
| 103 | |
| 104 | typedef struct xfs_attr_leaf_name_remote { |
Nathan Scott | c0f054e | 2006-03-17 17:29:18 +1100 | [diff] [blame] | 105 | __be32 valueblk; /* block number of value bytes */ |
| 106 | __be32 valuelen; /* number of bytes in value */ |
| 107 | __u8 namelen; /* length of name bytes */ |
| 108 | __u8 name[1]; /* name bytes */ |
Nathan Scott | 3762ec6 | 2006-01-12 10:29:53 +1100 | [diff] [blame] | 109 | } xfs_attr_leaf_name_remote_t; |
| 110 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | typedef struct xfs_attr_leafblock { |
Nathan Scott | 3762ec6 | 2006-01-12 10:29:53 +1100 | [diff] [blame] | 112 | xfs_attr_leaf_hdr_t hdr; /* constant-structure header block */ |
| 113 | xfs_attr_leaf_entry_t entries[1]; /* sorted on key, not name */ |
| 114 | xfs_attr_leaf_name_local_t namelist; /* grows from bottom of buf */ |
| 115 | xfs_attr_leaf_name_remote_t valuelist; /* grows from bottom of buf */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | } xfs_attr_leafblock_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | |
| 118 | /* |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 119 | * CRC enabled leaf structures. Called "version 3" structures to match the |
| 120 | * version number of the directory and dablk structures for this feature, and |
| 121 | * attr2 is already taken by the variable inode attribute fork size feature. |
| 122 | */ |
| 123 | struct xfs_attr3_leaf_hdr { |
| 124 | struct xfs_da3_blkinfo info; |
| 125 | __be16 count; |
| 126 | __be16 usedbytes; |
| 127 | __be16 firstused; |
| 128 | __u8 holes; |
| 129 | __u8 pad1; |
| 130 | struct xfs_attr_leaf_map freemap[XFS_ATTR_LEAF_MAPSIZE]; |
Dave Chinner | 5170711 | 2013-06-12 12:19:07 +1000 | [diff] [blame] | 131 | __be32 pad2; /* 64 bit alignment */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | #define XFS_ATTR3_LEAF_CRC_OFF (offsetof(struct xfs_attr3_leaf_hdr, info.crc)) |
| 135 | |
| 136 | struct xfs_attr3_leafblock { |
| 137 | struct xfs_attr3_leaf_hdr hdr; |
| 138 | struct xfs_attr_leaf_entry entries[1]; |
| 139 | |
| 140 | /* |
| 141 | * The rest of the block contains the following structures after the |
| 142 | * leaf entries, growing from the bottom up. The variables are never |
| 143 | * referenced, the locations accessed purely from helper functions. |
| 144 | * |
| 145 | * struct xfs_attr_leaf_name_local |
| 146 | * struct xfs_attr_leaf_name_remote |
| 147 | */ |
| 148 | }; |
| 149 | |
| 150 | /* |
| 151 | * incore, neutral version of the attribute leaf header |
| 152 | */ |
| 153 | struct xfs_attr3_icleaf_hdr { |
| 154 | __uint32_t forw; |
| 155 | __uint32_t back; |
| 156 | __uint16_t magic; |
| 157 | __uint16_t count; |
| 158 | __uint16_t usedbytes; |
| 159 | __uint16_t firstused; |
| 160 | __u8 holes; |
| 161 | struct { |
| 162 | __uint16_t base; |
| 163 | __uint16_t size; |
| 164 | } freemap[XFS_ATTR_LEAF_MAPSIZE]; |
| 165 | }; |
| 166 | |
| 167 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | * Flags used in the leaf_entry[i].flags field. |
| 169 | * NOTE: the INCOMPLETE bit must not collide with the flags bits specified |
| 170 | * on the system call, they are "or"ed together for various operations. |
| 171 | */ |
| 172 | #define XFS_ATTR_LOCAL_BIT 0 /* attr is stored locally */ |
| 173 | #define XFS_ATTR_ROOT_BIT 1 /* limit access to trusted attrs */ |
| 174 | #define XFS_ATTR_SECURE_BIT 2 /* limit access to secure attrs */ |
| 175 | #define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */ |
| 176 | #define XFS_ATTR_LOCAL (1 << XFS_ATTR_LOCAL_BIT) |
| 177 | #define XFS_ATTR_ROOT (1 << XFS_ATTR_ROOT_BIT) |
| 178 | #define XFS_ATTR_SECURE (1 << XFS_ATTR_SECURE_BIT) |
| 179 | #define XFS_ATTR_INCOMPLETE (1 << XFS_ATTR_INCOMPLETE_BIT) |
| 180 | |
| 181 | /* |
Tim Shimmin | 726801b | 2006-09-28 11:01:37 +1000 | [diff] [blame] | 182 | * Conversion macros for converting namespace bits from argument flags |
| 183 | * to ondisk flags. |
| 184 | */ |
| 185 | #define XFS_ATTR_NSP_ARGS_MASK (ATTR_ROOT | ATTR_SECURE) |
| 186 | #define XFS_ATTR_NSP_ONDISK_MASK (XFS_ATTR_ROOT | XFS_ATTR_SECURE) |
| 187 | #define XFS_ATTR_NSP_ONDISK(flags) ((flags) & XFS_ATTR_NSP_ONDISK_MASK) |
| 188 | #define XFS_ATTR_NSP_ARGS(flags) ((flags) & XFS_ATTR_NSP_ARGS_MASK) |
| 189 | #define XFS_ATTR_NSP_ARGS_TO_ONDISK(x) (((x) & ATTR_ROOT ? XFS_ATTR_ROOT : 0) |\ |
| 190 | ((x) & ATTR_SECURE ? XFS_ATTR_SECURE : 0)) |
| 191 | #define XFS_ATTR_NSP_ONDISK_TO_ARGS(x) (((x) & XFS_ATTR_ROOT ? ATTR_ROOT : 0) |\ |
| 192 | ((x) & XFS_ATTR_SECURE ? ATTR_SECURE : 0)) |
| 193 | |
| 194 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | * Alignment for namelist and valuelist entries (since they are mixed |
| 196 | * there can be only one alignment value) |
| 197 | */ |
| 198 | #define XFS_ATTR_LEAF_NAME_ALIGN ((uint)sizeof(xfs_dablk_t)) |
| 199 | |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 200 | static inline int |
| 201 | xfs_attr3_leaf_hdr_size(struct xfs_attr_leafblock *leafp) |
| 202 | { |
| 203 | if (leafp->hdr.info.magic == cpu_to_be16(XFS_ATTR3_LEAF_MAGIC)) |
| 204 | return sizeof(struct xfs_attr3_leaf_hdr); |
| 205 | return sizeof(struct xfs_attr_leaf_hdr); |
| 206 | } |
| 207 | |
| 208 | static inline struct xfs_attr_leaf_entry * |
| 209 | xfs_attr3_leaf_entryp(xfs_attr_leafblock_t *leafp) |
| 210 | { |
| 211 | if (leafp->hdr.info.magic == cpu_to_be16(XFS_ATTR3_LEAF_MAGIC)) |
| 212 | return &((struct xfs_attr3_leafblock *)leafp)->entries[0]; |
| 213 | return &leafp->entries[0]; |
| 214 | } |
| 215 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | /* |
| 217 | * Cast typed pointers for "local" and "remote" name/value structs. |
| 218 | */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 219 | static inline char * |
| 220 | xfs_attr3_leaf_name(xfs_attr_leafblock_t *leafp, int idx) |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 221 | { |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 222 | struct xfs_attr_leaf_entry *entries = xfs_attr3_leaf_entryp(leafp); |
| 223 | |
| 224 | return &((char *)leafp)[be16_to_cpu(entries[idx].nameidx)]; |
| 225 | } |
| 226 | |
| 227 | static inline xfs_attr_leaf_name_remote_t * |
| 228 | xfs_attr3_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) |
| 229 | { |
| 230 | return (xfs_attr_leaf_name_remote_t *)xfs_attr3_leaf_name(leafp, idx); |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 231 | } |
| 232 | |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 233 | static inline xfs_attr_leaf_name_local_t * |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 234 | xfs_attr3_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 235 | { |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 236 | return (xfs_attr_leaf_name_local_t *)xfs_attr3_leaf_name(leafp, idx); |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 237 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | |
| 239 | /* |
| 240 | * Calculate total bytes used (including trailing pad for alignment) for |
| 241 | * a "local" name/value structure, a "remote" name/value structure, and |
| 242 | * a pointer which might be either. |
| 243 | */ |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 244 | static inline int xfs_attr_leaf_entsize_remote(int nlen) |
| 245 | { |
| 246 | return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ |
| 247 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); |
| 248 | } |
| 249 | |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 250 | static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen) |
| 251 | { |
| 252 | return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + |
| 253 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); |
| 254 | } |
| 255 | |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 256 | static inline int xfs_attr_leaf_entsize_local_max(int bsize) |
| 257 | { |
| 258 | return (((bsize) >> 1) + ((bsize) >> 2)); |
| 259 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | /* |
| 262 | * Used to keep a list of "remote value" extents when unlinking an inode. |
| 263 | */ |
| 264 | typedef struct xfs_attr_inactive_list { |
| 265 | xfs_dablk_t valueblk; /* block number of value bytes */ |
| 266 | int valuelen; /* number of bytes in value */ |
| 267 | } xfs_attr_inactive_list_t; |
| 268 | |
| 269 | |
| 270 | /*======================================================================== |
| 271 | * Function prototypes for the kernel. |
| 272 | *========================================================================*/ |
| 273 | |
| 274 | /* |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 275 | * Internal routines when attribute fork size < XFS_LITINO(mp). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | */ |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 277 | void xfs_attr_shortform_create(struct xfs_da_args *args); |
| 278 | void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | int xfs_attr_shortform_lookup(struct xfs_da_args *args); |
| 280 | int xfs_attr_shortform_getvalue(struct xfs_da_args *args); |
| 281 | int xfs_attr_shortform_to_leaf(struct xfs_da_args *args); |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 282 | int xfs_attr_shortform_remove(struct xfs_da_args *args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | int xfs_attr_shortform_list(struct xfs_attr_list_context *context); |
Dave Chinner | 1d9025e | 2012-06-22 18:50:14 +1000 | [diff] [blame] | 284 | int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp); |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 285 | int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); |
| 286 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | |
| 288 | /* |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 289 | * Internal routines when attribute fork size == XFS_LBSIZE(mp). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 291 | int xfs_attr3_leaf_to_node(struct xfs_da_args *args); |
| 292 | int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp, |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 293 | struct xfs_da_args *args, int forkoff); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 294 | int xfs_attr3_leaf_clearflag(struct xfs_da_args *args); |
| 295 | int xfs_attr3_leaf_setflag(struct xfs_da_args *args); |
| 296 | int xfs_attr3_leaf_flipflags(struct xfs_da_args *args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | |
| 298 | /* |
| 299 | * Routines used for growing the Btree. |
| 300 | */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 301 | int xfs_attr3_leaf_split(struct xfs_da_state *state, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | struct xfs_da_state_blk *oldblk, |
| 303 | struct xfs_da_state_blk *newblk); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 304 | int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | struct xfs_da_args *args); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 306 | int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args); |
| 307 | int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | struct xfs_da_args *args); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 309 | int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | struct xfs_da_args *args); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 311 | int xfs_attr3_leaf_list_int(struct xfs_buf *bp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | struct xfs_attr_list_context *context); |
| 313 | |
| 314 | /* |
| 315 | * Routines used for shrinking the Btree. |
| 316 | */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 317 | int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval); |
| 318 | void xfs_attr3_leaf_unbalance(struct xfs_da_state *state, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | struct xfs_da_state_blk *drop_blk, |
| 320 | struct xfs_da_state_blk *save_blk); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 321 | int xfs_attr3_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | |
| 323 | /* |
| 324 | * Utility routines. |
| 325 | */ |
Dave Chinner | 1d9025e | 2012-06-22 18:50:14 +1000 | [diff] [blame] | 326 | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count); |
| 327 | int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp, |
| 328 | struct xfs_buf *leaf2_bp); |
Nathan Scott | aa82daa | 2005-11-02 10:33:33 +1100 | [diff] [blame] | 329 | int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | int *local); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 331 | int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, |
Dave Chinner | d9392a4 | 2012-11-12 22:54:17 +1100 | [diff] [blame] | 332 | xfs_dablk_t bno, xfs_daddr_t mappedbno, |
| 333 | struct xfs_buf **bpp); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 334 | void xfs_attr3_leaf_hdr_from_disk(struct xfs_attr3_icleaf_hdr *to, |
| 335 | struct xfs_attr_leafblock *from); |
Dave Chinner | 1813dd6 | 2012-11-14 17:54:40 +1100 | [diff] [blame] | 336 | |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 337 | extern const struct xfs_buf_ops xfs_attr3_leaf_buf_ops; |
Dave Chinner | d9392a4 | 2012-11-12 22:54:17 +1100 | [diff] [blame] | 338 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | #endif /* __XFS_ATTR_LEAF_H__ */ |