diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-10-29 07:11:48 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-10-30 14:39:14 -0400 |
commit | 9d23fc8575de7012b8853bd6fefe10534665de2f (patch) | |
tree | 6dab547e4e967349aaa48bca5d64e0055a32508d /fs/xfs/xfs_dir2_block.c | |
parent | 4740175e75f70ab71f76ae98ab00f7db731a48f7 (diff) |
xfs: vectorise directory data operations
Following from the initial patches to vectorise the shortform
directory encode/decode operations, convert half the data block
operations to use the vector. The rest will be done in a second
patch.
This further reduces the size of the built binary:
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
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_block.c')
-rw-r--r-- | fs/xfs/xfs_dir2_block.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c index 960f3ab526f6..507ef6a7d1f9 100644 --- a/fs/xfs/xfs_dir2_block.c +++ b/fs/xfs/xfs_dir2_block.c | |||
@@ -280,6 +280,7 @@ out: | |||
280 | static void | 280 | static void |
281 | xfs_dir2_block_compact( | 281 | xfs_dir2_block_compact( |
282 | struct xfs_trans *tp, | 282 | struct xfs_trans *tp, |
283 | struct xfs_inode *dp, | ||
283 | struct xfs_buf *bp, | 284 | struct xfs_buf *bp, |
284 | struct xfs_dir2_data_hdr *hdr, | 285 | struct xfs_dir2_data_hdr *hdr, |
285 | struct xfs_dir2_block_tail *btp, | 286 | struct xfs_dir2_block_tail *btp, |
@@ -323,7 +324,7 @@ xfs_dir2_block_compact( | |||
323 | * This needs to happen before the next call to use_free. | 324 | * This needs to happen before the next call to use_free. |
324 | */ | 325 | */ |
325 | if (needscan) | 326 | if (needscan) |
326 | xfs_dir2_data_freescan(tp->t_mountp, hdr, needlog); | 327 | xfs_dir2_data_freescan(dp, hdr, needlog); |
327 | } | 328 | } |
328 | 329 | ||
329 | /* | 330 | /* |
@@ -369,7 +370,7 @@ xfs_dir2_block_addname( | |||
369 | if (error) | 370 | if (error) |
370 | return error; | 371 | return error; |
371 | 372 | ||
372 | len = xfs_dir3_data_entsize(mp, args->namelen); | 373 | len = dp->d_ops->data_entsize(args->namelen); |
373 | 374 | ||
374 | /* | 375 | /* |
375 | * Set up pointers to parts of the block. | 376 | * Set up pointers to parts of the block. |
@@ -418,7 +419,7 @@ xfs_dir2_block_addname( | |||
418 | * If need to compact the leaf entries, do it now. | 419 | * If need to compact the leaf entries, do it now. |
419 | */ | 420 | */ |
420 | if (compact) { | 421 | if (compact) { |
421 | xfs_dir2_block_compact(tp, bp, hdr, btp, blp, &needlog, | 422 | xfs_dir2_block_compact(tp, dp, bp, hdr, btp, blp, &needlog, |
422 | &lfloghigh, &lfloglow); | 423 | &lfloghigh, &lfloglow); |
423 | /* recalculate blp post-compaction */ | 424 | /* recalculate blp post-compaction */ |
424 | blp = xfs_dir2_block_leaf_p(btp); | 425 | blp = xfs_dir2_block_leaf_p(btp); |
@@ -468,7 +469,7 @@ xfs_dir2_block_addname( | |||
468 | * This needs to happen before the next call to use_free. | 469 | * This needs to happen before the next call to use_free. |
469 | */ | 470 | */ |
470 | if (needscan) { | 471 | if (needscan) { |
471 | xfs_dir2_data_freescan(mp, hdr, &needlog); | 472 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
472 | needscan = 0; | 473 | needscan = 0; |
473 | } | 474 | } |
474 | /* | 475 | /* |
@@ -549,18 +550,18 @@ xfs_dir2_block_addname( | |||
549 | dep->inumber = cpu_to_be64(args->inumber); | 550 | dep->inumber = cpu_to_be64(args->inumber); |
550 | dep->namelen = args->namelen; | 551 | dep->namelen = args->namelen; |
551 | memcpy(dep->name, args->name, args->namelen); | 552 | memcpy(dep->name, args->name, args->namelen); |
552 | xfs_dir3_dirent_put_ftype(mp, dep, args->filetype); | 553 | dp->d_ops->data_put_ftype(dep, args->filetype); |
553 | tagp = xfs_dir3_data_entry_tag_p(mp, dep); | 554 | tagp = dp->d_ops->data_entry_tag_p(dep); |
554 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); | 555 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); |
555 | /* | 556 | /* |
556 | * Clean up the bestfree array and log the header, tail, and entry. | 557 | * Clean up the bestfree array and log the header, tail, and entry. |
557 | */ | 558 | */ |
558 | if (needscan) | 559 | if (needscan) |
559 | xfs_dir2_data_freescan(mp, hdr, &needlog); | 560 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
560 | if (needlog) | 561 | if (needlog) |
561 | xfs_dir2_data_log_header(tp, bp); | 562 | xfs_dir2_data_log_header(tp, bp); |
562 | xfs_dir2_block_log_tail(tp, bp); | 563 | xfs_dir2_block_log_tail(tp, bp); |
563 | xfs_dir2_data_log_entry(tp, bp, dep); | 564 | xfs_dir2_data_log_entry(tp, dp, bp, dep); |
564 | xfs_dir3_data_check(dp, bp); | 565 | xfs_dir3_data_check(dp, bp); |
565 | return 0; | 566 | return 0; |
566 | } | 567 | } |
@@ -642,7 +643,7 @@ xfs_dir2_block_lookup( | |||
642 | * Fill in inode number, CI name if appropriate, release the block. | 643 | * Fill in inode number, CI name if appropriate, release the block. |
643 | */ | 644 | */ |
644 | args->inumber = be64_to_cpu(dep->inumber); | 645 | args->inumber = be64_to_cpu(dep->inumber); |
645 | args->filetype = xfs_dir3_dirent_get_ftype(mp, dep); | 646 | args->filetype = dp->d_ops->data_get_ftype(dep); |
646 | error = xfs_dir_cilookup_result(args, dep->name, dep->namelen); | 647 | error = xfs_dir_cilookup_result(args, dep->name, dep->namelen); |
647 | xfs_trans_brelse(args->trans, bp); | 648 | xfs_trans_brelse(args->trans, bp); |
648 | return XFS_ERROR(error); | 649 | return XFS_ERROR(error); |
@@ -801,7 +802,7 @@ xfs_dir2_block_removename( | |||
801 | needlog = needscan = 0; | 802 | needlog = needscan = 0; |
802 | xfs_dir2_data_make_free(tp, bp, | 803 | xfs_dir2_data_make_free(tp, bp, |
803 | (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), | 804 | (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), |
804 | xfs_dir3_data_entsize(mp, dep->namelen), &needlog, &needscan); | 805 | dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); |
805 | /* | 806 | /* |
806 | * Fix up the block tail. | 807 | * Fix up the block tail. |
807 | */ | 808 | */ |
@@ -816,7 +817,7 @@ xfs_dir2_block_removename( | |||
816 | * Fix up bestfree, log the header if necessary. | 817 | * Fix up bestfree, log the header if necessary. |
817 | */ | 818 | */ |
818 | if (needscan) | 819 | if (needscan) |
819 | xfs_dir2_data_freescan(mp, hdr, &needlog); | 820 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
820 | if (needlog) | 821 | if (needlog) |
821 | xfs_dir2_data_log_header(tp, bp); | 822 | xfs_dir2_data_log_header(tp, bp); |
822 | xfs_dir3_data_check(dp, bp); | 823 | xfs_dir3_data_check(dp, bp); |
@@ -875,8 +876,8 @@ xfs_dir2_block_replace( | |||
875 | * Change the inode number to the new value. | 876 | * Change the inode number to the new value. |
876 | */ | 877 | */ |
877 | dep->inumber = cpu_to_be64(args->inumber); | 878 | dep->inumber = cpu_to_be64(args->inumber); |
878 | xfs_dir3_dirent_put_ftype(mp, dep, args->filetype); | 879 | dp->d_ops->data_put_ftype(dep, args->filetype); |
879 | xfs_dir2_data_log_entry(args->trans, bp, dep); | 880 | xfs_dir2_data_log_entry(args->trans, dp, bp, dep); |
880 | xfs_dir3_data_check(dp, bp); | 881 | xfs_dir3_data_check(dp, bp); |
881 | return 0; | 882 | return 0; |
882 | } | 883 | } |
@@ -1023,7 +1024,7 @@ xfs_dir2_leaf_to_block( | |||
1023 | * Scan the bestfree if we need it and log the data block header. | 1024 | * Scan the bestfree if we need it and log the data block header. |
1024 | */ | 1025 | */ |
1025 | if (needscan) | 1026 | if (needscan) |
1026 | xfs_dir2_data_freescan(mp, hdr, &needlog); | 1027 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
1027 | if (needlog) | 1028 | if (needlog) |
1028 | xfs_dir2_data_log_header(tp, dbp); | 1029 | xfs_dir2_data_log_header(tp, dbp); |
1029 | /* | 1030 | /* |
@@ -1158,32 +1159,32 @@ xfs_dir2_sf_to_block( | |||
1158 | /* | 1159 | /* |
1159 | * Create entry for . | 1160 | * Create entry for . |
1160 | */ | 1161 | */ |
1161 | dep = xfs_dir3_data_dot_entry_p(mp, hdr); | 1162 | dep = dp->d_ops->data_dot_entry_p(hdr); |
1162 | dep->inumber = cpu_to_be64(dp->i_ino); | 1163 | dep->inumber = cpu_to_be64(dp->i_ino); |
1163 | dep->namelen = 1; | 1164 | dep->namelen = 1; |
1164 | dep->name[0] = '.'; | 1165 | dep->name[0] = '.'; |
1165 | xfs_dir3_dirent_put_ftype(mp, dep, XFS_DIR3_FT_DIR); | 1166 | dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR); |
1166 | tagp = xfs_dir3_data_entry_tag_p(mp, dep); | 1167 | tagp = dp->d_ops->data_entry_tag_p(dep); |
1167 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); | 1168 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); |
1168 | xfs_dir2_data_log_entry(tp, bp, dep); | 1169 | xfs_dir2_data_log_entry(tp, dp, bp, dep); |
1169 | blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot); | 1170 | blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot); |
1170 | blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp, | 1171 | blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp, |
1171 | (char *)dep - (char *)hdr)); | 1172 | (char *)dep - (char *)hdr)); |
1172 | /* | 1173 | /* |
1173 | * Create entry for .. | 1174 | * Create entry for .. |
1174 | */ | 1175 | */ |
1175 | dep = xfs_dir3_data_dotdot_entry_p(mp, hdr); | 1176 | dep = dp->d_ops->data_dotdot_entry_p(hdr); |
1176 | dep->inumber = cpu_to_be64(dp->d_ops->sf_get_parent_ino(sfp)); | 1177 | dep->inumber = cpu_to_be64(dp->d_ops->sf_get_parent_ino(sfp)); |
1177 | dep->namelen = 2; | 1178 | dep->namelen = 2; |
1178 | dep->name[0] = dep->name[1] = '.'; | 1179 | dep->name[0] = dep->name[1] = '.'; |
1179 | xfs_dir3_dirent_put_ftype(mp, dep, XFS_DIR3_FT_DIR); | 1180 | dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR); |
1180 | tagp = xfs_dir3_data_entry_tag_p(mp, dep); | 1181 | tagp = dp->d_ops->data_entry_tag_p(dep); |
1181 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); | 1182 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); |
1182 | xfs_dir2_data_log_entry(tp, bp, dep); | 1183 | xfs_dir2_data_log_entry(tp, dp, bp, dep); |
1183 | blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); | 1184 | blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); |
1184 | blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp, | 1185 | blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp, |
1185 | (char *)dep - (char *)hdr)); | 1186 | (char *)dep - (char *)hdr)); |
1186 | offset = xfs_dir3_data_first_offset(mp); | 1187 | offset = dp->d_ops->data_first_offset(); |
1187 | /* | 1188 | /* |
1188 | * Loop over existing entries, stuff them in. | 1189 | * Loop over existing entries, stuff them in. |
1189 | */ | 1190 | */ |
@@ -1224,12 +1225,11 @@ xfs_dir2_sf_to_block( | |||
1224 | dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset); | 1225 | dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset); |
1225 | dep->inumber = cpu_to_be64(dp->d_ops->sf_get_ino(sfp, sfep)); | 1226 | dep->inumber = cpu_to_be64(dp->d_ops->sf_get_ino(sfp, sfep)); |
1226 | dep->namelen = sfep->namelen; | 1227 | dep->namelen = sfep->namelen; |
1227 | xfs_dir3_dirent_put_ftype(mp, dep, | 1228 | dp->d_ops->data_put_ftype(dep, dp->d_ops->sf_get_ftype(sfep)); |
1228 | dp->d_ops->sf_get_ftype(sfep)); | ||
1229 | memcpy(dep->name, sfep->name, dep->namelen); | 1229 | memcpy(dep->name, sfep->name, dep->namelen); |
1230 | tagp = xfs_dir3_data_entry_tag_p(mp, dep); | 1230 | tagp = dp->d_ops->data_entry_tag_p(dep); |
1231 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); | 1231 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); |
1232 | xfs_dir2_data_log_entry(tp, bp, dep); | 1232 | xfs_dir2_data_log_entry(tp, dp, bp, dep); |
1233 | name.name = sfep->name; | 1233 | name.name = sfep->name; |
1234 | name.len = sfep->namelen; | 1234 | name.len = sfep->namelen; |
1235 | blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops-> | 1235 | blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops-> |