2005-04-16 16:20:36 -06:00
|
|
|
/*
|
2005-11-01 20:58:39 -07:00
|
|
|
* Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
|
2013-04-24 02:58:55 -06:00
|
|
|
* Copyright (c) 2013 Red Hat, Inc.
|
2005-11-01 16:33:33 -07:00
|
|
|
* All Rights Reserved.
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
2005-11-01 20:58:39 -07:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
2005-04-16 16:20:36 -06:00
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
2005-11-01 20:58:39 -07:00
|
|
|
* This program is distributed in the hope that it would be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
2005-11-01 20:58:39 -07:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2005-04-16 16:20:36 -06:00
|
|
|
*/
|
|
|
|
#ifndef __XFS_ATTR_LEAF_H__
|
|
|
|
#define __XFS_ATTR_LEAF_H__
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attribute storage layout, internal structure, access macros, etc.
|
|
|
|
*
|
|
|
|
* Attribute lists are structured around Btrees where all the data
|
|
|
|
* elements are in the leaf nodes. Attribute names are hashed into an int,
|
|
|
|
* then that int is used as the index into the Btree. Since the hashval
|
|
|
|
* of an attribute name may not be unique, we may have duplicate keys. The
|
|
|
|
* internal links in the Btree are logical block offsets into the file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct attrlist;
|
|
|
|
struct attrlist_cursor_kern;
|
2008-06-22 21:23:48 -06:00
|
|
|
struct xfs_attr_list_context;
|
2005-04-16 16:20:36 -06:00
|
|
|
struct xfs_da_args;
|
|
|
|
struct xfs_da_state;
|
|
|
|
struct xfs_da_state_blk;
|
|
|
|
struct xfs_inode;
|
|
|
|
struct xfs_trans;
|
|
|
|
|
|
|
|
/*========================================================================
|
|
|
|
* Attribute structure when equal to XFS_LBSIZE(mp) bytes.
|
|
|
|
*========================================================================*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the structure of the leaf nodes in the Btree.
|
|
|
|
*
|
|
|
|
* Struct leaf_entry's are packed from the top. Name/values grow from the
|
|
|
|
* bottom but are not packed. The freemap contains run-length-encoded entries
|
|
|
|
* for the free bytes after the leaf_entry's, but only the N largest such,
|
|
|
|
* smaller runs are dropped. When the freemap doesn't show enough space
|
|
|
|
* for an allocation, we compact the name/value area and try again. If we
|
|
|
|
* still don't have enough space, then we have to split the block. The
|
|
|
|
* name/value structs (both local and remote versions) must be 32bit aligned.
|
|
|
|
*
|
|
|
|
* Since we have duplicate hash keys, for each key that matches, compare
|
|
|
|
* the actual name string. The root and intermediate node search always
|
|
|
|
* takes the first-in-the-block key match found, so we should only have
|
|
|
|
* to work "forw"ard. If none matches, continue with the "forw"ard leaf
|
|
|
|
* nodes until the hash key changes or the attribute name is found.
|
|
|
|
*
|
|
|
|
* We store the fact that an attribute is a ROOT/USER/SECURE attribute in
|
|
|
|
* the leaf_entry. The namespaces are independent only because we also look
|
|
|
|
* at the namespace bit when we are looking for a matching attribute name.
|
|
|
|
*
|
2006-01-11 16:29:53 -07:00
|
|
|
* We also store an "incomplete" bit in the leaf_entry. It shows that an
|
2005-04-16 16:20:36 -06:00
|
|
|
* attribute is in the middle of being created and should not be shown to
|
|
|
|
* the user if we crash during the time that the bit is set. We clear the
|
|
|
|
* bit when we have finished setting up the attribute. We do this because
|
|
|
|
* we cannot create some large attributes inside a single transaction, and we
|
|
|
|
* need some indication that we weren't finished if we crash in the middle.
|
|
|
|
*/
|
|
|
|
#define XFS_ATTR_LEAF_MAPSIZE 3 /* how many freespace slots */
|
|
|
|
|
2006-01-11 16:29:53 -07:00
|
|
|
typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */
|
2006-03-16 23:28:54 -07:00
|
|
|
__be16 base; /* base of free region */
|
|
|
|
__be16 size; /* length of free region */
|
2006-01-11 16:29:53 -07:00
|
|
|
} xfs_attr_leaf_map_t;
|
|
|
|
|
|
|
|
typedef struct xfs_attr_leaf_hdr { /* constant-structure header block */
|
|
|
|
xfs_da_blkinfo_t info; /* block type, links, etc. */
|
2006-03-16 23:28:54 -07:00
|
|
|
__be16 count; /* count of active leaf_entry's */
|
|
|
|
__be16 usedbytes; /* num bytes of names/values stored */
|
|
|
|
__be16 firstused; /* first used byte in name area */
|
|
|
|
__u8 holes; /* != 0 if blk needs compaction */
|
|
|
|
__u8 pad1;
|
2006-01-11 16:29:53 -07:00
|
|
|
xfs_attr_leaf_map_t freemap[XFS_ATTR_LEAF_MAPSIZE];
|
|
|
|
/* N largest free regions */
|
|
|
|
} xfs_attr_leaf_hdr_t;
|
|
|
|
|
|
|
|
typedef struct xfs_attr_leaf_entry { /* sorted on key, not name */
|
2006-03-16 23:29:02 -07:00
|
|
|
__be32 hashval; /* hash value of name */
|
2013-04-24 02:58:55 -06:00
|
|
|
__be16 nameidx; /* index into buffer of name/value */
|
2006-03-16 23:29:02 -07:00
|
|
|
__u8 flags; /* LOCAL/ROOT/SECURE/INCOMPLETE flag */
|
|
|
|
__u8 pad2; /* unused pad byte */
|
2006-01-11 16:29:53 -07:00
|
|
|
} xfs_attr_leaf_entry_t;
|
|
|
|
|
|
|
|
typedef struct xfs_attr_leaf_name_local {
|
2006-03-16 23:29:09 -07:00
|
|
|
__be16 valuelen; /* number of bytes in value */
|
|
|
|
__u8 namelen; /* length of name bytes */
|
|
|
|
__u8 nameval[1]; /* name/value bytes */
|
2006-01-11 16:29:53 -07:00
|
|
|
} xfs_attr_leaf_name_local_t;
|
|
|
|
|
|
|
|
typedef struct xfs_attr_leaf_name_remote {
|
2006-03-16 23:29:18 -07:00
|
|
|
__be32 valueblk; /* block number of value bytes */
|
|
|
|
__be32 valuelen; /* number of bytes in value */
|
|
|
|
__u8 namelen; /* length of name bytes */
|
|
|
|
__u8 name[1]; /* name bytes */
|
2006-01-11 16:29:53 -07:00
|
|
|
} xfs_attr_leaf_name_remote_t;
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
typedef struct xfs_attr_leafblock {
|
2006-01-11 16:29:53 -07:00
|
|
|
xfs_attr_leaf_hdr_t hdr; /* constant-structure header block */
|
|
|
|
xfs_attr_leaf_entry_t entries[1]; /* sorted on key, not name */
|
|
|
|
xfs_attr_leaf_name_local_t namelist; /* grows from bottom of buf */
|
|
|
|
xfs_attr_leaf_name_remote_t valuelist; /* grows from bottom of buf */
|
2005-04-16 16:20:36 -06:00
|
|
|
} xfs_attr_leafblock_t;
|
|
|
|
|
2013-04-24 02:58:55 -06:00
|
|
|
/*
|
|
|
|
* CRC enabled leaf structures. Called "version 3" structures to match the
|
|
|
|
* version number of the directory and dablk structures for this feature, and
|
|
|
|
* attr2 is already taken by the variable inode attribute fork size feature.
|
|
|
|
*/
|
|
|
|
struct xfs_attr3_leaf_hdr {
|
|
|
|
struct xfs_da3_blkinfo info;
|
|
|
|
__be16 count;
|
|
|
|
__be16 usedbytes;
|
|
|
|
__be16 firstused;
|
|
|
|
__u8 holes;
|
|
|
|
__u8 pad1;
|
|
|
|
struct xfs_attr_leaf_map freemap[XFS_ATTR_LEAF_MAPSIZE];
|
xfs: fix implicit padding in directory and attr CRC formats
Michael L. Semon has been testing CRC patches on a 32 bit system and
been seeing assert failures in the directory code from xfs/080.
Thanks to Michael's heroic efforts with printk debugging, we found
that the problem was that the last free space being left in the
directory structure was too small to fit a unused tag structure and
it was being corrupted and attempting to log a region out of bounds.
Hence the assert failure looked something like:
.....
#5 calling xfs_dir2_data_log_unused() 36 32
#1 4092 4095 4096
#2 8182 8183 4096
XFS: Assertion failed: first <= last && last < BBTOB(bp->b_length), file: fs/xfs/xfs_trans_buf.c, line: 568
Where #1 showed the first region of the dup being logged (i.e. the
last 4 bytes of a directory buffer) and #2 shows the corrupt values
being calculated from the length of the dup entry which overflowed
the size of the buffer.
It turns out that the problem was not in the logging code, nor in
the freespace handling code. It is an initial condition bug that
only shows up on 32 bit systems. When a new buffer is initialised,
where's the freespace that is set up:
[ 172.316249] calling xfs_dir2_leaf_addname() from xfs_dir_createname()
[ 172.316346] #9 calling xfs_dir2_data_log_unused()
[ 172.316351] #1 calling xfs_trans_log_buf() 60 63 4096
[ 172.316353] #2 calling xfs_trans_log_buf() 4094 4095 4096
Note the offset of the first region being logged? It's 60 bytes into
the buffer. Once I saw that, I pretty much knew that the bug was
going to be caused by this.
Essentially, all direct entries are rounded to 8 bytes in length,
and all entries start with an 8 byte alignment. This means that we
can decode inplace as variables are naturally aligned. With the
directory data supposedly starting on a 8 byte boundary, and all
entries padded to 8 bytes, the minimum freespace in a directory
block is supposed to be 8 bytes, which is large enough to fit a
unused data entry structure (6 bytes in size). The fact we only have
4 bytes of free space indicates a directory data block alignment
problem.
And what do you know - there's an implicit hole in the directory
data block header for the CRC format, which means the header is 60
byte on 32 bit intel systems and 64 bytes on 64 bit systems. Needs
padding. And while looking at the structures, I found the same
problem in the attr leaf header. Fix them both.
Note that this only affects 32 bit systems with CRCs enabled.
Everything else is just fine. Note that CRC enabled filesystems created
before this fix on such systems will not be readable with this fix
applied.
Reported-by: Michael L. Semon <mlsemon35@gmail.com>
Debugged-by: Michael L. Semon <mlsemon35@gmail.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
(cherry picked from commit 8a1fd2950e1fe267e11fc8c85dcaa6b023b51b60)
2013-06-11 20:19:07 -06:00
|
|
|
__be32 pad2; /* 64 bit alignment */
|
2013-04-24 02:58:55 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
#define XFS_ATTR3_LEAF_CRC_OFF (offsetof(struct xfs_attr3_leaf_hdr, info.crc))
|
|
|
|
|
|
|
|
struct xfs_attr3_leafblock {
|
|
|
|
struct xfs_attr3_leaf_hdr hdr;
|
|
|
|
struct xfs_attr_leaf_entry entries[1];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The rest of the block contains the following structures after the
|
|
|
|
* leaf entries, growing from the bottom up. The variables are never
|
|
|
|
* referenced, the locations accessed purely from helper functions.
|
|
|
|
*
|
|
|
|
* struct xfs_attr_leaf_name_local
|
|
|
|
* struct xfs_attr_leaf_name_remote
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* incore, neutral version of the attribute leaf header
|
|
|
|
*/
|
|
|
|
struct xfs_attr3_icleaf_hdr {
|
|
|
|
__uint32_t forw;
|
|
|
|
__uint32_t back;
|
|
|
|
__uint16_t magic;
|
|
|
|
__uint16_t count;
|
|
|
|
__uint16_t usedbytes;
|
|
|
|
__uint16_t firstused;
|
|
|
|
__u8 holes;
|
|
|
|
struct {
|
|
|
|
__uint16_t base;
|
|
|
|
__uint16_t size;
|
|
|
|
} freemap[XFS_ATTR_LEAF_MAPSIZE];
|
|
|
|
};
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* Flags used in the leaf_entry[i].flags field.
|
|
|
|
* NOTE: the INCOMPLETE bit must not collide with the flags bits specified
|
|
|
|
* on the system call, they are "or"ed together for various operations.
|
|
|
|
*/
|
|
|
|
#define XFS_ATTR_LOCAL_BIT 0 /* attr is stored locally */
|
|
|
|
#define XFS_ATTR_ROOT_BIT 1 /* limit access to trusted attrs */
|
|
|
|
#define XFS_ATTR_SECURE_BIT 2 /* limit access to secure attrs */
|
|
|
|
#define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */
|
|
|
|
#define XFS_ATTR_LOCAL (1 << XFS_ATTR_LOCAL_BIT)
|
|
|
|
#define XFS_ATTR_ROOT (1 << XFS_ATTR_ROOT_BIT)
|
|
|
|
#define XFS_ATTR_SECURE (1 << XFS_ATTR_SECURE_BIT)
|
|
|
|
#define XFS_ATTR_INCOMPLETE (1 << XFS_ATTR_INCOMPLETE_BIT)
|
|
|
|
|
2006-09-27 19:01:37 -06:00
|
|
|
/*
|
|
|
|
* Conversion macros for converting namespace bits from argument flags
|
|
|
|
* to ondisk flags.
|
|
|
|
*/
|
|
|
|
#define XFS_ATTR_NSP_ARGS_MASK (ATTR_ROOT | ATTR_SECURE)
|
|
|
|
#define XFS_ATTR_NSP_ONDISK_MASK (XFS_ATTR_ROOT | XFS_ATTR_SECURE)
|
|
|
|
#define XFS_ATTR_NSP_ONDISK(flags) ((flags) & XFS_ATTR_NSP_ONDISK_MASK)
|
|
|
|
#define XFS_ATTR_NSP_ARGS(flags) ((flags) & XFS_ATTR_NSP_ARGS_MASK)
|
|
|
|
#define XFS_ATTR_NSP_ARGS_TO_ONDISK(x) (((x) & ATTR_ROOT ? XFS_ATTR_ROOT : 0) |\
|
|
|
|
((x) & ATTR_SECURE ? XFS_ATTR_SECURE : 0))
|
|
|
|
#define XFS_ATTR_NSP_ONDISK_TO_ARGS(x) (((x) & XFS_ATTR_ROOT ? ATTR_ROOT : 0) |\
|
|
|
|
((x) & XFS_ATTR_SECURE ? ATTR_SECURE : 0))
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* Alignment for namelist and valuelist entries (since they are mixed
|
|
|
|
* there can be only one alignment value)
|
|
|
|
*/
|
|
|
|
#define XFS_ATTR_LEAF_NAME_ALIGN ((uint)sizeof(xfs_dablk_t))
|
|
|
|
|
2013-04-24 02:58:55 -06:00
|
|
|
static inline int
|
|
|
|
xfs_attr3_leaf_hdr_size(struct xfs_attr_leafblock *leafp)
|
|
|
|
{
|
|
|
|
if (leafp->hdr.info.magic == cpu_to_be16(XFS_ATTR3_LEAF_MAGIC))
|
|
|
|
return sizeof(struct xfs_attr3_leaf_hdr);
|
|
|
|
return sizeof(struct xfs_attr_leaf_hdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct xfs_attr_leaf_entry *
|
|
|
|
xfs_attr3_leaf_entryp(xfs_attr_leafblock_t *leafp)
|
|
|
|
{
|
|
|
|
if (leafp->hdr.info.magic == cpu_to_be16(XFS_ATTR3_LEAF_MAGIC))
|
|
|
|
return &((struct xfs_attr3_leafblock *)leafp)->entries[0];
|
|
|
|
return &leafp->entries[0];
|
|
|
|
}
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* Cast typed pointers for "local" and "remote" name/value structs.
|
|
|
|
*/
|
2013-04-24 02:58:55 -06:00
|
|
|
static inline char *
|
|
|
|
xfs_attr3_leaf_name(xfs_attr_leafblock_t *leafp, int idx)
|
2005-11-01 20:38:42 -07:00
|
|
|
{
|
2013-04-24 02:58:55 -06:00
|
|
|
struct xfs_attr_leaf_entry *entries = xfs_attr3_leaf_entryp(leafp);
|
|
|
|
|
|
|
|
return &((char *)leafp)[be16_to_cpu(entries[idx].nameidx)];
|
2005-11-01 20:38:42 -07:00
|
|
|
}
|
|
|
|
|
2013-04-24 02:58:55 -06:00
|
|
|
static inline xfs_attr_leaf_name_remote_t *
|
|
|
|
xfs_attr3_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx)
|
2005-11-01 20:38:42 -07:00
|
|
|
{
|
2013-04-24 02:58:55 -06:00
|
|
|
return (xfs_attr_leaf_name_remote_t *)xfs_attr3_leaf_name(leafp, idx);
|
2005-11-01 20:38:42 -07:00
|
|
|
}
|
|
|
|
|
2013-04-24 02:58:55 -06:00
|
|
|
static inline xfs_attr_leaf_name_local_t *
|
|
|
|
xfs_attr3_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
|
2005-11-01 20:38:42 -07:00
|
|
|
{
|
2013-04-24 02:58:55 -06:00
|
|
|
return (xfs_attr_leaf_name_local_t *)xfs_attr3_leaf_name(leafp, idx);
|
2005-11-01 20:38:42 -07:00
|
|
|
}
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Calculate total bytes used (including trailing pad for alignment) for
|
|
|
|
* a "local" name/value structure, a "remote" name/value structure, and
|
|
|
|
* a pointer which might be either.
|
|
|
|
*/
|
2005-11-01 20:38:42 -07:00
|
|
|
static inline int xfs_attr_leaf_entsize_remote(int nlen)
|
|
|
|
{
|
|
|
|
return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \
|
|
|
|
XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen)
|
|
|
|
{
|
|
|
|
return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) +
|
|
|
|
XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int xfs_attr_leaf_entsize_local_max(int bsize)
|
|
|
|
{
|
|
|
|
return (((bsize) >> 1) + ((bsize) >> 2));
|
|
|
|
}
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Used to keep a list of "remote value" extents when unlinking an inode.
|
|
|
|
*/
|
|
|
|
typedef struct xfs_attr_inactive_list {
|
|
|
|
xfs_dablk_t valueblk; /* block number of value bytes */
|
|
|
|
int valuelen; /* number of bytes in value */
|
|
|
|
} xfs_attr_inactive_list_t;
|
|
|
|
|
|
|
|
|
|
|
|
/*========================================================================
|
|
|
|
* Function prototypes for the kernel.
|
|
|
|
*========================================================================*/
|
|
|
|
|
|
|
|
/*
|
2005-11-01 16:34:53 -07:00
|
|
|
* Internal routines when attribute fork size < XFS_LITINO(mp).
|
2005-04-16 16:20:36 -06:00
|
|
|
*/
|
2005-11-01 16:34:53 -07:00
|
|
|
void xfs_attr_shortform_create(struct xfs_da_args *args);
|
|
|
|
void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
|
2005-04-16 16:20:36 -06:00
|
|
|
int xfs_attr_shortform_lookup(struct xfs_da_args *args);
|
|
|
|
int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
|
|
|
|
int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
|
2005-11-01 16:34:53 -07:00
|
|
|
int xfs_attr_shortform_remove(struct xfs_da_args *args);
|
2005-04-16 16:20:36 -06:00
|
|
|
int xfs_attr_shortform_list(struct xfs_attr_list_context *context);
|
2012-06-22 02:50:14 -06:00
|
|
|
int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
|
2005-11-01 16:34:53 -07:00
|
|
|
int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes);
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/*
|
2005-11-01 16:34:53 -07:00
|
|
|
* Internal routines when attribute fork size == XFS_LBSIZE(mp).
|
2005-04-16 16:20:36 -06:00
|
|
|
*/
|
2013-04-24 02:58:55 -06:00
|
|
|
int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
|
|
|
|
int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
|
2005-11-01 16:34:53 -07:00
|
|
|
struct xfs_da_args *args, int forkoff);
|
2013-04-24 02:58:55 -06:00
|
|
|
int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
|
|
|
|
int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
|
|
|
|
int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Routines used for growing the Btree.
|
|
|
|
*/
|
2013-04-24 02:58:55 -06:00
|
|
|
int xfs_attr3_leaf_split(struct xfs_da_state *state,
|
2005-04-16 16:20:36 -06:00
|
|
|
struct xfs_da_state_blk *oldblk,
|
|
|
|
struct xfs_da_state_blk *newblk);
|
2013-04-24 02:58:55 -06:00
|
|
|
int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
|
2005-04-16 16:20:36 -06:00
|
|
|
struct xfs_da_args *args);
|
2013-04-24 02:58:55 -06:00
|
|
|
int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
|
|
|
|
int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
|
2005-04-16 16:20:36 -06:00
|
|
|
struct xfs_da_args *args);
|
2013-04-24 02:58:55 -06:00
|
|
|
int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
|
2005-04-16 16:20:36 -06:00
|
|
|
struct xfs_da_args *args);
|
2013-04-24 02:58:55 -06:00
|
|
|
int xfs_attr3_leaf_list_int(struct xfs_buf *bp,
|
2005-04-16 16:20:36 -06:00
|
|
|
struct xfs_attr_list_context *context);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Routines used for shrinking the Btree.
|
|
|
|
*/
|
2013-04-24 02:58:55 -06:00
|
|
|
int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
|
|
|
|
void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
|
2005-04-16 16:20:36 -06:00
|
|
|
struct xfs_da_state_blk *drop_blk,
|
|
|
|
struct xfs_da_state_blk *save_blk);
|
2013-04-24 02:58:55 -06:00
|
|
|
int xfs_attr3_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Utility routines.
|
|
|
|
*/
|
2012-06-22 02:50:14 -06:00
|
|
|
xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
|
|
|
|
int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
|
|
|
|
struct xfs_buf *leaf2_bp);
|
2005-11-01 16:33:33 -07:00
|
|
|
int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize,
|
2005-04-16 16:20:36 -06:00
|
|
|
int *local);
|
2013-04-24 02:58:55 -06:00
|
|
|
int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
|
2012-11-12 04:54:17 -07:00
|
|
|
xfs_dablk_t bno, xfs_daddr_t mappedbno,
|
|
|
|
struct xfs_buf **bpp);
|
2013-04-24 02:58:55 -06:00
|
|
|
void xfs_attr3_leaf_hdr_from_disk(struct xfs_attr3_icleaf_hdr *to,
|
|
|
|
struct xfs_attr_leafblock *from);
|
2012-11-13 23:54:40 -07:00
|
|
|
|
2013-04-24 02:58:55 -06:00
|
|
|
extern const struct xfs_buf_ops xfs_attr3_leaf_buf_ops;
|
2012-11-12 04:54:17 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
#endif /* __XFS_ATTR_LEAF_H__ */
|