aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_node.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_dir2_node.c')
-rw-r--r--fs/xfs/xfs_dir2_node.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index 2226a00acd15..4c3dba7ffb74 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -30,6 +30,7 @@
30#include "xfs_inode.h" 30#include "xfs_inode.h"
31#include "xfs_bmap.h" 31#include "xfs_bmap.h"
32#include "xfs_dir2_format.h" 32#include "xfs_dir2_format.h"
33#include "xfs_dir2.h"
33#include "xfs_dir2_priv.h" 34#include "xfs_dir2_priv.h"
34#include "xfs_error.h" 35#include "xfs_error.h"
35#include "xfs_trace.h" 36#include "xfs_trace.h"
@@ -312,11 +313,13 @@ xfs_dir2_free_log_header(
312 struct xfs_trans *tp, 313 struct xfs_trans *tp,
313 struct xfs_buf *bp) 314 struct xfs_buf *bp)
314{ 315{
316#ifdef DEBUG
315 xfs_dir2_free_t *free; /* freespace structure */ 317 xfs_dir2_free_t *free; /* freespace structure */
316 318
317 free = bp->b_addr; 319 free = bp->b_addr;
318 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) || 320 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
319 free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC)); 321 free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
322#endif
320 xfs_trans_log_buf(tp, bp, 0, xfs_dir3_free_hdr_size(tp->t_mountp) - 1); 323 xfs_trans_log_buf(tp, bp, 0, xfs_dir3_free_hdr_size(tp->t_mountp) - 1);
321} 324}
322 325
@@ -602,7 +605,7 @@ xfs_dir2_leafn_lookup_for_addname(
602 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) || 605 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
603 free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC)); 606 free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
604 } 607 }
605 length = xfs_dir2_data_entsize(args->namelen); 608 length = xfs_dir3_data_entsize(mp, args->namelen);
606 /* 609 /*
607 * Loop over leaf entries with the right hash value. 610 * Loop over leaf entries with the right hash value.
608 */ 611 */
@@ -813,6 +816,7 @@ xfs_dir2_leafn_lookup_for_entry(
813 xfs_trans_brelse(tp, state->extrablk.bp); 816 xfs_trans_brelse(tp, state->extrablk.bp);
814 args->cmpresult = cmp; 817 args->cmpresult = cmp;
815 args->inumber = be64_to_cpu(dep->inumber); 818 args->inumber = be64_to_cpu(dep->inumber);
819 args->filetype = xfs_dir3_dirent_get_ftype(mp, dep);
816 *indexp = index; 820 *indexp = index;
817 state->extravalid = 1; 821 state->extravalid = 1;
818 state->extrablk.bp = curbp; 822 state->extrablk.bp = curbp;
@@ -1256,7 +1260,7 @@ xfs_dir2_leafn_remove(
1256 longest = be16_to_cpu(bf[0].length); 1260 longest = be16_to_cpu(bf[0].length);
1257 needlog = needscan = 0; 1261 needlog = needscan = 0;
1258 xfs_dir2_data_make_free(tp, dbp, off, 1262 xfs_dir2_data_make_free(tp, dbp, off,
1259 xfs_dir2_data_entsize(dep->namelen), &needlog, &needscan); 1263 xfs_dir3_data_entsize(mp, dep->namelen), &needlog, &needscan);
1260 /* 1264 /*
1261 * Rescan the data block freespaces for bestfree. 1265 * Rescan the data block freespaces for bestfree.
1262 * Log the data block header if needed. 1266 * Log the data block header if needed.
@@ -1708,7 +1712,7 @@ xfs_dir2_node_addname_int(
1708 dp = args->dp; 1712 dp = args->dp;
1709 mp = dp->i_mount; 1713 mp = dp->i_mount;
1710 tp = args->trans; 1714 tp = args->trans;
1711 length = xfs_dir2_data_entsize(args->namelen); 1715 length = xfs_dir3_data_entsize(mp, args->namelen);
1712 /* 1716 /*
1713 * If we came in with a freespace block that means that lookup 1717 * If we came in with a freespace block that means that lookup
1714 * found an entry with our hash value. This is the freespace 1718 * found an entry with our hash value. This is the freespace
@@ -2004,7 +2008,8 @@ xfs_dir2_node_addname_int(
2004 dep->inumber = cpu_to_be64(args->inumber); 2008 dep->inumber = cpu_to_be64(args->inumber);
2005 dep->namelen = args->namelen; 2009 dep->namelen = args->namelen;
2006 memcpy(dep->name, args->name, dep->namelen); 2010 memcpy(dep->name, args->name, dep->namelen);
2007 tagp = xfs_dir2_data_entry_tag_p(dep); 2011 xfs_dir3_dirent_put_ftype(mp, dep, args->filetype);
2012 tagp = xfs_dir3_data_entry_tag_p(mp, dep);
2008 *tagp = cpu_to_be16((char *)dep - (char *)hdr); 2013 *tagp = cpu_to_be16((char *)dep - (char *)hdr);
2009 xfs_dir2_data_log_entry(tp, dbp, dep); 2014 xfs_dir2_data_log_entry(tp, dbp, dep);
2010 /* 2015 /*
@@ -2224,6 +2229,7 @@ xfs_dir2_node_replace(
2224 * Fill in the new inode number and log the entry. 2229 * Fill in the new inode number and log the entry.
2225 */ 2230 */
2226 dep->inumber = cpu_to_be64(inum); 2231 dep->inumber = cpu_to_be64(inum);
2232 xfs_dir3_dirent_put_ftype(state->mp, dep, args->filetype);
2227 xfs_dir2_data_log_entry(args->trans, state->extrablk.bp, dep); 2233 xfs_dir2_data_log_entry(args->trans, state->extrablk.bp, dep);
2228 rval = 0; 2234 rval = 0;
2229 } 2235 }