diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-10-29 07:11:49 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-10-30 14:39:31 -0400 |
commit | 2ca9877410594dd321621efc9e1cbcd1ca24d0f3 (patch) | |
tree | 002e968ea70087df002ecc70d0966868c49b0cd1 /fs/xfs | |
parent | 9d23fc8575de7012b8853bd6fefe10534665de2f (diff) |
xfs: vectorise directory data operations part 2
Convert the rest of the directory data block encode/decode
operations to vector format.
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
789005 96802 1096 886903 d8997 fs/xfs/xfs.o.p4
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')
-rw-r--r-- | fs/xfs/xfs_da_format.c | 68 | ||||
-rw-r--r-- | fs/xfs/xfs_da_format.h | 41 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2.h | 22 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_block.c | 33 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_data.c | 106 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 26 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_node.c | 16 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_priv.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_readdir.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_sf.c | 2 |
10 files changed, 186 insertions, 137 deletions
diff --git a/fs/xfs/xfs_da_format.c b/fs/xfs/xfs_da_format.c index d0285fdfb6e7..1e92a241fd52 100644 --- a/fs/xfs/xfs_da_format.c +++ b/fs/xfs/xfs_da_format.c | |||
@@ -383,6 +383,58 @@ xfs_dir3_data_first_entry_p( | |||
383 | ((char *)hdr + xfs_dir3_data_first_offset()); | 383 | ((char *)hdr + xfs_dir3_data_first_offset()); |
384 | } | 384 | } |
385 | 385 | ||
386 | static struct xfs_dir2_data_free * | ||
387 | xfs_dir2_data_bestfree_p(struct xfs_dir2_data_hdr *hdr) | ||
388 | { | ||
389 | return hdr->bestfree; | ||
390 | } | ||
391 | |||
392 | static struct xfs_dir2_data_free * | ||
393 | xfs_dir3_data_bestfree_p(struct xfs_dir2_data_hdr *hdr) | ||
394 | { | ||
395 | return ((struct xfs_dir3_data_hdr *)hdr)->best_free; | ||
396 | } | ||
397 | |||
398 | static size_t | ||
399 | xfs_dir2_data_entry_offset(void) | ||
400 | { | ||
401 | return sizeof(struct xfs_dir2_data_hdr); | ||
402 | } | ||
403 | |||
404 | static struct xfs_dir2_data_entry * | ||
405 | xfs_dir2_data_entry_p(struct xfs_dir2_data_hdr *hdr) | ||
406 | { | ||
407 | return (struct xfs_dir2_data_entry *) | ||
408 | ((char *)hdr + xfs_dir2_data_entry_offset()); | ||
409 | } | ||
410 | |||
411 | static struct xfs_dir2_data_unused * | ||
412 | xfs_dir2_data_unused_p(struct xfs_dir2_data_hdr *hdr) | ||
413 | { | ||
414 | return (struct xfs_dir2_data_unused *) | ||
415 | ((char *)hdr + xfs_dir2_data_entry_offset()); | ||
416 | } | ||
417 | |||
418 | static size_t | ||
419 | xfs_dir3_data_entry_offset(void) | ||
420 | { | ||
421 | return sizeof(struct xfs_dir3_data_hdr); | ||
422 | } | ||
423 | |||
424 | static struct xfs_dir2_data_entry * | ||
425 | xfs_dir3_data_entry_p(struct xfs_dir2_data_hdr *hdr) | ||
426 | { | ||
427 | return (struct xfs_dir2_data_entry *) | ||
428 | ((char *)hdr + xfs_dir3_data_entry_offset()); | ||
429 | } | ||
430 | |||
431 | static struct xfs_dir2_data_unused * | ||
432 | xfs_dir3_data_unused_p(struct xfs_dir2_data_hdr *hdr) | ||
433 | { | ||
434 | return (struct xfs_dir2_data_unused *) | ||
435 | ((char *)hdr + xfs_dir3_data_entry_offset()); | ||
436 | } | ||
437 | |||
386 | const struct xfs_dir_ops xfs_dir2_ops = { | 438 | const struct xfs_dir_ops xfs_dir2_ops = { |
387 | .sf_entsize = xfs_dir2_sf_entsize, | 439 | .sf_entsize = xfs_dir2_sf_entsize, |
388 | .sf_nextentry = xfs_dir2_sf_nextentry, | 440 | .sf_nextentry = xfs_dir2_sf_nextentry, |
@@ -397,13 +449,19 @@ const struct xfs_dir_ops xfs_dir2_ops = { | |||
397 | .data_get_ftype = xfs_dir2_data_get_ftype, | 449 | .data_get_ftype = xfs_dir2_data_get_ftype, |
398 | .data_put_ftype = xfs_dir2_data_put_ftype, | 450 | .data_put_ftype = xfs_dir2_data_put_ftype, |
399 | .data_entry_tag_p = xfs_dir2_data_entry_tag_p, | 451 | .data_entry_tag_p = xfs_dir2_data_entry_tag_p, |
452 | .data_bestfree_p = xfs_dir2_data_bestfree_p, | ||
400 | 453 | ||
401 | .data_dot_offset = xfs_dir2_data_dot_offset, | 454 | .data_dot_offset = xfs_dir2_data_dot_offset, |
402 | .data_dotdot_offset = xfs_dir2_data_dotdot_offset, | 455 | .data_dotdot_offset = xfs_dir2_data_dotdot_offset, |
403 | .data_first_offset = xfs_dir2_data_first_offset, | 456 | .data_first_offset = xfs_dir2_data_first_offset, |
457 | .data_entry_offset = xfs_dir2_data_entry_offset, | ||
458 | |||
404 | .data_dot_entry_p = xfs_dir2_data_dot_entry_p, | 459 | .data_dot_entry_p = xfs_dir2_data_dot_entry_p, |
405 | .data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, | 460 | .data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, |
406 | .data_first_entry_p = xfs_dir2_data_first_entry_p, | 461 | .data_first_entry_p = xfs_dir2_data_first_entry_p, |
462 | .data_entry_p = xfs_dir2_data_entry_p, | ||
463 | .data_unused_p = xfs_dir2_data_unused_p, | ||
464 | |||
407 | }; | 465 | }; |
408 | 466 | ||
409 | const struct xfs_dir_ops xfs_dir2_ftype_ops = { | 467 | const struct xfs_dir_ops xfs_dir2_ftype_ops = { |
@@ -420,13 +478,18 @@ const struct xfs_dir_ops xfs_dir2_ftype_ops = { | |||
420 | .data_get_ftype = xfs_dir3_data_get_ftype, | 478 | .data_get_ftype = xfs_dir3_data_get_ftype, |
421 | .data_put_ftype = xfs_dir3_data_put_ftype, | 479 | .data_put_ftype = xfs_dir3_data_put_ftype, |
422 | .data_entry_tag_p = xfs_dir3_data_entry_tag_p, | 480 | .data_entry_tag_p = xfs_dir3_data_entry_tag_p, |
481 | .data_bestfree_p = xfs_dir2_data_bestfree_p, | ||
423 | 482 | ||
424 | .data_dot_offset = xfs_dir2_data_dot_offset, | 483 | .data_dot_offset = xfs_dir2_data_dot_offset, |
425 | .data_dotdot_offset = xfs_dir2_data_dotdot_offset, | 484 | .data_dotdot_offset = xfs_dir2_data_dotdot_offset, |
426 | .data_first_offset = xfs_dir2_data_first_offset, | 485 | .data_first_offset = xfs_dir2_data_first_offset, |
486 | .data_entry_offset = xfs_dir2_data_entry_offset, | ||
487 | |||
427 | .data_dot_entry_p = xfs_dir2_data_dot_entry_p, | 488 | .data_dot_entry_p = xfs_dir2_data_dot_entry_p, |
428 | .data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, | 489 | .data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, |
429 | .data_first_entry_p = xfs_dir2_data_first_entry_p, | 490 | .data_first_entry_p = xfs_dir2_data_first_entry_p, |
491 | .data_entry_p = xfs_dir2_data_entry_p, | ||
492 | .data_unused_p = xfs_dir2_data_unused_p, | ||
430 | }; | 493 | }; |
431 | 494 | ||
432 | const struct xfs_dir_ops xfs_dir3_ops = { | 495 | const struct xfs_dir_ops xfs_dir3_ops = { |
@@ -443,11 +506,16 @@ const struct xfs_dir_ops xfs_dir3_ops = { | |||
443 | .data_get_ftype = xfs_dir3_data_get_ftype, | 506 | .data_get_ftype = xfs_dir3_data_get_ftype, |
444 | .data_put_ftype = xfs_dir3_data_put_ftype, | 507 | .data_put_ftype = xfs_dir3_data_put_ftype, |
445 | .data_entry_tag_p = xfs_dir3_data_entry_tag_p, | 508 | .data_entry_tag_p = xfs_dir3_data_entry_tag_p, |
509 | .data_bestfree_p = xfs_dir3_data_bestfree_p, | ||
446 | 510 | ||
447 | .data_dot_offset = xfs_dir3_data_dot_offset, | 511 | .data_dot_offset = xfs_dir3_data_dot_offset, |
448 | .data_dotdot_offset = xfs_dir3_data_dotdot_offset, | 512 | .data_dotdot_offset = xfs_dir3_data_dotdot_offset, |
449 | .data_first_offset = xfs_dir3_data_first_offset, | 513 | .data_first_offset = xfs_dir3_data_first_offset, |
514 | .data_entry_offset = xfs_dir3_data_entry_offset, | ||
515 | |||
450 | .data_dot_entry_p = xfs_dir3_data_dot_entry_p, | 516 | .data_dot_entry_p = xfs_dir3_data_dot_entry_p, |
451 | .data_dotdot_entry_p = xfs_dir3_data_dotdot_entry_p, | 517 | .data_dotdot_entry_p = xfs_dir3_data_dotdot_entry_p, |
452 | .data_first_entry_p = xfs_dir3_data_first_entry_p, | 518 | .data_first_entry_p = xfs_dir3_data_first_entry_p, |
519 | .data_entry_p = xfs_dir3_data_entry_p, | ||
520 | .data_unused_p = xfs_dir3_data_unused_p, | ||
453 | }; | 521 | }; |
diff --git a/fs/xfs/xfs_da_format.h b/fs/xfs/xfs_da_format.h index 5b72dd2f8a69..aeca0038a013 100644 --- a/fs/xfs/xfs_da_format.h +++ b/fs/xfs/xfs_da_format.h | |||
@@ -412,17 +412,6 @@ struct xfs_dir3_data_hdr { | |||
412 | 412 | ||
413 | #define XFS_DIR3_DATA_CRC_OFF offsetof(struct xfs_dir3_data_hdr, hdr.crc) | 413 | #define XFS_DIR3_DATA_CRC_OFF offsetof(struct xfs_dir3_data_hdr, hdr.crc) |
414 | 414 | ||
415 | static inline struct xfs_dir2_data_free * | ||
416 | xfs_dir3_data_bestfree_p(struct xfs_dir2_data_hdr *hdr) | ||
417 | { | ||
418 | if (hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || | ||
419 | hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) { | ||
420 | struct xfs_dir3_data_hdr *hdr3 = (struct xfs_dir3_data_hdr *)hdr; | ||
421 | return hdr3->best_free; | ||
422 | } | ||
423 | return hdr->bestfree; | ||
424 | } | ||
425 | |||
426 | /* | 415 | /* |
427 | * Active entry in a data block. | 416 | * Active entry in a data block. |
428 | * | 417 | * |
@@ -465,36 +454,6 @@ xfs_dir2_data_unused_tag_p(struct xfs_dir2_data_unused *dup) | |||
465 | be16_to_cpu(dup->length) - sizeof(__be16)); | 454 | be16_to_cpu(dup->length) - sizeof(__be16)); |
466 | } | 455 | } |
467 | 456 | ||
468 | static inline size_t | ||
469 | xfs_dir3_data_hdr_size(bool dir3) | ||
470 | { | ||
471 | if (dir3) | ||
472 | return sizeof(struct xfs_dir3_data_hdr); | ||
473 | return sizeof(struct xfs_dir2_data_hdr); | ||
474 | } | ||
475 | |||
476 | static inline size_t | ||
477 | xfs_dir3_data_entry_offset(struct xfs_dir2_data_hdr *hdr) | ||
478 | { | ||
479 | bool dir3 = hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || | ||
480 | hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC); | ||
481 | return xfs_dir3_data_hdr_size(dir3); | ||
482 | } | ||
483 | |||
484 | static inline struct xfs_dir2_data_entry * | ||
485 | xfs_dir3_data_entry_p(struct xfs_dir2_data_hdr *hdr) | ||
486 | { | ||
487 | return (struct xfs_dir2_data_entry *) | ||
488 | ((char *)hdr + xfs_dir3_data_entry_offset(hdr)); | ||
489 | } | ||
490 | |||
491 | static inline struct xfs_dir2_data_unused * | ||
492 | xfs_dir3_data_unused_p(struct xfs_dir2_data_hdr *hdr) | ||
493 | { | ||
494 | return (struct xfs_dir2_data_unused *) | ||
495 | ((char *)hdr + xfs_dir3_data_entry_offset(hdr)); | ||
496 | } | ||
497 | |||
498 | /* | 457 | /* |
499 | * Leaf block structures. | 458 | * Leaf block structures. |
500 | * | 459 | * |
diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h index c0a45923cce0..076010a1376a 100644 --- a/fs/xfs/xfs_dir2.h +++ b/fs/xfs/xfs_dir2.h | |||
@@ -56,16 +56,24 @@ struct xfs_dir_ops { | |||
56 | void (*data_put_ftype)(struct xfs_dir2_data_entry *dep, | 56 | void (*data_put_ftype)(struct xfs_dir2_data_entry *dep, |
57 | __uint8_t ftype); | 57 | __uint8_t ftype); |
58 | __be16 * (*data_entry_tag_p)(struct xfs_dir2_data_entry *dep); | 58 | __be16 * (*data_entry_tag_p)(struct xfs_dir2_data_entry *dep); |
59 | struct xfs_dir2_data_free * | ||
60 | (*data_bestfree_p)(struct xfs_dir2_data_hdr *hdr); | ||
59 | 61 | ||
60 | xfs_dir2_data_aoff_t (*data_dot_offset)(void); | 62 | xfs_dir2_data_aoff_t (*data_dot_offset)(void); |
61 | xfs_dir2_data_aoff_t (*data_dotdot_offset)(void); | 63 | xfs_dir2_data_aoff_t (*data_dotdot_offset)(void); |
62 | xfs_dir2_data_aoff_t (*data_first_offset)(void); | 64 | xfs_dir2_data_aoff_t (*data_first_offset)(void); |
65 | size_t (*data_entry_offset)(void); | ||
66 | |||
63 | struct xfs_dir2_data_entry * | 67 | struct xfs_dir2_data_entry * |
64 | (*data_dot_entry_p)(struct xfs_dir2_data_hdr *hdr); | 68 | (*data_dot_entry_p)(struct xfs_dir2_data_hdr *hdr); |
65 | struct xfs_dir2_data_entry * | 69 | struct xfs_dir2_data_entry * |
66 | (*data_dotdot_entry_p)(struct xfs_dir2_data_hdr *hdr); | 70 | (*data_dotdot_entry_p)(struct xfs_dir2_data_hdr *hdr); |
67 | struct xfs_dir2_data_entry * | 71 | struct xfs_dir2_data_entry * |
68 | (*data_first_entry_p)(struct xfs_dir2_data_hdr *hdr); | 72 | (*data_first_entry_p)(struct xfs_dir2_data_hdr *hdr); |
73 | struct xfs_dir2_data_entry * | ||
74 | (*data_entry_p)(struct xfs_dir2_data_hdr *hdr); | ||
75 | struct xfs_dir2_data_unused * | ||
76 | (*data_unused_p)(struct xfs_dir2_data_hdr *hdr); | ||
69 | }; | 77 | }; |
70 | 78 | ||
71 | extern const struct xfs_dir_ops xfs_dir2_ops; | 79 | extern const struct xfs_dir_ops xfs_dir2_ops; |
@@ -115,19 +123,21 @@ extern void xfs_dir2_data_freescan(struct xfs_inode *dp, | |||
115 | struct xfs_dir2_data_hdr *hdr, int *loghead); | 123 | struct xfs_dir2_data_hdr *hdr, int *loghead); |
116 | extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_inode *dp, | 124 | extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_inode *dp, |
117 | struct xfs_buf *bp, struct xfs_dir2_data_entry *dep); | 125 | struct xfs_buf *bp, struct xfs_dir2_data_entry *dep); |
118 | extern void xfs_dir2_data_log_header(struct xfs_trans *tp, | 126 | extern void xfs_dir2_data_log_header(struct xfs_trans *tp, struct xfs_inode *dp, |
119 | struct xfs_buf *bp); | 127 | struct xfs_buf *bp); |
120 | extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_buf *bp, | 128 | extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_buf *bp, |
121 | struct xfs_dir2_data_unused *dup); | 129 | struct xfs_dir2_data_unused *dup); |
122 | extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_buf *bp, | 130 | extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_inode *dp, |
131 | struct xfs_buf *bp, xfs_dir2_data_aoff_t offset, | ||
132 | xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp); | ||
133 | extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_inode *dp, | ||
134 | struct xfs_buf *bp, struct xfs_dir2_data_unused *dup, | ||
123 | xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len, | 135 | xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len, |
124 | int *needlogp, int *needscanp); | 136 | int *needlogp, int *needscanp); |
125 | extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_buf *bp, | ||
126 | struct xfs_dir2_data_unused *dup, xfs_dir2_data_aoff_t offset, | ||
127 | xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp); | ||
128 | 137 | ||
129 | extern struct xfs_dir2_data_free *xfs_dir2_data_freefind( | 138 | extern struct xfs_dir2_data_free *xfs_dir2_data_freefind( |
130 | struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_unused *dup); | 139 | struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_free *bf, |
140 | struct xfs_dir2_data_unused *dup); | ||
131 | 141 | ||
132 | extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; | 142 | extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; |
133 | extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops; | 143 | extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops; |
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c index 507ef6a7d1f9..f92ca5699342 100644 --- a/fs/xfs/xfs_dir2_block.c +++ b/fs/xfs/xfs_dir2_block.c | |||
@@ -168,6 +168,7 @@ xfs_dir3_block_init( | |||
168 | 168 | ||
169 | static void | 169 | static void |
170 | xfs_dir2_block_need_space( | 170 | xfs_dir2_block_need_space( |
171 | struct xfs_inode *dp, | ||
171 | struct xfs_dir2_data_hdr *hdr, | 172 | struct xfs_dir2_data_hdr *hdr, |
172 | struct xfs_dir2_block_tail *btp, | 173 | struct xfs_dir2_block_tail *btp, |
173 | struct xfs_dir2_leaf_entry *blp, | 174 | struct xfs_dir2_leaf_entry *blp, |
@@ -183,7 +184,7 @@ xfs_dir2_block_need_space( | |||
183 | struct xfs_dir2_data_unused *enddup = NULL; | 184 | struct xfs_dir2_data_unused *enddup = NULL; |
184 | 185 | ||
185 | *compact = 0; | 186 | *compact = 0; |
186 | bf = xfs_dir3_data_bestfree_p(hdr); | 187 | bf = dp->d_ops->data_bestfree_p(hdr); |
187 | 188 | ||
188 | /* | 189 | /* |
189 | * If there are stale entries we'll use one for the leaf. | 190 | * If there are stale entries we'll use one for the leaf. |
@@ -313,7 +314,7 @@ xfs_dir2_block_compact( | |||
313 | *lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1); | 314 | *lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1); |
314 | *lfloghigh -= be32_to_cpu(btp->stale) - 1; | 315 | *lfloghigh -= be32_to_cpu(btp->stale) - 1; |
315 | be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1)); | 316 | be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1)); |
316 | xfs_dir2_data_make_free(tp, bp, | 317 | xfs_dir2_data_make_free(tp, dp, bp, |
317 | (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), | 318 | (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), |
318 | (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)), |
319 | needlog, &needscan); | 320 | needlog, &needscan); |
@@ -383,7 +384,7 @@ xfs_dir2_block_addname( | |||
383 | * Find out if we can reuse stale entries or whether we need extra | 384 | * Find out if we can reuse stale entries or whether we need extra |
384 | * space for entry and new leaf. | 385 | * space for entry and new leaf. |
385 | */ | 386 | */ |
386 | xfs_dir2_block_need_space(hdr, btp, blp, &tagp, &dup, | 387 | xfs_dir2_block_need_space(dp, hdr, btp, blp, &tagp, &dup, |
387 | &enddup, &compact, len); | 388 | &enddup, &compact, len); |
388 | 389 | ||
389 | /* | 390 | /* |
@@ -454,7 +455,7 @@ xfs_dir2_block_addname( | |||
454 | /* | 455 | /* |
455 | * Mark the space needed for the new leaf entry, now in use. | 456 | * Mark the space needed for the new leaf entry, now in use. |
456 | */ | 457 | */ |
457 | xfs_dir2_data_use_free(tp, bp, enddup, | 458 | xfs_dir2_data_use_free(tp, dp, bp, enddup, |
458 | (xfs_dir2_data_aoff_t) | 459 | (xfs_dir2_data_aoff_t) |
459 | ((char *)enddup - (char *)hdr + be16_to_cpu(enddup->length) - | 460 | ((char *)enddup - (char *)hdr + be16_to_cpu(enddup->length) - |
460 | sizeof(*blp)), | 461 | sizeof(*blp)), |
@@ -541,7 +542,7 @@ xfs_dir2_block_addname( | |||
541 | /* | 542 | /* |
542 | * Mark space for the data entry used. | 543 | * Mark space for the data entry used. |
543 | */ | 544 | */ |
544 | xfs_dir2_data_use_free(tp, bp, dup, | 545 | xfs_dir2_data_use_free(tp, dp, bp, dup, |
545 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), | 546 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), |
546 | (xfs_dir2_data_aoff_t)len, &needlog, &needscan); | 547 | (xfs_dir2_data_aoff_t)len, &needlog, &needscan); |
547 | /* | 548 | /* |
@@ -559,7 +560,7 @@ xfs_dir2_block_addname( | |||
559 | if (needscan) | 560 | if (needscan) |
560 | xfs_dir2_data_freescan(dp, hdr, &needlog); | 561 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
561 | if (needlog) | 562 | if (needlog) |
562 | xfs_dir2_data_log_header(tp, bp); | 563 | xfs_dir2_data_log_header(tp, dp, bp); |
563 | xfs_dir2_block_log_tail(tp, bp); | 564 | xfs_dir2_block_log_tail(tp, bp); |
564 | xfs_dir2_data_log_entry(tp, dp, bp, dep); | 565 | xfs_dir2_data_log_entry(tp, dp, bp, dep); |
565 | xfs_dir3_data_check(dp, bp); | 566 | xfs_dir3_data_check(dp, bp); |
@@ -800,7 +801,7 @@ xfs_dir2_block_removename( | |||
800 | * Mark the data entry's space free. | 801 | * Mark the data entry's space free. |
801 | */ | 802 | */ |
802 | needlog = needscan = 0; | 803 | needlog = needscan = 0; |
803 | xfs_dir2_data_make_free(tp, bp, | 804 | xfs_dir2_data_make_free(tp, dp, bp, |
804 | (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), | 805 | (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), |
805 | dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); | 806 | dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); |
806 | /* | 807 | /* |
@@ -819,7 +820,7 @@ xfs_dir2_block_removename( | |||
819 | if (needscan) | 820 | if (needscan) |
820 | xfs_dir2_data_freescan(dp, hdr, &needlog); | 821 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
821 | if (needlog) | 822 | if (needlog) |
822 | xfs_dir2_data_log_header(tp, bp); | 823 | xfs_dir2_data_log_header(tp, dp, bp); |
823 | xfs_dir3_data_check(dp, bp); | 824 | xfs_dir3_data_check(dp, bp); |
824 | /* | 825 | /* |
825 | * See if the size as a shortform is good enough. | 826 | * See if the size as a shortform is good enough. |
@@ -950,7 +951,7 @@ xfs_dir2_leaf_to_block( | |||
950 | while (dp->i_d.di_size > mp->m_dirblksize) { | 951 | while (dp->i_d.di_size > mp->m_dirblksize) { |
951 | int hdrsz; | 952 | int hdrsz; |
952 | 953 | ||
953 | hdrsz = xfs_dir3_data_hdr_size(xfs_sb_version_hascrc(&mp->m_sb)); | 954 | hdrsz = dp->d_ops->data_entry_offset(); |
954 | bestsp = xfs_dir2_leaf_bests_p(ltp); | 955 | bestsp = xfs_dir2_leaf_bests_p(ltp); |
955 | if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 1]) == | 956 | if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 1]) == |
956 | mp->m_dirblksize - hdrsz) { | 957 | mp->m_dirblksize - hdrsz) { |
@@ -1000,7 +1001,7 @@ xfs_dir2_leaf_to_block( | |||
1000 | /* | 1001 | /* |
1001 | * Use up the space at the end of the block (blp/btp). | 1002 | * Use up the space at the end of the block (blp/btp). |
1002 | */ | 1003 | */ |
1003 | xfs_dir2_data_use_free(tp, dbp, dup, mp->m_dirblksize - size, size, | 1004 | xfs_dir2_data_use_free(tp, dp, dbp, dup, mp->m_dirblksize - size, size, |
1004 | &needlog, &needscan); | 1005 | &needlog, &needscan); |
1005 | /* | 1006 | /* |
1006 | * Initialize the block tail. | 1007 | * Initialize the block tail. |
@@ -1026,7 +1027,7 @@ xfs_dir2_leaf_to_block( | |||
1026 | if (needscan) | 1027 | if (needscan) |
1027 | xfs_dir2_data_freescan(dp, hdr, &needlog); | 1028 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
1028 | if (needlog) | 1029 | if (needlog) |
1029 | xfs_dir2_data_log_header(tp, dbp); | 1030 | xfs_dir2_data_log_header(tp, dp, dbp); |
1030 | /* | 1031 | /* |
1031 | * Pitch the old leaf block. | 1032 | * Pitch the old leaf block. |
1032 | */ | 1033 | */ |
@@ -1137,9 +1138,9 @@ xfs_dir2_sf_to_block( | |||
1137 | * The whole thing is initialized to free by the init routine. | 1138 | * The whole thing is initialized to free by the init routine. |
1138 | * Say we're using the leaf and tail area. | 1139 | * Say we're using the leaf and tail area. |
1139 | */ | 1140 | */ |
1140 | dup = xfs_dir3_data_unused_p(hdr); | 1141 | dup = dp->d_ops->data_unused_p(hdr); |
1141 | needlog = needscan = 0; | 1142 | needlog = needscan = 0; |
1142 | xfs_dir2_data_use_free(tp, bp, dup, mp->m_dirblksize - i, i, &needlog, | 1143 | xfs_dir2_data_use_free(tp, dp, bp, dup, mp->m_dirblksize - i, i, &needlog, |
1143 | &needscan); | 1144 | &needscan); |
1144 | ASSERT(needscan == 0); | 1145 | ASSERT(needscan == 0); |
1145 | /* | 1146 | /* |
@@ -1153,7 +1154,7 @@ xfs_dir2_sf_to_block( | |||
1153 | /* | 1154 | /* |
1154 | * Remove the freespace, we'll manage it. | 1155 | * Remove the freespace, we'll manage it. |
1155 | */ | 1156 | */ |
1156 | xfs_dir2_data_use_free(tp, bp, dup, | 1157 | xfs_dir2_data_use_free(tp, dp, bp, dup, |
1157 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), | 1158 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), |
1158 | be16_to_cpu(dup->length), &needlog, &needscan); | 1159 | be16_to_cpu(dup->length), &needlog, &needscan); |
1159 | /* | 1160 | /* |
@@ -1215,7 +1216,9 @@ xfs_dir2_sf_to_block( | |||
1215 | *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16( | 1216 | *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16( |
1216 | ((char *)dup - (char *)hdr)); | 1217 | ((char *)dup - (char *)hdr)); |
1217 | xfs_dir2_data_log_unused(tp, bp, dup); | 1218 | xfs_dir2_data_log_unused(tp, bp, dup); |
1218 | xfs_dir2_data_freeinsert(hdr, dup, &dummy); | 1219 | xfs_dir2_data_freeinsert(hdr, |
1220 | dp->d_ops->data_bestfree_p(hdr), | ||
1221 | dup, &dummy); | ||
1219 | offset += be16_to_cpu(dup->length); | 1222 | offset += be16_to_cpu(dup->length); |
1220 | continue; | 1223 | continue; |
1221 | } | 1224 | } |
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c index 00006b3db054..13fa0d6b4ff7 100644 --- a/fs/xfs/xfs_dir2_data.c +++ b/fs/xfs/xfs_dir2_data.c | |||
@@ -66,8 +66,6 @@ __xfs_dir3_data_check( | |||
66 | 66 | ||
67 | mp = bp->b_target->bt_mount; | 67 | mp = bp->b_target->bt_mount; |
68 | hdr = bp->b_addr; | 68 | hdr = bp->b_addr; |
69 | bf = xfs_dir3_data_bestfree_p(hdr); | ||
70 | p = (char *)xfs_dir3_data_entry_p(hdr); | ||
71 | 69 | ||
72 | /* | 70 | /* |
73 | * We can be passed a null dp here from a verifier, so manually | 71 | * We can be passed a null dp here from a verifier, so manually |
@@ -97,6 +95,8 @@ __xfs_dir3_data_check( | |||
97 | XFS_ERROR_REPORT("Bad Magic", XFS_ERRLEVEL_LOW, mp); | 95 | XFS_ERROR_REPORT("Bad Magic", XFS_ERRLEVEL_LOW, mp); |
98 | return EFSCORRUPTED; | 96 | return EFSCORRUPTED; |
99 | } | 97 | } |
98 | bf = ops->data_bestfree_p(hdr); | ||
99 | p = (char *)ops->data_entry_p(hdr); | ||
100 | 100 | ||
101 | count = lastfree = freeseen = 0; | 101 | count = lastfree = freeseen = 0; |
102 | /* | 102 | /* |
@@ -134,7 +134,7 @@ __xfs_dir3_data_check( | |||
134 | XFS_WANT_CORRUPTED_RETURN( | 134 | XFS_WANT_CORRUPTED_RETURN( |
135 | be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) == | 135 | be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) == |
136 | (char *)dup - (char *)hdr); | 136 | (char *)dup - (char *)hdr); |
137 | dfp = xfs_dir2_data_freefind(hdr, dup); | 137 | dfp = xfs_dir2_data_freefind(hdr, bf, dup); |
138 | if (dfp) { | 138 | if (dfp) { |
139 | i = (int)(dfp - bf); | 139 | i = (int)(dfp - bf); |
140 | XFS_WANT_CORRUPTED_RETURN( | 140 | XFS_WANT_CORRUPTED_RETURN( |
@@ -340,19 +340,18 @@ xfs_dir3_data_readahead( | |||
340 | */ | 340 | */ |
341 | xfs_dir2_data_free_t * | 341 | xfs_dir2_data_free_t * |
342 | xfs_dir2_data_freefind( | 342 | xfs_dir2_data_freefind( |
343 | xfs_dir2_data_hdr_t *hdr, /* data block */ | 343 | struct xfs_dir2_data_hdr *hdr, /* data block header */ |
344 | xfs_dir2_data_unused_t *dup) /* data unused entry */ | 344 | struct xfs_dir2_data_free *bf, /* bestfree table pointer */ |
345 | struct xfs_dir2_data_unused *dup) /* unused space */ | ||
345 | { | 346 | { |
346 | xfs_dir2_data_free_t *dfp; /* bestfree entry */ | 347 | xfs_dir2_data_free_t *dfp; /* bestfree entry */ |
347 | xfs_dir2_data_aoff_t off; /* offset value needed */ | 348 | xfs_dir2_data_aoff_t off; /* offset value needed */ |
348 | struct xfs_dir2_data_free *bf; | ||
349 | #ifdef DEBUG | 349 | #ifdef DEBUG |
350 | int matched; /* matched the value */ | 350 | int matched; /* matched the value */ |
351 | int seenzero; /* saw a 0 bestfree entry */ | 351 | int seenzero; /* saw a 0 bestfree entry */ |
352 | #endif | 352 | #endif |
353 | 353 | ||
354 | off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr); | 354 | off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr); |
355 | bf = xfs_dir3_data_bestfree_p(hdr); | ||
356 | 355 | ||
357 | #ifdef DEBUG | 356 | #ifdef DEBUG |
358 | /* | 357 | /* |
@@ -412,11 +411,11 @@ xfs_dir2_data_freefind( | |||
412 | */ | 411 | */ |
413 | xfs_dir2_data_free_t * /* entry inserted */ | 412 | xfs_dir2_data_free_t * /* entry inserted */ |
414 | xfs_dir2_data_freeinsert( | 413 | xfs_dir2_data_freeinsert( |
415 | xfs_dir2_data_hdr_t *hdr, /* data block pointer */ | 414 | struct xfs_dir2_data_hdr *hdr, /* data block pointer */ |
416 | xfs_dir2_data_unused_t *dup, /* unused space */ | 415 | struct xfs_dir2_data_free *dfp, /* bestfree table pointer */ |
416 | struct xfs_dir2_data_unused *dup, /* unused space */ | ||
417 | int *loghead) /* log the data header (out) */ | 417 | int *loghead) /* log the data header (out) */ |
418 | { | 418 | { |
419 | xfs_dir2_data_free_t *dfp; /* bestfree table pointer */ | ||
420 | xfs_dir2_data_free_t new; /* new bestfree entry */ | 419 | xfs_dir2_data_free_t new; /* new bestfree entry */ |
421 | 420 | ||
422 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || | 421 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
@@ -424,7 +423,6 @@ xfs_dir2_data_freeinsert( | |||
424 | hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || | 423 | hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || |
425 | hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); | 424 | hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); |
426 | 425 | ||
427 | dfp = xfs_dir3_data_bestfree_p(hdr); | ||
428 | new.length = dup->length; | 426 | new.length = dup->length; |
429 | new.offset = cpu_to_be16((char *)dup - (char *)hdr); | 427 | new.offset = cpu_to_be16((char *)dup - (char *)hdr); |
430 | 428 | ||
@@ -457,11 +455,11 @@ xfs_dir2_data_freeinsert( | |||
457 | */ | 455 | */ |
458 | STATIC void | 456 | STATIC void |
459 | xfs_dir2_data_freeremove( | 457 | xfs_dir2_data_freeremove( |
460 | xfs_dir2_data_hdr_t *hdr, /* data block header */ | 458 | struct xfs_dir2_data_hdr *hdr, /* data block header */ |
461 | xfs_dir2_data_free_t *dfp, /* bestfree entry pointer */ | 459 | struct xfs_dir2_data_free *bf, /* bestfree table pointer */ |
460 | struct xfs_dir2_data_free *dfp, /* bestfree entry pointer */ | ||
462 | int *loghead) /* out: log data header */ | 461 | int *loghead) /* out: log data header */ |
463 | { | 462 | { |
464 | struct xfs_dir2_data_free *bf; | ||
465 | 463 | ||
466 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || | 464 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
467 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || | 465 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || |
@@ -471,7 +469,6 @@ xfs_dir2_data_freeremove( | |||
471 | /* | 469 | /* |
472 | * It's the first entry, slide the next 2 up. | 470 | * It's the first entry, slide the next 2 up. |
473 | */ | 471 | */ |
474 | bf = xfs_dir3_data_bestfree_p(hdr); | ||
475 | if (dfp == &bf[0]) { | 472 | if (dfp == &bf[0]) { |
476 | bf[0] = bf[1]; | 473 | bf[0] = bf[1]; |
477 | bf[1] = bf[2]; | 474 | bf[1] = bf[2]; |
@@ -518,13 +515,13 @@ xfs_dir2_data_freescan( | |||
518 | /* | 515 | /* |
519 | * Start by clearing the table. | 516 | * Start by clearing the table. |
520 | */ | 517 | */ |
521 | bf = xfs_dir3_data_bestfree_p(hdr); | 518 | bf = dp->d_ops->data_bestfree_p(hdr); |
522 | memset(bf, 0, sizeof(*bf) * XFS_DIR2_DATA_FD_COUNT); | 519 | memset(bf, 0, sizeof(*bf) * XFS_DIR2_DATA_FD_COUNT); |
523 | *loghead = 1; | 520 | *loghead = 1; |
524 | /* | 521 | /* |
525 | * Set up pointers. | 522 | * Set up pointers. |
526 | */ | 523 | */ |
527 | p = (char *)xfs_dir3_data_entry_p(hdr); | 524 | p = (char *)dp->d_ops->data_entry_p(hdr); |
528 | if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || | 525 | if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || |
529 | hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) { | 526 | hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) { |
530 | btp = xfs_dir2_block_tail_p(dp->i_mount, hdr); | 527 | btp = xfs_dir2_block_tail_p(dp->i_mount, hdr); |
@@ -542,7 +539,7 @@ xfs_dir2_data_freescan( | |||
542 | if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { | 539 | if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { |
543 | ASSERT((char *)dup - (char *)hdr == | 540 | ASSERT((char *)dup - (char *)hdr == |
544 | be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup))); | 541 | be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup))); |
545 | xfs_dir2_data_freeinsert(hdr, dup, loghead); | 542 | xfs_dir2_data_freeinsert(hdr, bf, dup, loghead); |
546 | p += be16_to_cpu(dup->length); | 543 | p += be16_to_cpu(dup->length); |
547 | } | 544 | } |
548 | /* | 545 | /* |
@@ -607,8 +604,8 @@ xfs_dir3_data_init( | |||
607 | } else | 604 | } else |
608 | hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC); | 605 | hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC); |
609 | 606 | ||
610 | bf = xfs_dir3_data_bestfree_p(hdr); | 607 | bf = dp->d_ops->data_bestfree_p(hdr); |
611 | bf[0].offset = cpu_to_be16(xfs_dir3_data_entry_offset(hdr)); | 608 | bf[0].offset = cpu_to_be16(dp->d_ops->data_entry_offset()); |
612 | for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) { | 609 | for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) { |
613 | bf[i].length = 0; | 610 | bf[i].length = 0; |
614 | bf[i].offset = 0; | 611 | bf[i].offset = 0; |
@@ -617,17 +614,17 @@ xfs_dir3_data_init( | |||
617 | /* | 614 | /* |
618 | * Set up an unused entry for the block's body. | 615 | * Set up an unused entry for the block's body. |
619 | */ | 616 | */ |
620 | dup = xfs_dir3_data_unused_p(hdr); | 617 | dup = dp->d_ops->data_unused_p(hdr); |
621 | dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); | 618 | dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); |
622 | 619 | ||
623 | t = mp->m_dirblksize - (uint)xfs_dir3_data_entry_offset(hdr); | 620 | t = mp->m_dirblksize - (uint)dp->d_ops->data_entry_offset(); |
624 | bf[0].length = cpu_to_be16(t); | 621 | bf[0].length = cpu_to_be16(t); |
625 | dup->length = cpu_to_be16(t); | 622 | dup->length = cpu_to_be16(t); |
626 | *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16((char *)dup - (char *)hdr); | 623 | *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16((char *)dup - (char *)hdr); |
627 | /* | 624 | /* |
628 | * Log it and return it. | 625 | * Log it and return it. |
629 | */ | 626 | */ |
630 | xfs_dir2_data_log_header(tp, bp); | 627 | xfs_dir2_data_log_header(tp, dp, bp); |
631 | xfs_dir2_data_log_unused(tp, bp, dup); | 628 | xfs_dir2_data_log_unused(tp, bp, dup); |
632 | *bpp = bp; | 629 | *bpp = bp; |
633 | return 0; | 630 | return 0; |
@@ -661,16 +658,19 @@ xfs_dir2_data_log_entry( | |||
661 | void | 658 | void |
662 | xfs_dir2_data_log_header( | 659 | xfs_dir2_data_log_header( |
663 | struct xfs_trans *tp, | 660 | struct xfs_trans *tp, |
661 | struct xfs_inode *dp, | ||
664 | struct xfs_buf *bp) | 662 | struct xfs_buf *bp) |
665 | { | 663 | { |
666 | xfs_dir2_data_hdr_t *hdr = bp->b_addr; | 664 | #ifdef DEBUG |
665 | struct xfs_dir2_data_hdr *hdr = bp->b_addr; | ||
667 | 666 | ||
668 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || | 667 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
669 | hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || | 668 | hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || |
670 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || | 669 | hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || |
671 | hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); | 670 | hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); |
671 | #endif | ||
672 | 672 | ||
673 | xfs_trans_log_buf(tp, bp, 0, xfs_dir3_data_entry_offset(hdr) - 1); | 673 | xfs_trans_log_buf(tp, bp, 0, dp->d_ops->data_entry_offset() - 1); |
674 | } | 674 | } |
675 | 675 | ||
676 | /* | 676 | /* |
@@ -711,6 +711,7 @@ xfs_dir2_data_log_unused( | |||
711 | void | 711 | void |
712 | xfs_dir2_data_make_free( | 712 | xfs_dir2_data_make_free( |
713 | struct xfs_trans *tp, | 713 | struct xfs_trans *tp, |
714 | struct xfs_inode *dp, | ||
714 | struct xfs_buf *bp, | 715 | struct xfs_buf *bp, |
715 | xfs_dir2_data_aoff_t offset, /* starting byte offset */ | 716 | xfs_dir2_data_aoff_t offset, /* starting byte offset */ |
716 | xfs_dir2_data_aoff_t len, /* length in bytes */ | 717 | xfs_dir2_data_aoff_t len, /* length in bytes */ |
@@ -748,7 +749,7 @@ xfs_dir2_data_make_free( | |||
748 | * If this isn't the start of the block, then back up to | 749 | * If this isn't the start of the block, then back up to |
749 | * the previous entry and see if it's free. | 750 | * the previous entry and see if it's free. |
750 | */ | 751 | */ |
751 | if (offset > xfs_dir3_data_entry_offset(hdr)) { | 752 | if (offset > dp->d_ops->data_entry_offset()) { |
752 | __be16 *tagp; /* tag just before us */ | 753 | __be16 *tagp; /* tag just before us */ |
753 | 754 | ||
754 | tagp = (__be16 *)((char *)hdr + offset) - 1; | 755 | tagp = (__be16 *)((char *)hdr + offset) - 1; |
@@ -774,15 +775,15 @@ xfs_dir2_data_make_free( | |||
774 | * Previous and following entries are both free, | 775 | * Previous and following entries are both free, |
775 | * merge everything into a single free entry. | 776 | * merge everything into a single free entry. |
776 | */ | 777 | */ |
777 | bf = xfs_dir3_data_bestfree_p(hdr); | 778 | bf = dp->d_ops->data_bestfree_p(hdr); |
778 | if (prevdup && postdup) { | 779 | if (prevdup && postdup) { |
779 | xfs_dir2_data_free_t *dfp2; /* another bestfree pointer */ | 780 | xfs_dir2_data_free_t *dfp2; /* another bestfree pointer */ |
780 | 781 | ||
781 | /* | 782 | /* |
782 | * See if prevdup and/or postdup are in bestfree table. | 783 | * See if prevdup and/or postdup are in bestfree table. |
783 | */ | 784 | */ |
784 | dfp = xfs_dir2_data_freefind(hdr, prevdup); | 785 | dfp = xfs_dir2_data_freefind(hdr, bf, prevdup); |
785 | dfp2 = xfs_dir2_data_freefind(hdr, postdup); | 786 | dfp2 = xfs_dir2_data_freefind(hdr, bf, postdup); |
786 | /* | 787 | /* |
787 | * We need a rescan unless there are exactly 2 free entries | 788 | * We need a rescan unless there are exactly 2 free entries |
788 | * namely our two. Then we know what's happening, otherwise | 789 | * namely our two. Then we know what's happening, otherwise |
@@ -810,12 +811,13 @@ xfs_dir2_data_make_free( | |||
810 | ASSERT(dfp2 == dfp); | 811 | ASSERT(dfp2 == dfp); |
811 | dfp2 = &bf[1]; | 812 | dfp2 = &bf[1]; |
812 | } | 813 | } |
813 | xfs_dir2_data_freeremove(hdr, dfp2, needlogp); | 814 | xfs_dir2_data_freeremove(hdr, bf, dfp2, needlogp); |
814 | xfs_dir2_data_freeremove(hdr, dfp, needlogp); | 815 | xfs_dir2_data_freeremove(hdr, bf, dfp, needlogp); |
815 | /* | 816 | /* |
816 | * Now insert the new entry. | 817 | * Now insert the new entry. |
817 | */ | 818 | */ |
818 | dfp = xfs_dir2_data_freeinsert(hdr, prevdup, needlogp); | 819 | dfp = xfs_dir2_data_freeinsert(hdr, bf, prevdup, |
820 | needlogp); | ||
819 | ASSERT(dfp == &bf[0]); | 821 | ASSERT(dfp == &bf[0]); |
820 | ASSERT(dfp->length == prevdup->length); | 822 | ASSERT(dfp->length == prevdup->length); |
821 | ASSERT(!dfp[1].length); | 823 | ASSERT(!dfp[1].length); |
@@ -826,7 +828,7 @@ xfs_dir2_data_make_free( | |||
826 | * The entry before us is free, merge with it. | 828 | * The entry before us is free, merge with it. |
827 | */ | 829 | */ |
828 | else if (prevdup) { | 830 | else if (prevdup) { |
829 | dfp = xfs_dir2_data_freefind(hdr, prevdup); | 831 | dfp = xfs_dir2_data_freefind(hdr, bf, prevdup); |
830 | be16_add_cpu(&prevdup->length, len); | 832 | be16_add_cpu(&prevdup->length, len); |
831 | *xfs_dir2_data_unused_tag_p(prevdup) = | 833 | *xfs_dir2_data_unused_tag_p(prevdup) = |
832 | cpu_to_be16((char *)prevdup - (char *)hdr); | 834 | cpu_to_be16((char *)prevdup - (char *)hdr); |
@@ -837,8 +839,8 @@ xfs_dir2_data_make_free( | |||
837 | * the old one and add the new one. | 839 | * the old one and add the new one. |
838 | */ | 840 | */ |
839 | if (dfp) { | 841 | if (dfp) { |
840 | xfs_dir2_data_freeremove(hdr, dfp, needlogp); | 842 | xfs_dir2_data_freeremove(hdr, bf, dfp, needlogp); |
841 | xfs_dir2_data_freeinsert(hdr, prevdup, needlogp); | 843 | xfs_dir2_data_freeinsert(hdr, bf, prevdup, needlogp); |
842 | } | 844 | } |
843 | /* | 845 | /* |
844 | * Otherwise we need a scan if the new entry is big enough. | 846 | * Otherwise we need a scan if the new entry is big enough. |
@@ -852,7 +854,7 @@ xfs_dir2_data_make_free( | |||
852 | * The following entry is free, merge with it. | 854 | * The following entry is free, merge with it. |
853 | */ | 855 | */ |
854 | else if (postdup) { | 856 | else if (postdup) { |
855 | dfp = xfs_dir2_data_freefind(hdr, postdup); | 857 | dfp = xfs_dir2_data_freefind(hdr, bf, postdup); |
856 | newdup = (xfs_dir2_data_unused_t *)((char *)hdr + offset); | 858 | newdup = (xfs_dir2_data_unused_t *)((char *)hdr + offset); |
857 | newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); | 859 | newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); |
858 | newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length)); | 860 | newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length)); |
@@ -865,8 +867,8 @@ xfs_dir2_data_make_free( | |||
865 | * the old one and add the new one. | 867 | * the old one and add the new one. |
866 | */ | 868 | */ |
867 | if (dfp) { | 869 | if (dfp) { |
868 | xfs_dir2_data_freeremove(hdr, dfp, needlogp); | 870 | xfs_dir2_data_freeremove(hdr, bf, dfp, needlogp); |
869 | xfs_dir2_data_freeinsert(hdr, newdup, needlogp); | 871 | xfs_dir2_data_freeinsert(hdr, bf, newdup, needlogp); |
870 | } | 872 | } |
871 | /* | 873 | /* |
872 | * Otherwise we need a scan if the new entry is big enough. | 874 | * Otherwise we need a scan if the new entry is big enough. |
@@ -886,7 +888,7 @@ xfs_dir2_data_make_free( | |||
886 | *xfs_dir2_data_unused_tag_p(newdup) = | 888 | *xfs_dir2_data_unused_tag_p(newdup) = |
887 | cpu_to_be16((char *)newdup - (char *)hdr); | 889 | cpu_to_be16((char *)newdup - (char *)hdr); |
888 | xfs_dir2_data_log_unused(tp, bp, newdup); | 890 | xfs_dir2_data_log_unused(tp, bp, newdup); |
889 | xfs_dir2_data_freeinsert(hdr, newdup, needlogp); | 891 | xfs_dir2_data_freeinsert(hdr, bf, newdup, needlogp); |
890 | } | 892 | } |
891 | *needscanp = needscan; | 893 | *needscanp = needscan; |
892 | } | 894 | } |
@@ -897,6 +899,7 @@ xfs_dir2_data_make_free( | |||
897 | void | 899 | void |
898 | xfs_dir2_data_use_free( | 900 | xfs_dir2_data_use_free( |
899 | struct xfs_trans *tp, | 901 | struct xfs_trans *tp, |
902 | struct xfs_inode *dp, | ||
900 | struct xfs_buf *bp, | 903 | struct xfs_buf *bp, |
901 | xfs_dir2_data_unused_t *dup, /* unused entry */ | 904 | xfs_dir2_data_unused_t *dup, /* unused entry */ |
902 | xfs_dir2_data_aoff_t offset, /* starting offset to use */ | 905 | xfs_dir2_data_aoff_t offset, /* starting offset to use */ |
@@ -926,9 +929,9 @@ xfs_dir2_data_use_free( | |||
926 | /* | 929 | /* |
927 | * Look up the entry in the bestfree table. | 930 | * Look up the entry in the bestfree table. |
928 | */ | 931 | */ |
929 | dfp = xfs_dir2_data_freefind(hdr, dup); | ||
930 | oldlen = be16_to_cpu(dup->length); | 932 | oldlen = be16_to_cpu(dup->length); |
931 | bf = xfs_dir3_data_bestfree_p(hdr); | 933 | bf = dp->d_ops->data_bestfree_p(hdr); |
934 | dfp = xfs_dir2_data_freefind(hdr, bf, dup); | ||
932 | ASSERT(dfp || oldlen <= be16_to_cpu(bf[2].length)); | 935 | ASSERT(dfp || oldlen <= be16_to_cpu(bf[2].length)); |
933 | /* | 936 | /* |
934 | * Check for alignment with front and back of the entry. | 937 | * Check for alignment with front and back of the entry. |
@@ -945,7 +948,8 @@ xfs_dir2_data_use_free( | |||
945 | if (dfp) { | 948 | if (dfp) { |
946 | needscan = (bf[2].offset != 0); | 949 | needscan = (bf[2].offset != 0); |
947 | if (!needscan) | 950 | if (!needscan) |
948 | xfs_dir2_data_freeremove(hdr, dfp, needlogp); | 951 | xfs_dir2_data_freeremove(hdr, bf, dfp, |
952 | needlogp); | ||
949 | } | 953 | } |
950 | } | 954 | } |
951 | /* | 955 | /* |
@@ -963,8 +967,9 @@ xfs_dir2_data_use_free( | |||
963 | * If it was in the table, remove it and add the new one. | 967 | * If it was in the table, remove it and add the new one. |
964 | */ | 968 | */ |
965 | if (dfp) { | 969 | if (dfp) { |
966 | xfs_dir2_data_freeremove(hdr, dfp, needlogp); | 970 | xfs_dir2_data_freeremove(hdr, bf, dfp, needlogp); |
967 | dfp = xfs_dir2_data_freeinsert(hdr, newdup, needlogp); | 971 | dfp = xfs_dir2_data_freeinsert(hdr, bf, newdup, |
972 | needlogp); | ||
968 | ASSERT(dfp != NULL); | 973 | ASSERT(dfp != NULL); |
969 | ASSERT(dfp->length == newdup->length); | 974 | ASSERT(dfp->length == newdup->length); |
970 | ASSERT(be16_to_cpu(dfp->offset) == (char *)newdup - (char *)hdr); | 975 | ASSERT(be16_to_cpu(dfp->offset) == (char *)newdup - (char *)hdr); |
@@ -990,8 +995,9 @@ xfs_dir2_data_use_free( | |||
990 | * If it was in the table, remove it and add the new one. | 995 | * If it was in the table, remove it and add the new one. |
991 | */ | 996 | */ |
992 | if (dfp) { | 997 | if (dfp) { |
993 | xfs_dir2_data_freeremove(hdr, dfp, needlogp); | 998 | xfs_dir2_data_freeremove(hdr, bf, dfp, needlogp); |
994 | dfp = xfs_dir2_data_freeinsert(hdr, newdup, needlogp); | 999 | dfp = xfs_dir2_data_freeinsert(hdr, bf, newdup, |
1000 | needlogp); | ||
995 | ASSERT(dfp != NULL); | 1001 | ASSERT(dfp != NULL); |
996 | ASSERT(dfp->length == newdup->length); | 1002 | ASSERT(dfp->length == newdup->length); |
997 | ASSERT(be16_to_cpu(dfp->offset) == (char *)newdup - (char *)hdr); | 1003 | ASSERT(be16_to_cpu(dfp->offset) == (char *)newdup - (char *)hdr); |
@@ -1030,9 +1036,11 @@ xfs_dir2_data_use_free( | |||
1030 | if (dfp) { | 1036 | if (dfp) { |
1031 | needscan = (bf[2].length != 0); | 1037 | needscan = (bf[2].length != 0); |
1032 | if (!needscan) { | 1038 | if (!needscan) { |
1033 | xfs_dir2_data_freeremove(hdr, dfp, needlogp); | 1039 | xfs_dir2_data_freeremove(hdr, bf, dfp, |
1034 | xfs_dir2_data_freeinsert(hdr, newdup, needlogp); | 1040 | needlogp); |
1035 | xfs_dir2_data_freeinsert(hdr, newdup2, | 1041 | xfs_dir2_data_freeinsert(hdr, bf, newdup, |
1042 | needlogp); | ||
1043 | xfs_dir2_data_freeinsert(hdr, bf, newdup2, | ||
1036 | needlogp); | 1044 | needlogp); |
1037 | } | 1045 | } |
1038 | } | 1046 | } |
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index dd195363ccf2..f35b3942c1a6 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -460,7 +460,7 @@ xfs_dir2_block_to_leaf( | |||
460 | xfs_dir3_data_check(dp, dbp); | 460 | xfs_dir3_data_check(dp, dbp); |
461 | btp = xfs_dir2_block_tail_p(mp, hdr); | 461 | btp = xfs_dir2_block_tail_p(mp, hdr); |
462 | blp = xfs_dir2_block_leaf_p(btp); | 462 | blp = xfs_dir2_block_leaf_p(btp); |
463 | bf = xfs_dir3_data_bestfree_p(hdr); | 463 | bf = dp->d_ops->data_bestfree_p(hdr); |
464 | ents = xfs_dir3_leaf_ents_p(leaf); | 464 | ents = xfs_dir3_leaf_ents_p(leaf); |
465 | 465 | ||
466 | /* | 466 | /* |
@@ -484,7 +484,7 @@ xfs_dir2_block_to_leaf( | |||
484 | * Make the space formerly occupied by the leaf entries and block | 484 | * Make the space formerly occupied by the leaf entries and block |
485 | * tail be free. | 485 | * tail be free. |
486 | */ | 486 | */ |
487 | xfs_dir2_data_make_free(tp, dbp, | 487 | xfs_dir2_data_make_free(tp, dp, dbp, |
488 | (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), | 488 | (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), |
489 | (xfs_dir2_data_aoff_t)((char *)hdr + mp->m_dirblksize - | 489 | (xfs_dir2_data_aoff_t)((char *)hdr + mp->m_dirblksize - |
490 | (char *)blp), | 490 | (char *)blp), |
@@ -512,7 +512,7 @@ xfs_dir2_block_to_leaf( | |||
512 | * Log the data header and leaf bests table. | 512 | * Log the data header and leaf bests table. |
513 | */ | 513 | */ |
514 | if (needlog) | 514 | if (needlog) |
515 | xfs_dir2_data_log_header(tp, dbp); | 515 | xfs_dir2_data_log_header(tp, dp, dbp); |
516 | xfs_dir3_leaf_check(mp, lbp); | 516 | xfs_dir3_leaf_check(mp, lbp); |
517 | xfs_dir3_data_check(dp, dbp); | 517 | xfs_dir3_data_check(dp, dbp); |
518 | xfs_dir3_leaf_log_bests(tp, lbp, 0, 0); | 518 | xfs_dir3_leaf_log_bests(tp, lbp, 0, 0); |
@@ -862,7 +862,7 @@ xfs_dir2_leaf_addname( | |||
862 | else | 862 | else |
863 | xfs_dir3_leaf_log_bests(tp, lbp, use_block, use_block); | 863 | xfs_dir3_leaf_log_bests(tp, lbp, use_block, use_block); |
864 | hdr = dbp->b_addr; | 864 | hdr = dbp->b_addr; |
865 | bf = xfs_dir3_data_bestfree_p(hdr); | 865 | bf = dp->d_ops->data_bestfree_p(hdr); |
866 | bestsp[use_block] = bf[0].length; | 866 | bestsp[use_block] = bf[0].length; |
867 | grown = 1; | 867 | grown = 1; |
868 | } else { | 868 | } else { |
@@ -878,7 +878,7 @@ xfs_dir2_leaf_addname( | |||
878 | return error; | 878 | return error; |
879 | } | 879 | } |
880 | hdr = dbp->b_addr; | 880 | hdr = dbp->b_addr; |
881 | bf = xfs_dir3_data_bestfree_p(hdr); | 881 | bf = dp->d_ops->data_bestfree_p(hdr); |
882 | grown = 0; | 882 | grown = 0; |
883 | } | 883 | } |
884 | /* | 884 | /* |
@@ -891,7 +891,7 @@ xfs_dir2_leaf_addname( | |||
891 | /* | 891 | /* |
892 | * Mark the initial part of our freespace in use for the new entry. | 892 | * Mark the initial part of our freespace in use for the new entry. |
893 | */ | 893 | */ |
894 | xfs_dir2_data_use_free(tp, dbp, dup, | 894 | xfs_dir2_data_use_free(tp, dp, dbp, dup, |
895 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length, | 895 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length, |
896 | &needlog, &needscan); | 896 | &needlog, &needscan); |
897 | /* | 897 | /* |
@@ -913,7 +913,7 @@ xfs_dir2_leaf_addname( | |||
913 | * Need to log the data block's header. | 913 | * Need to log the data block's header. |
914 | */ | 914 | */ |
915 | if (needlog) | 915 | if (needlog) |
916 | xfs_dir2_data_log_header(tp, dbp); | 916 | xfs_dir2_data_log_header(tp, dp, dbp); |
917 | xfs_dir2_data_log_entry(tp, dp, dbp, dep); | 917 | xfs_dir2_data_log_entry(tp, dp, dbp, dep); |
918 | /* | 918 | /* |
919 | * If the bests table needs to be changed, do it. | 919 | * If the bests table needs to be changed, do it. |
@@ -1413,7 +1413,7 @@ xfs_dir2_leaf_removename( | |||
1413 | leaf = lbp->b_addr; | 1413 | leaf = lbp->b_addr; |
1414 | hdr = dbp->b_addr; | 1414 | hdr = dbp->b_addr; |
1415 | xfs_dir3_data_check(dp, dbp); | 1415 | xfs_dir3_data_check(dp, dbp); |
1416 | bf = xfs_dir3_data_bestfree_p(hdr); | 1416 | bf = dp->d_ops->data_bestfree_p(hdr); |
1417 | xfs_dir3_leaf_hdr_from_disk(&leafhdr, leaf); | 1417 | xfs_dir3_leaf_hdr_from_disk(&leafhdr, leaf); |
1418 | ents = xfs_dir3_leaf_ents_p(leaf); | 1418 | ents = xfs_dir3_leaf_ents_p(leaf); |
1419 | /* | 1419 | /* |
@@ -1431,7 +1431,7 @@ xfs_dir2_leaf_removename( | |||
1431 | /* | 1431 | /* |
1432 | * Mark the former data entry unused. | 1432 | * Mark the former data entry unused. |
1433 | */ | 1433 | */ |
1434 | xfs_dir2_data_make_free(tp, dbp, | 1434 | xfs_dir2_data_make_free(tp, dp, dbp, |
1435 | (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), | 1435 | (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), |
1436 | dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); | 1436 | dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); |
1437 | /* | 1437 | /* |
@@ -1451,7 +1451,7 @@ xfs_dir2_leaf_removename( | |||
1451 | if (needscan) | 1451 | if (needscan) |
1452 | xfs_dir2_data_freescan(dp, hdr, &needlog); | 1452 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
1453 | if (needlog) | 1453 | if (needlog) |
1454 | xfs_dir2_data_log_header(tp, dbp); | 1454 | xfs_dir2_data_log_header(tp, dp, dbp); |
1455 | /* | 1455 | /* |
1456 | * If the longest freespace in the data block has changed, | 1456 | * If the longest freespace in the data block has changed, |
1457 | * put the new value in the bests table and log that. | 1457 | * put the new value in the bests table and log that. |
@@ -1465,7 +1465,7 @@ xfs_dir2_leaf_removename( | |||
1465 | * If the data block is now empty then get rid of the data block. | 1465 | * If the data block is now empty then get rid of the data block. |
1466 | */ | 1466 | */ |
1467 | if (be16_to_cpu(bf[0].length) == | 1467 | if (be16_to_cpu(bf[0].length) == |
1468 | mp->m_dirblksize - xfs_dir3_data_entry_offset(hdr)) { | 1468 | mp->m_dirblksize - dp->d_ops->data_entry_offset()) { |
1469 | ASSERT(db != mp->m_dirdatablk); | 1469 | ASSERT(db != mp->m_dirdatablk); |
1470 | if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { | 1470 | if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { |
1471 | /* | 1471 | /* |
@@ -1659,12 +1659,12 @@ xfs_dir2_leaf_trim_data( | |||
1659 | #ifdef DEBUG | 1659 | #ifdef DEBUG |
1660 | { | 1660 | { |
1661 | struct xfs_dir2_data_hdr *hdr = dbp->b_addr; | 1661 | struct xfs_dir2_data_hdr *hdr = dbp->b_addr; |
1662 | struct xfs_dir2_data_free *bf = xfs_dir3_data_bestfree_p(hdr); | 1662 | struct xfs_dir2_data_free *bf = dp->d_ops->data_bestfree_p(hdr); |
1663 | 1663 | ||
1664 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || | 1664 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
1665 | hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC)); | 1665 | hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC)); |
1666 | ASSERT(be16_to_cpu(bf[0].length) == | 1666 | ASSERT(be16_to_cpu(bf[0].length) == |
1667 | mp->m_dirblksize - xfs_dir3_data_entry_offset(hdr)); | 1667 | mp->m_dirblksize - dp->d_ops->data_entry_offset()); |
1668 | ASSERT(db == be32_to_cpu(ltp->bestcount) - 1); | 1668 | ASSERT(db == be32_to_cpu(ltp->bestcount) - 1); |
1669 | } | 1669 | } |
1670 | #endif | 1670 | #endif |
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c index a1d133981c14..9cfc00323b19 100644 --- a/fs/xfs/xfs_dir2_node.c +++ b/fs/xfs/xfs_dir2_node.c | |||
@@ -1255,10 +1255,10 @@ xfs_dir2_leafn_remove( | |||
1255 | dbp = dblk->bp; | 1255 | dbp = dblk->bp; |
1256 | hdr = dbp->b_addr; | 1256 | hdr = dbp->b_addr; |
1257 | dep = (xfs_dir2_data_entry_t *)((char *)hdr + off); | 1257 | dep = (xfs_dir2_data_entry_t *)((char *)hdr + off); |
1258 | bf = xfs_dir3_data_bestfree_p(hdr); | 1258 | bf = dp->d_ops->data_bestfree_p(hdr); |
1259 | longest = be16_to_cpu(bf[0].length); | 1259 | longest = be16_to_cpu(bf[0].length); |
1260 | needlog = needscan = 0; | 1260 | needlog = needscan = 0; |
1261 | xfs_dir2_data_make_free(tp, dbp, off, | 1261 | xfs_dir2_data_make_free(tp, dp, dbp, off, |
1262 | dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); | 1262 | dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); |
1263 | /* | 1263 | /* |
1264 | * Rescan the data block freespaces for bestfree. | 1264 | * Rescan the data block freespaces for bestfree. |
@@ -1267,7 +1267,7 @@ xfs_dir2_leafn_remove( | |||
1267 | if (needscan) | 1267 | if (needscan) |
1268 | xfs_dir2_data_freescan(dp, hdr, &needlog); | 1268 | xfs_dir2_data_freescan(dp, hdr, &needlog); |
1269 | if (needlog) | 1269 | if (needlog) |
1270 | xfs_dir2_data_log_header(tp, dbp); | 1270 | xfs_dir2_data_log_header(tp, dp, dbp); |
1271 | xfs_dir3_data_check(dp, dbp); | 1271 | xfs_dir3_data_check(dp, dbp); |
1272 | /* | 1272 | /* |
1273 | * If the longest data block freespace changes, need to update | 1273 | * If the longest data block freespace changes, need to update |
@@ -1308,7 +1308,7 @@ xfs_dir2_leafn_remove( | |||
1308 | * (usually). | 1308 | * (usually). |
1309 | */ | 1309 | */ |
1310 | if (longest == mp->m_dirblksize - | 1310 | if (longest == mp->m_dirblksize - |
1311 | xfs_dir3_data_entry_offset(hdr)) { | 1311 | dp->d_ops->data_entry_offset()) { |
1312 | /* | 1312 | /* |
1313 | * Try to punch out the data block. | 1313 | * Try to punch out the data block. |
1314 | */ | 1314 | */ |
@@ -1962,7 +1962,7 @@ xfs_dir2_node_addname_int( | |||
1962 | * change again. | 1962 | * change again. |
1963 | */ | 1963 | */ |
1964 | hdr = dbp->b_addr; | 1964 | hdr = dbp->b_addr; |
1965 | bf = xfs_dir3_data_bestfree_p(hdr); | 1965 | bf = dp->d_ops->data_bestfree_p(hdr); |
1966 | bests[findex] = bf[0].length; | 1966 | bests[findex] = bf[0].length; |
1967 | logfree = 1; | 1967 | logfree = 1; |
1968 | } | 1968 | } |
@@ -1984,7 +1984,7 @@ xfs_dir2_node_addname_int( | |||
1984 | if (error) | 1984 | if (error) |
1985 | return error; | 1985 | return error; |
1986 | hdr = dbp->b_addr; | 1986 | hdr = dbp->b_addr; |
1987 | bf = xfs_dir3_data_bestfree_p(hdr); | 1987 | bf = dp->d_ops->data_bestfree_p(hdr); |
1988 | logfree = 0; | 1988 | logfree = 0; |
1989 | } | 1989 | } |
1990 | ASSERT(be16_to_cpu(bf[0].length) >= length); | 1990 | ASSERT(be16_to_cpu(bf[0].length) >= length); |
@@ -1997,7 +1997,7 @@ xfs_dir2_node_addname_int( | |||
1997 | /* | 1997 | /* |
1998 | * Mark the first part of the unused space, inuse for us. | 1998 | * Mark the first part of the unused space, inuse for us. |
1999 | */ | 1999 | */ |
2000 | xfs_dir2_data_use_free(tp, dbp, dup, | 2000 | xfs_dir2_data_use_free(tp, dp, dbp, dup, |
2001 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length, | 2001 | (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length, |
2002 | &needlog, &needscan); | 2002 | &needlog, &needscan); |
2003 | /* | 2003 | /* |
@@ -2020,7 +2020,7 @@ xfs_dir2_node_addname_int( | |||
2020 | * Log the data block header if needed. | 2020 | * Log the data block header if needed. |
2021 | */ | 2021 | */ |
2022 | if (needlog) | 2022 | if (needlog) |
2023 | xfs_dir2_data_log_header(tp, dbp); | 2023 | xfs_dir2_data_log_header(tp, dp, dbp); |
2024 | /* | 2024 | /* |
2025 | * If the freespace entry is now wrong, update it. | 2025 | * If the freespace entry is now wrong, update it. |
2026 | */ | 2026 | */ |
diff --git a/fs/xfs/xfs_dir2_priv.h b/fs/xfs/xfs_dir2_priv.h index 1bad84c40829..9a69f206daf9 100644 --- a/fs/xfs/xfs_dir2_priv.h +++ b/fs/xfs/xfs_dir2_priv.h | |||
@@ -59,7 +59,8 @@ extern int xfs_dir3_data_readahead(struct xfs_trans *tp, struct xfs_inode *dp, | |||
59 | 59 | ||
60 | extern struct xfs_dir2_data_free * | 60 | extern struct xfs_dir2_data_free * |
61 | xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr, | 61 | xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr, |
62 | struct xfs_dir2_data_unused *dup, int *loghead); | 62 | struct xfs_dir2_data_free *bf, struct xfs_dir2_data_unused *dup, |
63 | int *loghead); | ||
63 | extern int xfs_dir3_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno, | 64 | extern int xfs_dir3_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno, |
64 | struct xfs_buf **bpp); | 65 | struct xfs_buf **bpp); |
65 | 66 | ||
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c index b99aa7d48e90..f45ecac821ec 100644 --- a/fs/xfs/xfs_dir2_readdir.c +++ b/fs/xfs/xfs_dir2_readdir.c | |||
@@ -213,7 +213,7 @@ xfs_dir2_block_getdents( | |||
213 | * Set up values for the loop. | 213 | * Set up values for the loop. |
214 | */ | 214 | */ |
215 | btp = xfs_dir2_block_tail_p(mp, hdr); | 215 | btp = xfs_dir2_block_tail_p(mp, hdr); |
216 | ptr = (char *)xfs_dir3_data_entry_p(hdr); | 216 | ptr = (char *)dp->d_ops->data_entry_p(hdr); |
217 | endptr = (char *)xfs_dir2_block_leaf_p(btp); | 217 | endptr = (char *)xfs_dir2_block_leaf_p(btp); |
218 | 218 | ||
219 | /* | 219 | /* |
@@ -578,13 +578,13 @@ xfs_dir2_leaf_getdents( | |||
578 | /* | 578 | /* |
579 | * Find our position in the block. | 579 | * Find our position in the block. |
580 | */ | 580 | */ |
581 | ptr = (char *)xfs_dir3_data_entry_p(hdr); | 581 | ptr = (char *)dp->d_ops->data_entry_p(hdr); |
582 | byteoff = xfs_dir2_byte_to_off(mp, curoff); | 582 | byteoff = xfs_dir2_byte_to_off(mp, curoff); |
583 | /* | 583 | /* |
584 | * Skip past the header. | 584 | * Skip past the header. |
585 | */ | 585 | */ |
586 | if (byteoff == 0) | 586 | if (byteoff == 0) |
587 | curoff += xfs_dir3_data_entry_offset(hdr); | 587 | curoff += dp->d_ops->data_entry_offset(); |
588 | /* | 588 | /* |
589 | * Skip past entries until we reach our offset. | 589 | * Skip past entries until we reach our offset. |
590 | */ | 590 | */ |
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c index 953e19479151..42bbcff15cc5 100644 --- a/fs/xfs/xfs_dir2_sf.c +++ b/fs/xfs/xfs_dir2_sf.c | |||
@@ -210,7 +210,7 @@ xfs_dir2_block_to_sf( | |||
210 | * Set up to loop over the block's entries. | 210 | * Set up to loop over the block's entries. |
211 | */ | 211 | */ |
212 | btp = xfs_dir2_block_tail_p(mp, hdr); | 212 | btp = xfs_dir2_block_tail_p(mp, hdr); |
213 | ptr = (char *)xfs_dir3_data_entry_p(hdr); | 213 | ptr = (char *)dp->d_ops->data_entry_p(hdr); |
214 | endptr = (char *)xfs_dir2_block_leaf_p(btp); | 214 | endptr = (char *)xfs_dir2_block_leaf_p(btp); |
215 | sfep = xfs_dir2_sf_firstentry(sfp); | 215 | sfep = xfs_dir2_sf_firstentry(sfp); |
216 | /* | 216 | /* |