diff options
Diffstat (limited to 'fs/xfs/xfs_dir2_block.c')
-rw-r--r-- | fs/xfs/xfs_dir2_block.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c index 4204df966980..c7cd3154026a 100644 --- a/fs/xfs/xfs_dir2_block.c +++ b/fs/xfs/xfs_dir2_block.c | |||
@@ -281,8 +281,7 @@ out: | |||
281 | */ | 281 | */ |
282 | static void | 282 | static void |
283 | xfs_dir2_block_compact( | 283 | xfs_dir2_block_compact( |
284 | struct xfs_trans *tp, | 284 | struct xfs_da_args *args, |
285 | struct xfs_inode *dp, | ||
286 | struct xfs_buf *bp, | 285 | struct xfs_buf *bp, |
287 | struct xfs_dir2_data_hdr *hdr, | 286 | struct xfs_dir2_data_hdr *hdr, |
288 | struct xfs_dir2_block_tail *btp, | 287 | struct xfs_dir2_block_tail *btp, |
@@ -315,7 +314,7 @@ xfs_dir2_block_compact( | |||
315 | *lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1); | 314 | *lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1); |
316 | *lfloghigh -= be32_to_cpu(btp->stale) - 1; | 315 | *lfloghigh -= be32_to_cpu(btp->stale) - 1; |
317 | be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1)); | 316 | be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1)); |
318 | xfs_dir2_data_make_free(tp, dp, bp, | 317 | xfs_dir2_data_make_free(args, bp, |
319 | (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), | 318 | (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), |
320 | (xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)), | 319 | (xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)), |
321 | needlog, &needscan); | 320 | needlog, &needscan); |
@@ -325,7 +324,7 @@ xfs_dir2_block_compact( | |||
325 | * This needs to happen before the next call to use_free. | 324 | * This needs to happen before the next call to use_free. |
326 | */ | 325 | */ |
327 | if (needscan) | 326 | if (needscan) |
328 | xfs_dir2_data_freescan(dp, hdr, needlog); | 327 | xfs_dir2_data_freescan(args->dp, hdr, needlog); |
329 | } | 328 | } |
330 | 329 | ||
331 | /* | 330 | /* |
@@ -420,7 +419,7 @@ xfs_dir2_block_addname( | |||
420 | * If need to compact the leaf entries, do it now. | 419 | * If need to compact the leaf entries, do it now. |
421 | */ | 420 | */ |
422 | if (compact) { | 421 | if (compact) { |
423 | xfs_dir2_block_compact(tp, dp, bp, hdr, btp, blp, &needlog, | 422 | xfs_dir2_block_compact(args, bp, hdr, btp, blp, &needlog, |
424 | &lfloghigh, &lfloglow); | 423 | &lfloghigh, &lfloglow); |
425 | /* recalculate blp post-compaction */ | 424 | /* recalculate blp post-compaction */ |
426 | blp = xfs_dir2_block_leaf_p(btp); | 425 | blp = xfs_dir2_block_leaf_p(btp); |
@@ -455,7 +454,7 @@ xfs_dir2_block_addname( | |||
455 | /* | 454 | /* |
456 | * Mark the space needed for the new leaf entry, now in use. | 455 | * Mark the space needed for the new leaf entry, now in use. |
457 | */ | 456 | */ |
458 | xfs_dir2_data_use_free(tp, dp, bp, enddup, | 457 | xfs_dir2_data_use_free(args, bp, enddup, |
459 | (xfs_dir2_data_aoff_t) | 458 | (xfs_dir2_data_aoff_t) |
460 | ((char *)enddup - (char *)hdr + be16_to_cpu(enddup->length) - | 459 | ((char *)enddup - (char *)hdr + be16_to_cpu(enddup->length) - |
461 | sizeof(*blp)), | 460 | sizeof(*blp)), |
@@ -542,7 +541,7 @@ xfs_dir2_block_addname( | |||
542 | /* | 541 | /* |
543 | * Mark space for the data entry used. | 542 | * Mark space for the data entry used. |
544 | */ | 543 | */ |
545 | xfs_dir2_data_use_free(tp, dp, bp, dup, | 544 | xfs_dir2_data_use_free(args, bp, dup, |
546 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), | 545 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), |
547 | (xfs_dir2_data_aoff_t)len, &needlog, &needscan); | 546 | (xfs_dir2_data_aoff_t)len, &needlog, &needscan); |
548 | /* | 547 | /* |
@@ -560,9 +559,9 @@ xfs_dir2_block_addname( | |||
560 | if (needscan) | 559 | if (needscan) |
561 | xfs_dir2_data_freescan(dp, hdr, &needlog); | 560 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
562 | if (needlog) | 561 | if (needlog) |
563 | xfs_dir2_data_log_header(tp, dp, bp); | 562 | xfs_dir2_data_log_header(args, bp); |
564 | xfs_dir2_block_log_tail(tp, bp); | 563 | xfs_dir2_block_log_tail(tp, bp); |
565 | xfs_dir2_data_log_entry(tp, dp, bp, dep); | 564 | xfs_dir2_data_log_entry(args, bp, dep); |
566 | xfs_dir3_data_check(dp, bp); | 565 | xfs_dir3_data_check(dp, bp); |
567 | return 0; | 566 | return 0; |
568 | } | 567 | } |
@@ -803,7 +802,7 @@ xfs_dir2_block_removename( | |||
803 | * Mark the data entry's space free. | 802 | * Mark the data entry's space free. |
804 | */ | 803 | */ |
805 | needlog = needscan = 0; | 804 | needlog = needscan = 0; |
806 | xfs_dir2_data_make_free(tp, dp, bp, | 805 | xfs_dir2_data_make_free(args, bp, |
807 | (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), | 806 | (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), |
808 | dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); | 807 | dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); |
809 | /* | 808 | /* |
@@ -822,7 +821,7 @@ xfs_dir2_block_removename( | |||
822 | if (needscan) | 821 | if (needscan) |
823 | xfs_dir2_data_freescan(dp, hdr, &needlog); | 822 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
824 | if (needlog) | 823 | if (needlog) |
825 | xfs_dir2_data_log_header(tp, dp, bp); | 824 | xfs_dir2_data_log_header(args, bp); |
826 | xfs_dir3_data_check(dp, bp); | 825 | xfs_dir3_data_check(dp, bp); |
827 | /* | 826 | /* |
828 | * See if the size as a shortform is good enough. | 827 | * See if the size as a shortform is good enough. |
@@ -881,7 +880,7 @@ xfs_dir2_block_replace( | |||
881 | */ | 880 | */ |
882 | dep->inumber = cpu_to_be64(args->inumber); | 881 | dep->inumber = cpu_to_be64(args->inumber); |
883 | dp->d_ops->data_put_ftype(dep, args->filetype); | 882 | dp->d_ops->data_put_ftype(dep, args->filetype); |
884 | xfs_dir2_data_log_entry(args->trans, dp, bp, dep); | 883 | xfs_dir2_data_log_entry(args, bp, dep); |
885 | xfs_dir3_data_check(dp, bp); | 884 | xfs_dir3_data_check(dp, bp); |
886 | return 0; | 885 | return 0; |
887 | } | 886 | } |
@@ -1004,7 +1003,7 @@ xfs_dir2_leaf_to_block( | |||
1004 | /* | 1003 | /* |
1005 | * Use up the space at the end of the block (blp/btp). | 1004 | * Use up the space at the end of the block (blp/btp). |
1006 | */ | 1005 | */ |
1007 | xfs_dir2_data_use_free(tp, dp, dbp, dup, args->geo->blksize - size, size, | 1006 | xfs_dir2_data_use_free(args, dbp, dup, args->geo->blksize - size, size, |
1008 | &needlog, &needscan); | 1007 | &needlog, &needscan); |
1009 | /* | 1008 | /* |
1010 | * Initialize the block tail. | 1009 | * Initialize the block tail. |
@@ -1030,7 +1029,7 @@ xfs_dir2_leaf_to_block( | |||
1030 | if (needscan) | 1029 | if (needscan) |
1031 | xfs_dir2_data_freescan(dp, hdr, &needlog); | 1030 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
1032 | if (needlog) | 1031 | if (needlog) |
1033 | xfs_dir2_data_log_header(tp, dp, dbp); | 1032 | xfs_dir2_data_log_header(args, dbp); |
1034 | /* | 1033 | /* |
1035 | * Pitch the old leaf block. | 1034 | * Pitch the old leaf block. |
1036 | */ | 1035 | */ |
@@ -1143,7 +1142,7 @@ xfs_dir2_sf_to_block( | |||
1143 | */ | 1142 | */ |
1144 | dup = dp->d_ops->data_unused_p(hdr); | 1143 | dup = dp->d_ops->data_unused_p(hdr); |
1145 | needlog = needscan = 0; | 1144 | needlog = needscan = 0; |
1146 | xfs_dir2_data_use_free(tp, dp, bp, dup, args->geo->blksize - i, | 1145 | xfs_dir2_data_use_free(args, bp, dup, args->geo->blksize - i, |
1147 | i, &needlog, &needscan); | 1146 | i, &needlog, &needscan); |
1148 | ASSERT(needscan == 0); | 1147 | ASSERT(needscan == 0); |
1149 | /* | 1148 | /* |
@@ -1157,7 +1156,7 @@ xfs_dir2_sf_to_block( | |||
1157 | /* | 1156 | /* |
1158 | * Remove the freespace, we'll manage it. | 1157 | * Remove the freespace, we'll manage it. |
1159 | */ | 1158 | */ |
1160 | xfs_dir2_data_use_free(tp, dp, bp, dup, | 1159 | xfs_dir2_data_use_free(args, bp, dup, |
1161 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), | 1160 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), |
1162 | be16_to_cpu(dup->length), &needlog, &needscan); | 1161 | be16_to_cpu(dup->length), &needlog, &needscan); |
1163 | /* | 1162 | /* |
@@ -1170,7 +1169,7 @@ xfs_dir2_sf_to_block( | |||
1170 | dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR); | 1169 | dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR); |
1171 | tagp = dp->d_ops->data_entry_tag_p(dep); | 1170 | tagp = dp->d_ops->data_entry_tag_p(dep); |
1172 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); | 1171 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); |
1173 | xfs_dir2_data_log_entry(tp, dp, bp, dep); | 1172 | xfs_dir2_data_log_entry(args, bp, dep); |
1174 | blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot); | 1173 | blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot); |
1175 | blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr( | 1174 | blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr( |
1176 | (char *)dep - (char *)hdr)); | 1175 | (char *)dep - (char *)hdr)); |
@@ -1184,7 +1183,7 @@ xfs_dir2_sf_to_block( | |||
1184 | dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR); | 1183 | dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR); |
1185 | tagp = dp->d_ops->data_entry_tag_p(dep); | 1184 | tagp = dp->d_ops->data_entry_tag_p(dep); |
1186 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); | 1185 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); |
1187 | xfs_dir2_data_log_entry(tp, dp, bp, dep); | 1186 | xfs_dir2_data_log_entry(args, bp, dep); |
1188 | blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); | 1187 | blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); |
1189 | blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr( | 1188 | blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr( |
1190 | (char *)dep - (char *)hdr)); | 1189 | (char *)dep - (char *)hdr)); |
@@ -1218,7 +1217,7 @@ xfs_dir2_sf_to_block( | |||
1218 | dup->length = cpu_to_be16(newoffset - offset); | 1217 | dup->length = cpu_to_be16(newoffset - offset); |
1219 | *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16( | 1218 | *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16( |
1220 | ((char *)dup - (char *)hdr)); | 1219 | ((char *)dup - (char *)hdr)); |
1221 | xfs_dir2_data_log_unused(tp, bp, dup); | 1220 | xfs_dir2_data_log_unused(args, bp, dup); |
1222 | xfs_dir2_data_freeinsert(hdr, | 1221 | xfs_dir2_data_freeinsert(hdr, |
1223 | dp->d_ops->data_bestfree_p(hdr), | 1222 | dp->d_ops->data_bestfree_p(hdr), |
1224 | dup, &dummy); | 1223 | dup, &dummy); |
@@ -1235,7 +1234,7 @@ xfs_dir2_sf_to_block( | |||
1235 | memcpy(dep->name, sfep->name, dep->namelen); | 1234 | memcpy(dep->name, sfep->name, dep->namelen); |
1236 | tagp = dp->d_ops->data_entry_tag_p(dep); | 1235 | tagp = dp->d_ops->data_entry_tag_p(dep); |
1237 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); | 1236 | *tagp = cpu_to_be16((char *)dep - (char *)hdr); |
1238 | xfs_dir2_data_log_entry(tp, dp, bp, dep); | 1237 | xfs_dir2_data_log_entry(args, bp, dep); |
1239 | name.name = sfep->name; | 1238 | name.name = sfep->name; |
1240 | name.len = sfep->namelen; | 1239 | name.len = sfep->namelen; |
1241 | blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops-> | 1240 | blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops-> |