diff options
author | Dave Chinner <david@fromorbit.com> | 2013-10-29 15:11:51 +0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-10-30 22:43:28 +0400 |
commit | 4bceb18f1551c8c047eeb54d48cda9f5453dc12f (patch) | |
tree | 913bd230913f0a09e7131af633985b7b55c6d891 /fs/xfs/xfs_da_format.c | |
parent | 4141956ae05e0685b14b30f92fdc8fb11b4a0cb2 (diff) | |
download | linux-4bceb18f1551c8c047eeb54d48cda9f5453dc12f.tar.xz |
xfs: vectorise DA btree operations
The remaining non-vectorised code for the directory structure is the
node format blocks. This is shared with the attribute tree, and so
is slightly more complex to vectorise.
Introduce a "non-directory" directory ops structure that is attached
to all non-directory inodes so that attribute operations can be
vectorised for all inodes.
Once we do this, we can vectorise all the da btree operations.
Because this patch adds more infrastructure than it removes the
binary size does not decrease:
text data bss dec hex filename
794490 96802 1096 892388 d9de4 fs/xfs/xfs.o.orig
792986 96802 1096 890884 d9804 fs/xfs/xfs.o.p1
792350 96802 1096 890248 d9588 fs/xfs/xfs.o.p2
789293 96802 1096 887191 d8997 fs/xfs/xfs.o.p3
789005 96802 1096 886903 d8997 fs/xfs/xfs.o.p4
789061 96802 1096 886959 d88af fs/xfs/xfs.o.p5
789733 96802 1096 887631 d8b4f fs/xfs/xfs.o.p6
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_da_format.c')
-rw-r--r-- | fs/xfs/xfs_da_format.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/fs/xfs/xfs_da_format.c b/fs/xfs/xfs_da_format.c index ff8b50368c94..72b48b5ec69a 100644 --- a/fs/xfs/xfs_da_format.c +++ b/fs/xfs/xfs_da_format.c @@ -477,6 +477,33 @@ xfs_dir3_leaf_ents_p(struct xfs_dir2_leaf *lp) return ((struct xfs_dir3_leaf *)lp)->__ents; } +/* + * Directory/Attribute Node block operations + */ +static inline int +xfs_da2_node_hdr_size(void) +{ + return sizeof(struct xfs_da_node_hdr); +} + +static struct xfs_da_node_entry * +xfs_da2_node_tree_p(struct xfs_da_intnode *dap) +{ + return dap->__btree; +} + +static inline int +xfs_da3_node_hdr_size(void) +{ + return sizeof(struct xfs_da3_node_hdr); +} + +static inline struct xfs_da_node_entry * +xfs_da3_node_tree_p(struct xfs_da_intnode *dap) +{ + return ((struct xfs_da3_intnode *)dap)->__btree; +} + const struct xfs_dir_ops xfs_dir2_ops = { .sf_entsize = xfs_dir2_sf_entsize, .sf_nextentry = xfs_dir2_sf_nextentry, @@ -508,6 +535,8 @@ const struct xfs_dir_ops xfs_dir2_ops = { .leaf_max_ents = xfs_dir2_max_leaf_ents, .leaf_ents_p = xfs_dir2_leaf_ents_p, + .node_hdr_size = xfs_da2_node_hdr_size, + .node_tree_p = xfs_da2_node_tree_p, }; const struct xfs_dir_ops xfs_dir2_ftype_ops = { @@ -540,6 +569,9 @@ const struct xfs_dir_ops xfs_dir2_ftype_ops = { .leaf_hdr_size = xfs_dir2_leaf_hdr_size, .leaf_max_ents = xfs_dir2_max_leaf_ents, .leaf_ents_p = xfs_dir2_leaf_ents_p, + + .node_hdr_size = xfs_da2_node_hdr_size, + .node_tree_p = xfs_da2_node_tree_p, }; const struct xfs_dir_ops xfs_dir3_ops = { @@ -572,6 +604,19 @@ const struct xfs_dir_ops xfs_dir3_ops = { .leaf_hdr_size = xfs_dir3_leaf_hdr_size, .leaf_max_ents = xfs_dir3_max_leaf_ents, .leaf_ents_p = xfs_dir3_leaf_ents_p, + + .node_hdr_size = xfs_da3_node_hdr_size, + .node_tree_p = xfs_da3_node_tree_p, +}; + +const struct xfs_dir_ops xfs_dir2_nondir_ops = { + .node_hdr_size = xfs_da2_node_hdr_size, + .node_tree_p = xfs_da2_node_tree_p, +}; + +const struct xfs_dir_ops xfs_dir3_nondir_ops = { + .node_hdr_size = xfs_da3_node_hdr_size, + .node_tree_p = xfs_da3_node_tree_p, }; /* @@ -594,3 +639,17 @@ xfs_dir_get_ops( return &xfs_dir2_ftype_ops; return &xfs_dir2_ops; } + +const struct xfs_dir_ops * +xfs_nondir_get_ops( + struct xfs_mount *mp, + struct xfs_inode *dp) +{ + if (dp) + return dp->d_ops; + if (mp->m_nondir_inode_ops) + return mp->m_nondir_inode_ops; + if (xfs_sb_version_hascrc(&mp->m_sb)) + return &xfs_dir3_nondir_ops; + return &xfs_dir2_nondir_ops; +} |