aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_data.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_dir2_data.c')
-rw-r--r--fs/xfs/xfs_dir2_data.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index c2930238005c..47e1326c169a 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -29,14 +29,12 @@
29#include "xfs_dinode.h" 29#include "xfs_dinode.h"
30#include "xfs_inode.h" 30#include "xfs_inode.h"
31#include "xfs_dir2_format.h" 31#include "xfs_dir2_format.h"
32#include "xfs_dir2.h"
32#include "xfs_dir2_priv.h" 33#include "xfs_dir2_priv.h"
33#include "xfs_error.h" 34#include "xfs_error.h"
34#include "xfs_buf_item.h" 35#include "xfs_buf_item.h"
35#include "xfs_cksum.h" 36#include "xfs_cksum.h"
36 37
37STATIC xfs_dir2_data_free_t *
38xfs_dir2_data_freefind(xfs_dir2_data_hdr_t *hdr, xfs_dir2_data_unused_t *dup);
39
40/* 38/*
41 * Check the consistency of the data block. 39 * Check the consistency of the data block.
42 * The input can also be a block-format directory. 40 * The input can also be a block-format directory.
@@ -149,8 +147,10 @@ __xfs_dir3_data_check(
149 XFS_WANT_CORRUPTED_RETURN( 147 XFS_WANT_CORRUPTED_RETURN(
150 !xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber))); 148 !xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber)));
151 XFS_WANT_CORRUPTED_RETURN( 149 XFS_WANT_CORRUPTED_RETURN(
152 be16_to_cpu(*xfs_dir2_data_entry_tag_p(dep)) == 150 be16_to_cpu(*xfs_dir3_data_entry_tag_p(mp, dep)) ==
153 (char *)dep - (char *)hdr); 151 (char *)dep - (char *)hdr);
152 XFS_WANT_CORRUPTED_RETURN(
153 xfs_dir3_dirent_get_ftype(mp, dep) < XFS_DIR3_FT_MAX);
154 count++; 154 count++;
155 lastfree = 0; 155 lastfree = 0;
156 if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || 156 if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
@@ -168,7 +168,7 @@ __xfs_dir3_data_check(
168 } 168 }
169 XFS_WANT_CORRUPTED_RETURN(i < be32_to_cpu(btp->count)); 169 XFS_WANT_CORRUPTED_RETURN(i < be32_to_cpu(btp->count));
170 } 170 }
171 p += xfs_dir2_data_entsize(dep->namelen); 171 p += xfs_dir3_data_entsize(mp, dep->namelen);
172 } 172 }
173 /* 173 /*
174 * Need to have seen all the entries and all the bestfree slots. 174 * Need to have seen all the entries and all the bestfree slots.
@@ -325,7 +325,7 @@ xfs_dir3_data_readahead(
325 * Given a data block and an unused entry from that block, 325 * Given a data block and an unused entry from that block,
326 * return the bestfree entry if any that corresponds to it. 326 * return the bestfree entry if any that corresponds to it.
327 */ 327 */
328STATIC xfs_dir2_data_free_t * 328xfs_dir2_data_free_t *
329xfs_dir2_data_freefind( 329xfs_dir2_data_freefind(
330 xfs_dir2_data_hdr_t *hdr, /* data block */ 330 xfs_dir2_data_hdr_t *hdr, /* data block */
331 xfs_dir2_data_unused_t *dup) /* data unused entry */ 331 xfs_dir2_data_unused_t *dup) /* data unused entry */
@@ -333,7 +333,7 @@ xfs_dir2_data_freefind(
333 xfs_dir2_data_free_t *dfp; /* bestfree entry */ 333 xfs_dir2_data_free_t *dfp; /* bestfree entry */
334 xfs_dir2_data_aoff_t off; /* offset value needed */ 334 xfs_dir2_data_aoff_t off; /* offset value needed */
335 struct xfs_dir2_data_free *bf; 335 struct xfs_dir2_data_free *bf;
336#if defined(DEBUG) && defined(__KERNEL__) 336#ifdef DEBUG
337 int matched; /* matched the value */ 337 int matched; /* matched the value */
338 int seenzero; /* saw a 0 bestfree entry */ 338 int seenzero; /* saw a 0 bestfree entry */
339#endif 339#endif
@@ -341,7 +341,7 @@ xfs_dir2_data_freefind(
341 off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr); 341 off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr);
342 bf = xfs_dir3_data_bestfree_p(hdr); 342 bf = xfs_dir3_data_bestfree_p(hdr);
343 343
344#if defined(DEBUG) && defined(__KERNEL__) 344#ifdef DEBUG
345 /* 345 /*
346 * Validate some consistency in the bestfree table. 346 * Validate some consistency in the bestfree table.
347 * Check order, non-overlapping entries, and if we find the 347 * Check order, non-overlapping entries, and if we find the
@@ -538,8 +538,8 @@ xfs_dir2_data_freescan(
538 else { 538 else {
539 dep = (xfs_dir2_data_entry_t *)p; 539 dep = (xfs_dir2_data_entry_t *)p;
540 ASSERT((char *)dep - (char *)hdr == 540 ASSERT((char *)dep - (char *)hdr ==
541 be16_to_cpu(*xfs_dir2_data_entry_tag_p(dep))); 541 be16_to_cpu(*xfs_dir3_data_entry_tag_p(mp, dep)));
542 p += xfs_dir2_data_entsize(dep->namelen); 542 p += xfs_dir3_data_entsize(mp, dep->namelen);
543 } 543 }
544 } 544 }
545} 545}
@@ -629,7 +629,8 @@ xfs_dir2_data_log_entry(
629 struct xfs_buf *bp, 629 struct xfs_buf *bp,
630 xfs_dir2_data_entry_t *dep) /* data entry pointer */ 630 xfs_dir2_data_entry_t *dep) /* data entry pointer */
631{ 631{
632 xfs_dir2_data_hdr_t *hdr = bp->b_addr; 632 struct xfs_dir2_data_hdr *hdr = bp->b_addr;
633 struct xfs_mount *mp = tp->t_mountp;
633 634
634 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || 635 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
635 hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || 636 hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) ||
@@ -637,7 +638,7 @@ xfs_dir2_data_log_entry(
637 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); 638 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
638 639
639 xfs_trans_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr), 640 xfs_trans_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr),
640 (uint)((char *)(xfs_dir2_data_entry_tag_p(dep) + 1) - 641 (uint)((char *)(xfs_dir3_data_entry_tag_p(mp, dep) + 1) -
641 (char *)hdr - 1)); 642 (char *)hdr - 1));
642} 643}
643 644