Undo extended attribute/directory block splitting change.
uint m_flags; /* global mount flags */
uint m_qflags; /* quota status flags */
uint m_attroffset; /* inode attribute offset */
- uint m_dir_node_ents; /* #entries in a dir danode */
- uint m_attr_node_ents; /* #entries in attr danode */
+ int m_da_node_ents; /* how many entries in danode */
int m_ialloc_inos; /* inodes in inode allocation */
int m_ialloc_blks; /* blocks in inode allocation */
int m_litino; /* size of inode union area */
typedef struct xfs_da_node_hdr xfs_da_node_hdr_t;
typedef struct xfs_da_node_entry xfs_da_node_entry_t;
+#define XFS_DA_NODE_ENTSIZE_BYNAME /* space a name uses */ \
+ (sizeof(xfs_da_node_entry_t))
+#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_NODE_ENTRIES)
+int xfs_da_node_entries(struct xfs_mount *mp);
+#define XFS_DA_NODE_ENTRIES(mp) xfs_da_node_entries(mp)
+#else
+#define XFS_DA_NODE_ENTRIES(mp) ((mp)->m_da_node_ents)
+#endif
+
#define XFS_DA_MAXHASH ((xfs_dahash_t)-1) /* largest valid hash value */
/*
typedef struct xfs_da_state_blk {
xfs_dabuf_t *bp; /* buffer containing block */
xfs_dablk_t blkno; /* filesystem blkno of buffer */
- xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer */
+ xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer */
int index; /* relevant index into block */
xfs_dahash_t hashval; /* last hash value in block */
int magic; /* blk's magic number, ie: blk type */
typedef struct xfs_da_state {
xfs_da_args_t *args; /* filename arguments */
struct xfs_mount *mp; /* filesystem mount point */
- unsigned int blocksize; /* logical block size */
- unsigned int node_ents; /* how many entries in danode */
+ int blocksize; /* logical block size */
+ int inleaf; /* insert into 1->lf, 0->splf */
xfs_da_state_path_t path; /* search/split paths */
xfs_da_state_path_t altpath; /* alternate path for join */
- unsigned int inleaf : 1; /* insert into 1->lf, 0->splf */
- unsigned int extravalid : 1; /* T/F: extrablk is in use */
- unsigned int extraafter : 1; /* T/F: extrablk is after new */
+ int extravalid; /* T/F: extrablk is in use */
+ int extraafter; /* T/F: extrablk is after new */
xfs_da_state_blk_t extrablk; /* for double-splits on leafs */
/* for dirv2 extrablk is data */
} xfs_da_state_t;
uint m_dmevmask; /* DMI events for this FS */
uint m_flags; /* global mount flags */
uint m_attroffset; /* inode attribute offset */
- uint m_dir_node_ents; /* #entries in a dir danode */
- uint m_attr_node_ents; /* #entries in attr danode */
+ int m_da_node_ents; /* how many entries in danode */
int m_ialloc_inos; /* inodes in inode allocation */
int m_ialloc_blks; /* blocks in inode allocation */
int m_litino; /* size of inode union area */
INT_SET(node->btree[1].hashval, ARCH_CONVERT, blk2->hashval);
INT_SET(node->btree[1].before, ARCH_CONVERT, blk2->blkno);
INT_SET(node->hdr.count, ARCH_CONVERT, 2);
-
-#ifdef DEBUG
- if (INT_GET(oldroot->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC) {
+ if (XFS_DIR_IS_V2(mp)) {
ASSERT(blk1->blkno >= mp->m_dirleafblk &&
blk1->blkno < mp->m_dirfreeblk);
ASSERT(blk2->blkno >= mp->m_dirleafblk &&
blk2->blkno < mp->m_dirfreeblk);
}
-#endif
-
/* Header is already logged by xfs_da_node_create */
xfs_da_log_buf(tp, bp,
XFS_DA_LOGRANGE(node, node->btree,
/*
* Do we have to split the node?
*/
- if ((INT_GET(node->hdr.count, ARCH_CONVERT) + newcount) > state->node_ents) {
+ if ((INT_GET(node->hdr.count, ARCH_CONVERT) + newcount) > XFS_DA_NODE_ENTRIES(state->mp)) {
/*
* Allocate a new node, add to the doubly linked chain of
* nodes, then move some of our excess entries into it.
ASSERT(INT_GET(info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC);
node = (xfs_da_intnode_t *)info;
count = INT_GET(node->hdr.count, ARCH_CONVERT);
- if (count > (state->node_ents >> 1)) {
+ if (count > (XFS_DA_NODE_ENTRIES(state->mp) >> 1)) {
*action = 0; /* blk over 50%, dont try to join */
return(0); /* blk over 50%, dont try to join */
}
ASSERT(bp != NULL);
node = (xfs_da_intnode_t *)info;
- count = state->node_ents;
- count -= state->node_ents >> 2;
+ count = XFS_DA_NODE_ENTRIES(state->mp);
+ count -= XFS_DA_NODE_ENTRIES(state->mp) >> 2;
count -= INT_GET(node->hdr.count, ARCH_CONVERT);
node = bp->data;
ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC);
count = shortcount > leafcount ? shortcount : leafcount;
mp->m_dircook_elog = xfs_da_log2_roundup(count + 1);
ASSERT(mp->m_dircook_elog <= mp->m_sb.sb_blocklog);
- mp->m_dir_node_ents = mp->m_attr_node_ents =
+ mp->m_da_node_ents =
(XFS_LBSIZE(mp) - (uint)sizeof(xfs_da_node_hdr_t)) /
(uint)sizeof(xfs_da_node_entry_t);
mp->m_dir_magicpct = (XFS_LBSIZE(mp) * 37) / 100;
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_sb.sb_blocksize;
- state->node_ents = state->mp->m_dir_node_ents;
/*
* Search to see if name already exists, and get back a pointer
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_sb.sb_blocksize;
- state->node_ents = state->mp->m_dir_node_ents;
/*
* Search to see if name exists, and get back a pointer to it.
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_sb.sb_blocksize;
- state->node_ents = state->mp->m_dir_node_ents;
/*
* Search to see if name exists,
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_sb.sb_blocksize;
- state->node_ents = state->mp->m_dir_node_ents;
inum = args->inumber;
/*
mp->m_dirdatablk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_DATA_FIRSTDB(mp));
mp->m_dirleafblk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_LEAF_FIRSTDB(mp));
mp->m_dirfreeblk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_FREE_FIRSTDB(mp));
- mp->m_attr_node_ents =
- (mp->m_sb.sb_blocksize - (uint)sizeof(xfs_da_node_hdr_t)) /
- (uint)sizeof(xfs_da_node_entry_t);
- mp->m_dir_node_ents =
+ mp->m_da_node_ents =
(mp->m_dirblksize - (uint)sizeof(xfs_da_node_hdr_t)) /
(uint)sizeof(xfs_da_node_entry_t);
mp->m_dir_magicpct = (mp->m_dirblksize * 37) / 100;
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_dirblksize;
- state->node_ents = state->mp->m_dir_node_ents;
/*
* Look up the name. We're not supposed to find it, but
* this gives us the insertion point.
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_dirblksize;
- state->node_ents = state->mp->m_dir_node_ents;
/*
* Fill in the path to the entry in the cursor.
*/
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_dirblksize;
- state->node_ents = state->mp->m_dir_node_ents;
/*
* Look up the entry we're deleting, set up the cursor.
*/
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_dirblksize;
- state->node_ents = state->mp->m_dir_node_ents;
inum = args->inumber;
/*
* Lookup the entry to change in the btree.
libxfs_putbuf(bp);
goto error_out;
}
- if (INT_GET(node->hdr.count, ARCH_CONVERT) > mp->m_dir_node_ents) {
+ if (INT_GET(node->hdr.count, ARCH_CONVERT) > XFS_DA_NODE_ENTRIES(mp)) {
do_warn("bad record count in inode %llu, count = %d, max = %d\n",
da_cursor->ino, INT_GET(node->hdr.count, ARCH_CONVERT),
- mp->m_dir_node_ents);
+ XFS_DA_NODE_ENTRIES(mp));
libxfs_putbuf(bp);
goto error_out;
}
bad++;
}
if (INT_GET(newnode->hdr.count, ARCH_CONVERT) >
- mp->m_dir_node_ents) {
+ XFS_DA_NODE_ENTRIES(mp)) {
do_warn("entry count %d too large in block %u (%llu) for "
"directory inode %llu\n",
INT_GET(newnode->hdr.count, ARCH_CONVERT),
goto error_out;
}
if (INT_GET(node->hdr.count, ARCH_CONVERT) >
- mp->m_dir_node_ents) {
+ XFS_DA_NODE_ENTRIES(mp)) {
da_brelse(bp);
do_warn("bad record count in inode %llu, count = %d, "
"max = %d\n", da_cursor->ino,
INT_GET(node->hdr.count, ARCH_CONVERT),
- mp->m_dir_node_ents);
+ XFS_DA_NODE_ENTRIES(mp));
goto error_out;
}
dabno, cursor->ino);
bad++;
}
- if (INT_GET(newnode->hdr.count, ARCH_CONVERT) > mp->m_dir_node_ents) {
+ if (INT_GET(newnode->hdr.count, ARCH_CONVERT) > XFS_DA_NODE_ENTRIES(mp)) {
do_warn("entry count %d too large in block %u for "
"directory inode %llu\n",
INT_GET(newnode->hdr.count, ARCH_CONVERT), dabno, cursor->ino);