summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_dir2_data.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-11-08 15:05:37 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2019-11-10 16:54:23 -0800
commit7e8ae7bd1c5d806316e6b6403ac2dd0be7a1f82b (patch)
tree5f666554ae7524606cbf22ab4a12aafc96b27cde /fs/xfs/libxfs/xfs_dir2_data.c
parentfdbb8c5b805c19bc2764aa1b91952e75e4c1c086 (diff)
downloadlinux-7e8ae7bd1c5d806316e6b6403ac2dd0be7a1f82b.tar.gz
linux-7e8ae7bd1c5d806316e6b6403ac2dd0be7a1f82b.tar.bz2
linux-7e8ae7bd1c5d806316e6b6403ac2dd0be7a1f82b.zip
xfs: devirtualize ->data_entry_tag_p
Replace the ->data_entry_tag_p dir ops method with a directly called xfs_dir2_data_entry_tag_p helper that takes care of the differences between the directory format with and without the file type field. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_dir2_data.c')
-rw-r--r--fs/xfs/libxfs/xfs_dir2_data.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/fs/xfs/libxfs/xfs_dir2_data.c b/fs/xfs/libxfs/xfs_dir2_data.c
index 830dfd9edfda..3504b230ba1d 100644
--- a/fs/xfs/libxfs/xfs_dir2_data.c
+++ b/fs/xfs/libxfs/xfs_dir2_data.c
@@ -18,6 +18,7 @@
#include "xfs_trans.h"
#include "xfs_buf_item.h"
#include "xfs_log.h"
+#include "xfs_dir2_priv.h"
static xfs_failaddr_t xfs_dir2_data_freefind_verify(
struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_free *bf,
@@ -25,6 +26,18 @@ static xfs_failaddr_t xfs_dir2_data_freefind_verify(
struct xfs_dir2_data_free **bf_ent);
/*
+ * Pointer to an entry's tag word.
+ */
+__be16 *
+xfs_dir2_data_entry_tag_p(
+ struct xfs_mount *mp,
+ struct xfs_dir2_data_entry *dep)
+{
+ return (__be16 *)((char *)dep +
+ xfs_dir2_data_entsize(mp, dep->namelen) - sizeof(__be16));
+}
+
+/*
* The number of leaf entries is limited by the size of the block and the amount
* of space used by the data entries. We don't know how much space is used by
* the data entries yet, so just ensure that the count falls somewhere inside
@@ -182,7 +195,7 @@ __xfs_dir3_data_check(
return __this_address;
if (offset + xfs_dir2_data_entsize(mp, dep->namelen) > end)
return __this_address;
- if (be16_to_cpu(*ops->data_entry_tag_p(dep)) != offset)
+ if (be16_to_cpu(*xfs_dir2_data_entry_tag_p(mp, dep)) != offset)
return __this_address;
if (ops->data_get_ftype(dep) >= XFS_DIR3_FT_MAX)
return __this_address;
@@ -608,7 +621,8 @@ xfs_dir2_data_freescan_int(
/*
* 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(*xfs_dir2_data_entry_tag_p(mp, dep)));
offset += xfs_dir2_data_entsize(mp, dep->namelen);
}
}
@@ -703,6 +717,7 @@ xfs_dir2_data_log_entry(
struct xfs_buf *bp,
xfs_dir2_data_entry_t *dep) /* data entry pointer */
{
+ struct xfs_mount *mp = bp->b_mount;
struct xfs_dir2_data_hdr *hdr = bp->b_addr;
ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
@@ -711,7 +726,7 @@ xfs_dir2_data_log_entry(
hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
xfs_trans_log_buf(args->trans, bp, (uint)((char *)dep - (char *)hdr),
- (uint)((char *)(args->dp->d_ops->data_entry_tag_p(dep) + 1) -
+ (uint)((char *)(xfs_dir2_data_entry_tag_p(mp, dep) + 1) -
(char *)hdr - 1));
}