aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_node.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-08-12 06:50:10 -0400
committerBen Myers <bpm@sgi.com>2013-08-22 09:44:49 -0400
commit1c55cece084aa4c9a3fa34ed4eecbdf18afbf05d (patch)
treeb849301088d3e21e91992ad3ccf0ed0f5f492446 /fs/xfs/xfs_dir2_node.c
parent0cb97766f2928579f1029ea7b28ae946cdd6fbe1 (diff)
xfs: Add write support for dirent filetype field
Add support to propagate and add filetype values into the on-disk directs. This involves passing the filetype into the xfs_da_args structure along with the name and namelength for direct operations, and encoding it into the dirent at the same time we write the inode number into the dirent. With write support, add the feature flag to the XFS_SB_FEAT_INCOMPAT_ALL mask so we can now mount filesystems with this feature set. Performance of directory recursion is now much improved. Parallel walk of ~50 million directory entries across hundreds of directories improves significantly. Unpatched, no CRCs: Walking via ls -R real 3m19.886s user 6m36.960s sys 28m19.087s THis is doing roughly 500 getdents() calls per second, and 250,000 inode lookups per second to determine the inode type at roughly 17,000 read IOPS. CPU usage is 90% kernel space. With dtype support patched in and the fileset recreated with CRCs enabled: Walking via ls -R real 0m31.316s user 6m32.975s sys 0m21.111s This is doing roughly 3500 getdents() calls per second at 16,000 IOPS. There are no inode lookups at all. CPU usages is almost 100% userspace. This is a big win for recursive directory walks that only need to find file names and file types. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_node.c')
-rw-r--r--fs/xfs/xfs_dir2_node.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index 49f1e9ed492c..4c3dba7ffb74 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -816,6 +816,7 @@ xfs_dir2_leafn_lookup_for_entry(
816 xfs_trans_brelse(tp, state->extrablk.bp); 816 xfs_trans_brelse(tp, state->extrablk.bp);
817 args->cmpresult = cmp; 817 args->cmpresult = cmp;
818 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);
819 *indexp = index; 820 *indexp = index;
820 state->extravalid = 1; 821 state->extravalid = 1;
821 state->extrablk.bp = curbp; 822 state->extrablk.bp = curbp;
@@ -2007,6 +2008,7 @@ xfs_dir2_node_addname_int(
2007 dep->inumber = cpu_to_be64(args->inumber); 2008 dep->inumber = cpu_to_be64(args->inumber);
2008 dep->namelen = args->namelen; 2009 dep->namelen = args->namelen;
2009 memcpy(dep->name, args->name, dep->namelen); 2010 memcpy(dep->name, args->name, dep->namelen);
2011 xfs_dir3_dirent_put_ftype(mp, dep, args->filetype);
2010 tagp = xfs_dir3_data_entry_tag_p(mp, dep); 2012 tagp = xfs_dir3_data_entry_tag_p(mp, dep);
2011 *tagp = cpu_to_be16((char *)dep - (char *)hdr); 2013 *tagp = cpu_to_be16((char *)dep - (char *)hdr);
2012 xfs_dir2_data_log_entry(tp, dbp, dep); 2014 xfs_dir2_data_log_entry(tp, dbp, dep);
@@ -2227,6 +2229,7 @@ xfs_dir2_node_replace(
2227 * Fill in the new inode number and log the entry. 2229 * Fill in the new inode number and log the entry.
2228 */ 2230 */
2229 dep->inumber = cpu_to_be64(inum); 2231 dep->inumber = cpu_to_be64(inum);
2232 xfs_dir3_dirent_put_ftype(state->mp, dep, args->filetype);
2230 xfs_dir2_data_log_entry(args->trans, state->extrablk.bp, dep); 2233 xfs_dir2_data_log_entry(args->trans, state->extrablk.bp, dep);
2231 rval = 0; 2234 rval = 0;
2232 } 2235 }