Commit fdbb8c5b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: devirtualize ->data_entsize

Replace the ->data_entsize dir ops method with a directly called
xfs_dir2_data_entsize helper that takes care of the differences between
the directory format with and without the file type field.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 5c072127
...@@ -41,18 +41,15 @@ ...@@ -41,18 +41,15 @@
sizeof(xfs_dir2_data_off_t) + sizeof(uint8_t)), \ sizeof(xfs_dir2_data_off_t) + sizeof(uint8_t)), \
XFS_DIR2_DATA_ALIGN) XFS_DIR2_DATA_ALIGN)
static int int
xfs_dir2_data_entsize( xfs_dir2_data_entsize(
struct xfs_mount *mp,
int n) int n)
{ {
return XFS_DIR2_DATA_ENTSIZE(n); if (xfs_sb_version_hasftype(&mp->m_sb))
}
static int
xfs_dir3_data_entsize(
int n)
{
return XFS_DIR3_DATA_ENTSIZE(n); return XFS_DIR3_DATA_ENTSIZE(n);
else
return XFS_DIR2_DATA_ENTSIZE(n);
} }
static uint8_t static uint8_t
...@@ -100,7 +97,7 @@ xfs_dir2_data_entry_tag_p( ...@@ -100,7 +97,7 @@ xfs_dir2_data_entry_tag_p(
struct xfs_dir2_data_entry *dep) struct xfs_dir2_data_entry *dep)
{ {
return (__be16 *)((char *)dep + return (__be16 *)((char *)dep +
xfs_dir2_data_entsize(dep->namelen) - sizeof(__be16)); XFS_DIR2_DATA_ENTSIZE(dep->namelen) - sizeof(__be16));
} }
static __be16 * static __be16 *
...@@ -108,7 +105,7 @@ xfs_dir3_data_entry_tag_p( ...@@ -108,7 +105,7 @@ xfs_dir3_data_entry_tag_p(
struct xfs_dir2_data_entry *dep) struct xfs_dir2_data_entry *dep)
{ {
return (__be16 *)((char *)dep + return (__be16 *)((char *)dep +
xfs_dir3_data_entsize(dep->namelen) - sizeof(__be16)); XFS_DIR3_DATA_ENTSIZE(dep->namelen) - sizeof(__be16));
} }
static struct xfs_dir2_data_free * static struct xfs_dir2_data_free *
...@@ -124,7 +121,6 @@ xfs_dir3_data_bestfree_p(struct xfs_dir2_data_hdr *hdr) ...@@ -124,7 +121,6 @@ xfs_dir3_data_bestfree_p(struct xfs_dir2_data_hdr *hdr)
} }
static const struct xfs_dir_ops xfs_dir2_ops = { static const struct xfs_dir_ops xfs_dir2_ops = {
.data_entsize = xfs_dir2_data_entsize,
.data_get_ftype = xfs_dir2_data_get_ftype, .data_get_ftype = xfs_dir2_data_get_ftype,
.data_put_ftype = xfs_dir2_data_put_ftype, .data_put_ftype = xfs_dir2_data_put_ftype,
.data_entry_tag_p = xfs_dir2_data_entry_tag_p, .data_entry_tag_p = xfs_dir2_data_entry_tag_p,
...@@ -137,7 +133,6 @@ static const struct xfs_dir_ops xfs_dir2_ops = { ...@@ -137,7 +133,6 @@ static const struct xfs_dir_ops xfs_dir2_ops = {
}; };
static const struct xfs_dir_ops xfs_dir2_ftype_ops = { static const struct xfs_dir_ops xfs_dir2_ftype_ops = {
.data_entsize = xfs_dir3_data_entsize,
.data_get_ftype = xfs_dir3_data_get_ftype, .data_get_ftype = xfs_dir3_data_get_ftype,
.data_put_ftype = xfs_dir3_data_put_ftype, .data_put_ftype = xfs_dir3_data_put_ftype,
.data_entry_tag_p = xfs_dir3_data_entry_tag_p, .data_entry_tag_p = xfs_dir3_data_entry_tag_p,
...@@ -150,7 +145,6 @@ static const struct xfs_dir_ops xfs_dir2_ftype_ops = { ...@@ -150,7 +145,6 @@ static const struct xfs_dir_ops xfs_dir2_ftype_ops = {
}; };
static const struct xfs_dir_ops xfs_dir3_ops = { static const struct xfs_dir_ops xfs_dir3_ops = {
.data_entsize = xfs_dir3_data_entsize,
.data_get_ftype = xfs_dir3_data_get_ftype, .data_get_ftype = xfs_dir3_data_get_ftype,
.data_put_ftype = xfs_dir3_data_put_ftype, .data_put_ftype = xfs_dir3_data_put_ftype,
.data_entry_tag_p = xfs_dir3_data_entry_tag_p, .data_entry_tag_p = xfs_dir3_data_entry_tag_p,
......
...@@ -32,7 +32,6 @@ extern unsigned char xfs_mode_to_ftype(int mode); ...@@ -32,7 +32,6 @@ extern unsigned char xfs_mode_to_ftype(int mode);
* directory operations vector for encode/decode routines * directory operations vector for encode/decode routines
*/ */
struct xfs_dir_ops { struct xfs_dir_ops {
int (*data_entsize)(int len);
uint8_t (*data_get_ftype)(struct xfs_dir2_data_entry *dep); uint8_t (*data_get_ftype)(struct xfs_dir2_data_entry *dep);
void (*data_put_ftype)(struct xfs_dir2_data_entry *dep, void (*data_put_ftype)(struct xfs_dir2_data_entry *dep,
uint8_t ftype); uint8_t ftype);
...@@ -85,7 +84,7 @@ extern int xfs_dir2_isleaf(struct xfs_da_args *args, int *r); ...@@ -85,7 +84,7 @@ extern int xfs_dir2_isleaf(struct xfs_da_args *args, int *r);
extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db, extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
struct xfs_buf *bp); struct xfs_buf *bp);
extern void xfs_dir2_data_freescan_int(struct xfs_da_geometry *geo, extern void xfs_dir2_data_freescan_int(struct xfs_mount *mp,
const struct xfs_dir_ops *ops, const struct xfs_dir_ops *ops,
struct xfs_dir2_data_hdr *hdr, int *loghead); struct xfs_dir2_data_hdr *hdr, int *loghead);
extern void xfs_dir2_data_freescan(struct xfs_inode *dp, extern void xfs_dir2_data_freescan(struct xfs_inode *dp,
......
...@@ -355,7 +355,7 @@ xfs_dir2_block_addname( ...@@ -355,7 +355,7 @@ xfs_dir2_block_addname(
if (error) if (error)
return error; return error;
len = dp->d_ops->data_entsize(args->namelen); len = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
/* /*
* Set up pointers to parts of the block. * Set up pointers to parts of the block.
...@@ -791,7 +791,8 @@ xfs_dir2_block_removename( ...@@ -791,7 +791,8 @@ xfs_dir2_block_removename(
needlog = needscan = 0; needlog = needscan = 0;
xfs_dir2_data_make_free(args, bp, xfs_dir2_data_make_free(args, bp,
(xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr),
dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); xfs_dir2_data_entsize(dp->i_mount, dep->namelen), &needlog,
&needscan);
/* /*
* Fix up the block tail. * Fix up the block tail.
*/ */
...@@ -1149,7 +1150,7 @@ xfs_dir2_sf_to_block( ...@@ -1149,7 +1150,7 @@ xfs_dir2_sf_to_block(
xfs_dir2_data_log_entry(args, bp, dep); xfs_dir2_data_log_entry(args, bp, dep);
blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot); blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot);
blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(offset)); blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(offset));
offset += dp->d_ops->data_entsize(dep->namelen); offset += xfs_dir2_data_entsize(mp, dep->namelen);
/* /*
* Create entry for .. * Create entry for ..
...@@ -1164,7 +1165,7 @@ xfs_dir2_sf_to_block( ...@@ -1164,7 +1165,7 @@ xfs_dir2_sf_to_block(
xfs_dir2_data_log_entry(args, bp, dep); xfs_dir2_data_log_entry(args, bp, dep);
blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(offset)); blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(offset));
offset += dp->d_ops->data_entsize(dep->namelen); offset += xfs_dir2_data_entsize(mp, dep->namelen);
/* /*
* Loop over existing entries, stuff them in. * Loop over existing entries, stuff them in.
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_dir2_priv.h"
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
...@@ -179,7 +180,7 @@ __xfs_dir3_data_check( ...@@ -179,7 +180,7 @@ __xfs_dir3_data_check(
return __this_address; return __this_address;
if (xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber))) if (xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber)))
return __this_address; return __this_address;
if (offset + ops->data_entsize(dep->namelen) > end) if (offset + xfs_dir2_data_entsize(mp, dep->namelen) > end)
return __this_address; return __this_address;
if (be16_to_cpu(*ops->data_entry_tag_p(dep)) != offset) if (be16_to_cpu(*ops->data_entry_tag_p(dep)) != offset)
return __this_address; return __this_address;
...@@ -203,7 +204,7 @@ __xfs_dir3_data_check( ...@@ -203,7 +204,7 @@ __xfs_dir3_data_check(
if (i >= be32_to_cpu(btp->count)) if (i >= be32_to_cpu(btp->count))
return __this_address; return __this_address;
} }
offset += ops->data_entsize(dep->namelen); offset += xfs_dir2_data_entsize(mp, dep->namelen);
} }
/* /*
* Need to have seen all the entries and all the bestfree slots. * Need to have seen all the entries and all the bestfree slots.
...@@ -567,7 +568,7 @@ xfs_dir2_data_freeremove( ...@@ -567,7 +568,7 @@ xfs_dir2_data_freeremove(
*/ */
void void
xfs_dir2_data_freescan_int( xfs_dir2_data_freescan_int(
struct xfs_da_geometry *geo, struct xfs_mount *mp,
const struct xfs_dir_ops *ops, const struct xfs_dir_ops *ops,
struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_hdr *hdr,
int *loghead) int *loghead)
...@@ -588,7 +589,7 @@ xfs_dir2_data_freescan_int( ...@@ -588,7 +589,7 @@ xfs_dir2_data_freescan_int(
memset(bf, 0, sizeof(*bf) * XFS_DIR2_DATA_FD_COUNT); memset(bf, 0, sizeof(*bf) * XFS_DIR2_DATA_FD_COUNT);
*loghead = 1; *loghead = 1;
end = xfs_dir3_data_end_offset(geo, addr); end = xfs_dir3_data_end_offset(mp->m_dir_geo, addr);
while (offset < end) { while (offset < end) {
struct xfs_dir2_data_unused *dup = addr + offset; struct xfs_dir2_data_unused *dup = addr + offset;
struct xfs_dir2_data_entry *dep = addr + offset; struct xfs_dir2_data_entry *dep = addr + offset;
...@@ -608,7 +609,7 @@ xfs_dir2_data_freescan_int( ...@@ -608,7 +609,7 @@ xfs_dir2_data_freescan_int(
* For active entries, check their tags and skip them. * For active entries, check their tags and skip them.
*/ */
ASSERT(offset == be16_to_cpu(*ops->data_entry_tag_p(dep))); ASSERT(offset == be16_to_cpu(*ops->data_entry_tag_p(dep)));
offset += ops->data_entsize(dep->namelen); offset += xfs_dir2_data_entsize(mp, dep->namelen);
} }
} }
...@@ -618,8 +619,7 @@ xfs_dir2_data_freescan( ...@@ -618,8 +619,7 @@ xfs_dir2_data_freescan(
struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_hdr *hdr,
int *loghead) int *loghead)
{ {
return xfs_dir2_data_freescan_int(dp->i_mount->m_dir_geo, dp->d_ops, return xfs_dir2_data_freescan_int(dp->i_mount, dp->d_ops, hdr, loghead);
hdr, loghead);
} }
/* /*
......
...@@ -660,7 +660,7 @@ xfs_dir2_leaf_addname( ...@@ -660,7 +660,7 @@ xfs_dir2_leaf_addname(
xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
ents = leafhdr.ents; ents = leafhdr.ents;
bestsp = xfs_dir2_leaf_bests_p(ltp); bestsp = xfs_dir2_leaf_bests_p(ltp);
length = dp->d_ops->data_entsize(args->namelen); length = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
/* /*
* See if there are any entries with the same hash value * See if there are any entries with the same hash value
...@@ -1397,7 +1397,8 @@ xfs_dir2_leaf_removename( ...@@ -1397,7 +1397,8 @@ xfs_dir2_leaf_removename(
*/ */
xfs_dir2_data_make_free(args, dbp, xfs_dir2_data_make_free(args, dbp,
(xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr),
dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); xfs_dir2_data_entsize(dp->i_mount, dep->namelen), &needlog,
&needscan);
/* /*
* We just mark the leaf entry stale by putting a null in it. * We just mark the leaf entry stale by putting a null in it.
*/ */
......
...@@ -666,7 +666,7 @@ xfs_dir2_leafn_lookup_for_addname( ...@@ -666,7 +666,7 @@ xfs_dir2_leafn_lookup_for_addname(
ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) || ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC)); free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
} }
length = dp->d_ops->data_entsize(args->namelen); length = xfs_dir2_data_entsize(mp, args->namelen);
/* /*
* Loop over leaf entries with the right hash value. * Loop over leaf entries with the right hash value.
*/ */
...@@ -1320,7 +1320,8 @@ xfs_dir2_leafn_remove( ...@@ -1320,7 +1320,8 @@ xfs_dir2_leafn_remove(
longest = be16_to_cpu(bf[0].length); longest = be16_to_cpu(bf[0].length);
needlog = needscan = 0; needlog = needscan = 0;
xfs_dir2_data_make_free(args, dbp, off, xfs_dir2_data_make_free(args, dbp, off,
dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); xfs_dir2_data_entsize(dp->i_mount, dep->namelen), &needlog,
&needscan);
/* /*
* Rescan the data block freespaces for bestfree. * Rescan the data block freespaces for bestfree.
* Log the data block header if needed. * Log the data block header if needed.
...@@ -1913,7 +1914,7 @@ xfs_dir2_node_addname_int( ...@@ -1913,7 +1914,7 @@ xfs_dir2_node_addname_int(
int needscan = 0; /* need to rescan data frees */ int needscan = 0; /* need to rescan data frees */
__be16 *tagp; /* data entry tag pointer */ __be16 *tagp; /* data entry tag pointer */
length = dp->d_ops->data_entsize(args->namelen); length = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
error = xfs_dir2_node_find_freeblk(args, fblk, &dbno, &fbp, &freehdr, error = xfs_dir2_node_find_freeblk(args, fblk, &dbno, &fbp, &freehdr,
&findex, length); &findex, length);
if (error) if (error)
......
...@@ -57,6 +57,8 @@ extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args, ...@@ -57,6 +57,8 @@ extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,
struct xfs_buf *lbp, struct xfs_buf *dbp); struct xfs_buf *lbp, struct xfs_buf *dbp);
/* xfs_dir2_data.c */ /* xfs_dir2_data.c */
int xfs_dir2_data_entsize(struct xfs_mount *mp, int n);
#ifdef DEBUG #ifdef DEBUG
extern void xfs_dir3_data_check(struct xfs_inode *dp, struct xfs_buf *bp); extern void xfs_dir3_data_check(struct xfs_inode *dp, struct xfs_buf *bp);
#else #else
......
...@@ -323,7 +323,7 @@ xfs_dir2_block_to_sf( ...@@ -323,7 +323,7 @@ xfs_dir2_block_to_sf(
sfep = xfs_dir2_sf_nextentry(mp, sfp, sfep); sfep = xfs_dir2_sf_nextentry(mp, sfp, sfep);
} }
offset += dp->d_ops->data_entsize(dep->namelen); offset += xfs_dir2_data_entsize(mp, dep->namelen);
} }
ASSERT((char *)sfep - (char *)sfp == size); ASSERT((char *)sfep - (char *)sfp == size);
...@@ -540,10 +540,10 @@ xfs_dir2_sf_addname_hard( ...@@ -540,10 +540,10 @@ xfs_dir2_sf_addname_hard(
*/ */
for (offset = dp->d_ops->data_first_offset, for (offset = dp->d_ops->data_first_offset,
oldsfep = xfs_dir2_sf_firstentry(oldsfp), oldsfep = xfs_dir2_sf_firstentry(oldsfp),
add_datasize = dp->d_ops->data_entsize(args->namelen), add_datasize = xfs_dir2_data_entsize(mp, args->namelen),
eof = (char *)oldsfep == &buf[old_isize]; eof = (char *)oldsfep == &buf[old_isize];
!eof; !eof;
offset = new_offset + dp->d_ops->data_entsize(oldsfep->namelen), offset = new_offset + xfs_dir2_data_entsize(mp, oldsfep->namelen),
oldsfep = xfs_dir2_sf_nextentry(mp, oldsfp, oldsfep), oldsfep = xfs_dir2_sf_nextentry(mp, oldsfp, oldsfep),
eof = (char *)oldsfep == &buf[old_isize]) { eof = (char *)oldsfep == &buf[old_isize]) {
new_offset = xfs_dir2_sf_get_offset(oldsfep); new_offset = xfs_dir2_sf_get_offset(oldsfep);
...@@ -615,7 +615,7 @@ xfs_dir2_sf_addname_pick( ...@@ -615,7 +615,7 @@ xfs_dir2_sf_addname_pick(
int used; /* data bytes used */ int used; /* data bytes used */
sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
size = dp->d_ops->data_entsize(args->namelen); size = xfs_dir2_data_entsize(mp, args->namelen);
offset = dp->d_ops->data_first_offset; offset = dp->d_ops->data_first_offset;
sfep = xfs_dir2_sf_firstentry(sfp); sfep = xfs_dir2_sf_firstentry(sfp);
holefit = 0; holefit = 0;
...@@ -628,7 +628,7 @@ xfs_dir2_sf_addname_pick( ...@@ -628,7 +628,7 @@ xfs_dir2_sf_addname_pick(
if (!holefit) if (!holefit)
holefit = offset + size <= xfs_dir2_sf_get_offset(sfep); holefit = offset + size <= xfs_dir2_sf_get_offset(sfep);
offset = xfs_dir2_sf_get_offset(sfep) + offset = xfs_dir2_sf_get_offset(sfep) +
dp->d_ops->data_entsize(sfep->namelen); xfs_dir2_data_entsize(mp, sfep->namelen);
sfep = xfs_dir2_sf_nextentry(mp, sfp, sfep); sfep = xfs_dir2_sf_nextentry(mp, sfp, sfep);
} }
/* /*
...@@ -693,7 +693,7 @@ xfs_dir2_sf_check( ...@@ -693,7 +693,7 @@ xfs_dir2_sf_check(
i8count += ino > XFS_DIR2_MAX_SHORT_INUM; i8count += ino > XFS_DIR2_MAX_SHORT_INUM;
offset = offset =
xfs_dir2_sf_get_offset(sfep) + xfs_dir2_sf_get_offset(sfep) +
dp->d_ops->data_entsize(sfep->namelen); xfs_dir2_data_entsize(mp, sfep->namelen);
ASSERT(xfs_dir2_sf_get_ftype(mp, sfep) < XFS_DIR3_FT_MAX); ASSERT(xfs_dir2_sf_get_ftype(mp, sfep) < XFS_DIR3_FT_MAX);
} }
ASSERT(i8count == sfp->i8count); ASSERT(i8count == sfp->i8count);
...@@ -793,7 +793,7 @@ xfs_dir2_sf_verify( ...@@ -793,7 +793,7 @@ xfs_dir2_sf_verify(
return __this_address; return __this_address;
offset = xfs_dir2_sf_get_offset(sfep) + offset = xfs_dir2_sf_get_offset(sfep) +
dops->data_entsize(sfep->namelen); xfs_dir2_data_entsize(mp, sfep->namelen);
sfep = next_sfep; sfep = next_sfep;
} }
......
...@@ -265,7 +265,7 @@ xchk_dir_rec( ...@@ -265,7 +265,7 @@ xchk_dir_rec(
} }
if (dep == dent) if (dep == dent)
break; break;
iter_off += mp->m_dir_inode_ops->data_entsize(dep->namelen); iter_off += xfs_dir2_data_entsize(mp, dep->namelen);
} }
/* Retrieve the entry, sanity check it, and compare hashes. */ /* Retrieve the entry, sanity check it, and compare hashes. */
...@@ -403,7 +403,7 @@ xchk_directory_data_bestfree( ...@@ -403,7 +403,7 @@ xchk_directory_data_bestfree(
if (dup->freetag != cpu_to_be16(XFS_DIR2_DATA_FREE_TAG)) { if (dup->freetag != cpu_to_be16(XFS_DIR2_DATA_FREE_TAG)) {
struct xfs_dir2_data_entry *dep = bp->b_addr + offset; struct xfs_dir2_data_entry *dep = bp->b_addr + offset;
newlen = d_ops->data_entsize(dep->namelen); newlen = xfs_dir2_data_entsize(mp, dep->namelen);
if (newlen <= 0) { if (newlen <= 0) {
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, xchk_fblock_set_corrupt(sc, XFS_DATA_FORK,
lblk); lblk);
......
...@@ -78,7 +78,7 @@ xfs_dir2_sf_getdents( ...@@ -78,7 +78,7 @@ xfs_dir2_sf_getdents(
dp->d_ops->data_entry_offset); dp->d_ops->data_entry_offset);
dotdot_offset = xfs_dir2_db_off_to_dataptr(geo, geo->datablk, dotdot_offset = xfs_dir2_db_off_to_dataptr(geo, geo->datablk,
dp->d_ops->data_entry_offset + dp->d_ops->data_entry_offset +
dp->d_ops->data_entsize(sizeof(".") - 1)); xfs_dir2_data_entsize(mp, sizeof(".") - 1));
/* /*
* Put . entry unless we're starting past it. * Put . entry unless we're starting past it.
...@@ -192,7 +192,7 @@ xfs_dir2_block_getdents( ...@@ -192,7 +192,7 @@ xfs_dir2_block_getdents(
/* /*
* Bump pointer for the next iteration. * Bump pointer for the next iteration.
*/ */
offset += dp->d_ops->data_entsize(dep->namelen); offset += xfs_dir2_data_entsize(dp->i_mount, dep->namelen);
/* /*
* The entry is before the desired starting point, skip it. * The entry is before the desired starting point, skip it.
...@@ -347,6 +347,7 @@ xfs_dir2_leaf_getdents( ...@@ -347,6 +347,7 @@ xfs_dir2_leaf_getdents(
size_t bufsize) size_t bufsize)
{ {
struct xfs_inode *dp = args->dp; struct xfs_inode *dp = args->dp;
struct xfs_mount *mp = dp->i_mount;
struct xfs_buf *bp = NULL; /* data block buffer */ struct xfs_buf *bp = NULL; /* data block buffer */
xfs_dir2_data_entry_t *dep; /* data entry */ xfs_dir2_data_entry_t *dep; /* data entry */
xfs_dir2_data_unused_t *dup; /* unused entry */ xfs_dir2_data_unused_t *dup; /* unused entry */
...@@ -422,8 +423,8 @@ xfs_dir2_leaf_getdents( ...@@ -422,8 +423,8 @@ xfs_dir2_leaf_getdents(
continue; continue;
} }
dep = bp->b_addr + offset; dep = bp->b_addr + offset;
length = length = xfs_dir2_data_entsize(mp,
dp->d_ops->data_entsize(dep->namelen); dep->namelen);
offset += length; offset += length;
} }
/* /*
...@@ -454,7 +455,7 @@ xfs_dir2_leaf_getdents( ...@@ -454,7 +455,7 @@ xfs_dir2_leaf_getdents(
} }
dep = bp->b_addr + offset; dep = bp->b_addr + offset;
length = dp->d_ops->data_entsize(dep->namelen); length = xfs_dir2_data_entsize(mp, dep->namelen);
filetype = dp->d_ops->data_get_ftype(dep); filetype = dp->d_ops->data_get_ftype(dep);
ctx->pos = xfs_dir2_byte_to_dataptr(curoff) & 0x7fffffff; ctx->pos = xfs_dir2_byte_to_dataptr(curoff) & 0x7fffffff;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment