hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/fs/xfs/libxfs/xfs_dir2_leaf.c
....@@ -6,12 +6,11 @@
66 */
77 #include "xfs.h"
88 #include "xfs_fs.h"
9
+#include "xfs_shared.h"
910 #include "xfs_format.h"
1011 #include "xfs_log_format.h"
1112 #include "xfs_trans_resv.h"
1213 #include "xfs_mount.h"
13
-#include "xfs_da_format.h"
14
-#include "xfs_da_btree.h"
1514 #include "xfs_inode.h"
1615 #include "xfs_bmap.h"
1716 #include "xfs_dir2.h"
....@@ -20,18 +19,77 @@
2019 #include "xfs_trace.h"
2120 #include "xfs_trans.h"
2221 #include "xfs_buf_item.h"
23
-#include "xfs_cksum.h"
24
-#include "xfs_log.h"
2522
2623 /*
2724 * Local function declarations.
2825 */
2926 static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, struct xfs_buf **lbpp,
30
- int *indexp, struct xfs_buf **dbpp);
27
+ int *indexp, struct xfs_buf **dbpp,
28
+ struct xfs_dir3_icleaf_hdr *leafhdr);
3129 static void xfs_dir3_leaf_log_bests(struct xfs_da_args *args,
3230 struct xfs_buf *bp, int first, int last);
3331 static void xfs_dir3_leaf_log_tail(struct xfs_da_args *args,
3432 struct xfs_buf *bp);
33
+
34
+void
35
+xfs_dir2_leaf_hdr_from_disk(
36
+ struct xfs_mount *mp,
37
+ struct xfs_dir3_icleaf_hdr *to,
38
+ struct xfs_dir2_leaf *from)
39
+{
40
+ if (xfs_sb_version_hascrc(&mp->m_sb)) {
41
+ struct xfs_dir3_leaf *from3 = (struct xfs_dir3_leaf *)from;
42
+
43
+ to->forw = be32_to_cpu(from3->hdr.info.hdr.forw);
44
+ to->back = be32_to_cpu(from3->hdr.info.hdr.back);
45
+ to->magic = be16_to_cpu(from3->hdr.info.hdr.magic);
46
+ to->count = be16_to_cpu(from3->hdr.count);
47
+ to->stale = be16_to_cpu(from3->hdr.stale);
48
+ to->ents = from3->__ents;
49
+
50
+ ASSERT(to->magic == XFS_DIR3_LEAF1_MAGIC ||
51
+ to->magic == XFS_DIR3_LEAFN_MAGIC);
52
+ } else {
53
+ to->forw = be32_to_cpu(from->hdr.info.forw);
54
+ to->back = be32_to_cpu(from->hdr.info.back);
55
+ to->magic = be16_to_cpu(from->hdr.info.magic);
56
+ to->count = be16_to_cpu(from->hdr.count);
57
+ to->stale = be16_to_cpu(from->hdr.stale);
58
+ to->ents = from->__ents;
59
+
60
+ ASSERT(to->magic == XFS_DIR2_LEAF1_MAGIC ||
61
+ to->magic == XFS_DIR2_LEAFN_MAGIC);
62
+ }
63
+}
64
+
65
+void
66
+xfs_dir2_leaf_hdr_to_disk(
67
+ struct xfs_mount *mp,
68
+ struct xfs_dir2_leaf *to,
69
+ struct xfs_dir3_icleaf_hdr *from)
70
+{
71
+ if (xfs_sb_version_hascrc(&mp->m_sb)) {
72
+ struct xfs_dir3_leaf *to3 = (struct xfs_dir3_leaf *)to;
73
+
74
+ ASSERT(from->magic == XFS_DIR3_LEAF1_MAGIC ||
75
+ from->magic == XFS_DIR3_LEAFN_MAGIC);
76
+
77
+ to3->hdr.info.hdr.forw = cpu_to_be32(from->forw);
78
+ to3->hdr.info.hdr.back = cpu_to_be32(from->back);
79
+ to3->hdr.info.hdr.magic = cpu_to_be16(from->magic);
80
+ to3->hdr.count = cpu_to_be16(from->count);
81
+ to3->hdr.stale = cpu_to_be16(from->stale);
82
+ } else {
83
+ ASSERT(from->magic == XFS_DIR2_LEAF1_MAGIC ||
84
+ from->magic == XFS_DIR2_LEAFN_MAGIC);
85
+
86
+ to->hdr.info.forw = cpu_to_be32(from->forw);
87
+ to->hdr.info.back = cpu_to_be32(from->back);
88
+ to->hdr.info.magic = cpu_to_be16(from->magic);
89
+ to->hdr.count = cpu_to_be16(from->count);
90
+ to->hdr.stale = cpu_to_be16(from->stale);
91
+ }
92
+}
3593
3694 /*
3795 * Check the internal consistency of a leaf1 block.
....@@ -46,7 +104,7 @@
46104 struct xfs_dir2_leaf *leaf = bp->b_addr;
47105 struct xfs_dir3_icleaf_hdr leafhdr;
48106
49
- dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
107
+ xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
50108
51109 if (leafhdr.magic == XFS_DIR3_LEAF1_MAGIC) {
52110 struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr;
....@@ -55,7 +113,7 @@
55113 } else if (leafhdr.magic != XFS_DIR2_LEAF1_MAGIC)
56114 return __this_address;
57115
58
- return xfs_dir3_leaf_check_int(dp->i_mount, dp, &leafhdr, leaf);
116
+ return xfs_dir3_leaf_check_int(dp->i_mount, &leafhdr, leaf);
59117 }
60118
61119 static inline void
....@@ -79,31 +137,15 @@
79137
80138 xfs_failaddr_t
81139 xfs_dir3_leaf_check_int(
82
- struct xfs_mount *mp,
83
- struct xfs_inode *dp,
84
- struct xfs_dir3_icleaf_hdr *hdr,
85
- struct xfs_dir2_leaf *leaf)
140
+ struct xfs_mount *mp,
141
+ struct xfs_dir3_icleaf_hdr *hdr,
142
+ struct xfs_dir2_leaf *leaf)
86143 {
87
- struct xfs_dir2_leaf_entry *ents;
88
- xfs_dir2_leaf_tail_t *ltp;
89
- int stale;
90
- int i;
91
- const struct xfs_dir_ops *ops;
92
- struct xfs_dir3_icleaf_hdr leafhdr;
93
- struct xfs_da_geometry *geo = mp->m_dir_geo;
144
+ struct xfs_da_geometry *geo = mp->m_dir_geo;
145
+ xfs_dir2_leaf_tail_t *ltp;
146
+ int stale;
147
+ int i;
94148
95
- /*
96
- * we can be passed a null dp here from a verifier, so we need to go the
97
- * hard way to get them.
98
- */
99
- ops = xfs_dir_get_ops(mp, dp);
100
-
101
- if (!hdr) {
102
- ops->leaf_hdr_from_disk(&leafhdr, leaf);
103
- hdr = &leafhdr;
104
- }
105
-
106
- ents = ops->leaf_ents_p(leaf);
107149 ltp = xfs_dir2_leaf_tail_p(geo, leaf);
108150
109151 /*
....@@ -111,23 +153,23 @@
111153 * Should factor in the size of the bests table as well.
112154 * We can deduce a value for that from di_size.
113155 */
114
- if (hdr->count > ops->leaf_max_ents(geo))
156
+ if (hdr->count > geo->leaf_max_ents)
115157 return __this_address;
116158
117159 /* Leaves and bests don't overlap in leaf format. */
118160 if ((hdr->magic == XFS_DIR2_LEAF1_MAGIC ||
119161 hdr->magic == XFS_DIR3_LEAF1_MAGIC) &&
120
- (char *)&ents[hdr->count] > (char *)xfs_dir2_leaf_bests_p(ltp))
162
+ (char *)&hdr->ents[hdr->count] > (char *)xfs_dir2_leaf_bests_p(ltp))
121163 return __this_address;
122164
123165 /* Check hash value order, count stale entries. */
124166 for (i = stale = 0; i < hdr->count; i++) {
125167 if (i + 1 < hdr->count) {
126
- if (be32_to_cpu(ents[i].hashval) >
127
- be32_to_cpu(ents[i + 1].hashval))
168
+ if (be32_to_cpu(hdr->ents[i].hashval) >
169
+ be32_to_cpu(hdr->ents[i + 1].hashval))
128170 return __this_address;
129171 }
130
- if (ents[i].address == cpu_to_be32(XFS_DIR2_NULL_DATAPTR))
172
+ if (hdr->ents[i].address == cpu_to_be32(XFS_DIR2_NULL_DATAPTR))
131173 stale++;
132174 }
133175 if (hdr->stale != stale)
....@@ -142,66 +184,47 @@
142184 */
143185 static xfs_failaddr_t
144186 xfs_dir3_leaf_verify(
145
- struct xfs_buf *bp,
146
- uint16_t magic)
187
+ struct xfs_buf *bp)
147188 {
148
- struct xfs_mount *mp = bp->b_target->bt_mount;
149
- struct xfs_dir2_leaf *leaf = bp->b_addr;
189
+ struct xfs_mount *mp = bp->b_mount;
190
+ struct xfs_dir3_icleaf_hdr leafhdr;
191
+ xfs_failaddr_t fa;
150192
151
- ASSERT(magic == XFS_DIR2_LEAF1_MAGIC || magic == XFS_DIR2_LEAFN_MAGIC);
193
+ fa = xfs_da3_blkinfo_verify(bp, bp->b_addr);
194
+ if (fa)
195
+ return fa;
152196
153
- if (xfs_sb_version_hascrc(&mp->m_sb)) {
154
- struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr;
155
- uint16_t magic3;
156
-
157
- magic3 = (magic == XFS_DIR2_LEAF1_MAGIC) ? XFS_DIR3_LEAF1_MAGIC
158
- : XFS_DIR3_LEAFN_MAGIC;
159
-
160
- if (leaf3->info.hdr.magic != cpu_to_be16(magic3))
161
- return __this_address;
162
- if (!uuid_equal(&leaf3->info.uuid, &mp->m_sb.sb_meta_uuid))
163
- return __this_address;
164
- if (be64_to_cpu(leaf3->info.blkno) != bp->b_bn)
165
- return __this_address;
166
- if (!xfs_log_check_lsn(mp, be64_to_cpu(leaf3->info.lsn)))
167
- return __this_address;
168
- } else {
169
- if (leaf->hdr.info.magic != cpu_to_be16(magic))
170
- return __this_address;
171
- }
172
-
173
- return xfs_dir3_leaf_check_int(mp, NULL, NULL, leaf);
197
+ xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, bp->b_addr);
198
+ return xfs_dir3_leaf_check_int(mp, &leafhdr, bp->b_addr);
174199 }
175200
176201 static void
177
-__read_verify(
178
- struct xfs_buf *bp,
179
- uint16_t magic)
202
+xfs_dir3_leaf_read_verify(
203
+ struct xfs_buf *bp)
180204 {
181
- struct xfs_mount *mp = bp->b_target->bt_mount;
205
+ struct xfs_mount *mp = bp->b_mount;
182206 xfs_failaddr_t fa;
183207
184208 if (xfs_sb_version_hascrc(&mp->m_sb) &&
185209 !xfs_buf_verify_cksum(bp, XFS_DIR3_LEAF_CRC_OFF))
186210 xfs_verifier_error(bp, -EFSBADCRC, __this_address);
187211 else {
188
- fa = xfs_dir3_leaf_verify(bp, magic);
212
+ fa = xfs_dir3_leaf_verify(bp);
189213 if (fa)
190214 xfs_verifier_error(bp, -EFSCORRUPTED, fa);
191215 }
192216 }
193217
194218 static void
195
-__write_verify(
196
- struct xfs_buf *bp,
197
- uint16_t magic)
219
+xfs_dir3_leaf_write_verify(
220
+ struct xfs_buf *bp)
198221 {
199
- struct xfs_mount *mp = bp->b_target->bt_mount;
222
+ struct xfs_mount *mp = bp->b_mount;
200223 struct xfs_buf_log_item *bip = bp->b_log_item;
201224 struct xfs_dir3_leaf_hdr *hdr3 = bp->b_addr;
202225 xfs_failaddr_t fa;
203226
204
- fa = xfs_dir3_leaf_verify(bp, magic);
227
+ fa = xfs_dir3_leaf_verify(bp);
205228 if (fa) {
206229 xfs_verifier_error(bp, -EFSCORRUPTED, fa);
207230 return;
....@@ -216,60 +239,22 @@
216239 xfs_buf_update_cksum(bp, XFS_DIR3_LEAF_CRC_OFF);
217240 }
218241
219
-static xfs_failaddr_t
220
-xfs_dir3_leaf1_verify(
221
- struct xfs_buf *bp)
222
-{
223
- return xfs_dir3_leaf_verify(bp, XFS_DIR2_LEAF1_MAGIC);
224
-}
225
-
226
-static void
227
-xfs_dir3_leaf1_read_verify(
228
- struct xfs_buf *bp)
229
-{
230
- __read_verify(bp, XFS_DIR2_LEAF1_MAGIC);
231
-}
232
-
233
-static void
234
-xfs_dir3_leaf1_write_verify(
235
- struct xfs_buf *bp)
236
-{
237
- __write_verify(bp, XFS_DIR2_LEAF1_MAGIC);
238
-}
239
-
240
-static xfs_failaddr_t
241
-xfs_dir3_leafn_verify(
242
- struct xfs_buf *bp)
243
-{
244
- return xfs_dir3_leaf_verify(bp, XFS_DIR2_LEAFN_MAGIC);
245
-}
246
-
247
-static void
248
-xfs_dir3_leafn_read_verify(
249
- struct xfs_buf *bp)
250
-{
251
- __read_verify(bp, XFS_DIR2_LEAFN_MAGIC);
252
-}
253
-
254
-static void
255
-xfs_dir3_leafn_write_verify(
256
- struct xfs_buf *bp)
257
-{
258
- __write_verify(bp, XFS_DIR2_LEAFN_MAGIC);
259
-}
260
-
261242 const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops = {
262243 .name = "xfs_dir3_leaf1",
263
- .verify_read = xfs_dir3_leaf1_read_verify,
264
- .verify_write = xfs_dir3_leaf1_write_verify,
265
- .verify_struct = xfs_dir3_leaf1_verify,
244
+ .magic16 = { cpu_to_be16(XFS_DIR2_LEAF1_MAGIC),
245
+ cpu_to_be16(XFS_DIR3_LEAF1_MAGIC) },
246
+ .verify_read = xfs_dir3_leaf_read_verify,
247
+ .verify_write = xfs_dir3_leaf_write_verify,
248
+ .verify_struct = xfs_dir3_leaf_verify,
266249 };
267250
268251 const struct xfs_buf_ops xfs_dir3_leafn_buf_ops = {
269252 .name = "xfs_dir3_leafn",
270
- .verify_read = xfs_dir3_leafn_read_verify,
271
- .verify_write = xfs_dir3_leafn_write_verify,
272
- .verify_struct = xfs_dir3_leafn_verify,
253
+ .magic16 = { cpu_to_be16(XFS_DIR2_LEAFN_MAGIC),
254
+ cpu_to_be16(XFS_DIR3_LEAFN_MAGIC) },
255
+ .verify_read = xfs_dir3_leaf_read_verify,
256
+ .verify_write = xfs_dir3_leaf_write_verify,
257
+ .verify_struct = xfs_dir3_leaf_verify,
273258 };
274259
275260 int
....@@ -277,13 +262,12 @@
277262 struct xfs_trans *tp,
278263 struct xfs_inode *dp,
279264 xfs_dablk_t fbno,
280
- xfs_daddr_t mappedbno,
281265 struct xfs_buf **bpp)
282266 {
283267 int err;
284268
285
- err = xfs_da_read_buf(tp, dp, fbno, mappedbno, bpp,
286
- XFS_DATA_FORK, &xfs_dir3_leaf1_buf_ops);
269
+ err = xfs_da_read_buf(tp, dp, fbno, 0, bpp, XFS_DATA_FORK,
270
+ &xfs_dir3_leaf1_buf_ops);
287271 if (!err && tp && *bpp)
288272 xfs_trans_buf_set_type(tp, *bpp, XFS_BLFT_DIR_LEAF1_BUF);
289273 return err;
....@@ -294,13 +278,12 @@
294278 struct xfs_trans *tp,
295279 struct xfs_inode *dp,
296280 xfs_dablk_t fbno,
297
- xfs_daddr_t mappedbno,
298281 struct xfs_buf **bpp)
299282 {
300283 int err;
301284
302
- err = xfs_da_read_buf(tp, dp, fbno, mappedbno, bpp,
303
- XFS_DATA_FORK, &xfs_dir3_leafn_buf_ops);
285
+ err = xfs_da_read_buf(tp, dp, fbno, 0, bpp, XFS_DATA_FORK,
286
+ &xfs_dir3_leafn_buf_ops);
304287 if (!err && tp && *bpp)
305288 xfs_trans_buf_set_type(tp, *bpp, XFS_BLFT_DIR_LEAFN_BUF);
306289 return err;
....@@ -372,7 +355,7 @@
372355 bno < xfs_dir2_byte_to_db(args->geo, XFS_DIR2_FREE_OFFSET));
373356
374357 error = xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(args->geo, bno),
375
- -1, &bp, XFS_DATA_FORK);
358
+ &bp, XFS_DATA_FORK);
376359 if (error)
377360 return error;
378361
....@@ -407,7 +390,6 @@
407390 int needscan; /* need to rescan bestfree */
408391 xfs_trans_t *tp; /* transaction pointer */
409392 struct xfs_dir2_data_free *bf;
410
- struct xfs_dir2_leaf_entry *ents;
411393 struct xfs_dir3_icleaf_hdr leafhdr;
412394
413395 trace_xfs_dir2_block_to_leaf(args);
....@@ -436,24 +418,24 @@
436418 xfs_dir3_data_check(dp, dbp);
437419 btp = xfs_dir2_block_tail_p(args->geo, hdr);
438420 blp = xfs_dir2_block_leaf_p(btp);
439
- bf = dp->d_ops->data_bestfree_p(hdr);
440
- ents = dp->d_ops->leaf_ents_p(leaf);
421
+ bf = xfs_dir2_data_bestfree_p(dp->i_mount, hdr);
441422
442423 /*
443424 * Set the counts in the leaf header.
444425 */
445
- dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
426
+ xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
446427 leafhdr.count = be32_to_cpu(btp->count);
447428 leafhdr.stale = be32_to_cpu(btp->stale);
448
- dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
429
+ xfs_dir2_leaf_hdr_to_disk(dp->i_mount, leaf, &leafhdr);
449430 xfs_dir3_leaf_log_header(args, lbp);
450431
451432 /*
452433 * Could compact these but I think we always do the conversion
453434 * after squeezing out stale entries.
454435 */
455
- memcpy(ents, blp, be32_to_cpu(btp->count) * sizeof(xfs_dir2_leaf_entry_t));
456
- xfs_dir3_leaf_log_ents(args, lbp, 0, leafhdr.count - 1);
436
+ memcpy(leafhdr.ents, blp,
437
+ be32_to_cpu(btp->count) * sizeof(struct xfs_dir2_leaf_entry));
438
+ xfs_dir3_leaf_log_ents(args, &leafhdr, lbp, 0, leafhdr.count - 1);
457439 needscan = 0;
458440 needlog = 1;
459441 /*
....@@ -476,7 +458,7 @@
476458 hdr->magic = cpu_to_be32(XFS_DIR3_DATA_MAGIC);
477459
478460 if (needscan)
479
- xfs_dir2_data_freescan(dp, hdr, &needlog);
461
+ xfs_dir2_data_freescan(dp->i_mount, hdr, &needlog);
480462 /*
481463 * Set up leaf tail and bests table.
482464 */
....@@ -621,44 +603,41 @@
621603 */
622604 int /* error */
623605 xfs_dir2_leaf_addname(
624
- xfs_da_args_t *args) /* operation arguments */
606
+ struct xfs_da_args *args) /* operation arguments */
625607 {
608
+ struct xfs_dir3_icleaf_hdr leafhdr;
609
+ struct xfs_trans *tp = args->trans;
626610 __be16 *bestsp; /* freespace table in leaf */
627
- int compact; /* need to compact leaves */
628
- xfs_dir2_data_hdr_t *hdr; /* data block header */
611
+ __be16 *tagp; /* end of data entry */
629612 struct xfs_buf *dbp; /* data block buffer */
630
- xfs_dir2_data_entry_t *dep; /* data block entry */
631
- xfs_inode_t *dp; /* incore directory inode */
632
- xfs_dir2_data_unused_t *dup; /* data unused entry */
613
+ struct xfs_buf *lbp; /* leaf's buffer */
614
+ struct xfs_dir2_leaf *leaf; /* leaf structure */
615
+ struct xfs_inode *dp = args->dp; /* incore directory inode */
616
+ struct xfs_dir2_data_hdr *hdr; /* data block header */
617
+ struct xfs_dir2_data_entry *dep; /* data block entry */
618
+ struct xfs_dir2_leaf_entry *lep; /* leaf entry table pointer */
619
+ struct xfs_dir2_leaf_entry *ents;
620
+ struct xfs_dir2_data_unused *dup; /* data unused entry */
621
+ struct xfs_dir2_leaf_tail *ltp; /* leaf tail pointer */
622
+ struct xfs_dir2_data_free *bf; /* bestfree table */
623
+ int compact; /* need to compact leaves */
633624 int error; /* error return value */
634625 int grown; /* allocated new data block */
635
- int highstale; /* index of next stale leaf */
626
+ int highstale = 0; /* index of next stale leaf */
636627 int i; /* temporary, index */
637628 int index; /* leaf table position */
638
- struct xfs_buf *lbp; /* leaf's buffer */
639
- xfs_dir2_leaf_t *leaf; /* leaf structure */
640629 int length; /* length of new entry */
641
- xfs_dir2_leaf_entry_t *lep; /* leaf entry table pointer */
642630 int lfloglow; /* low leaf logging index */
643631 int lfloghigh; /* high leaf logging index */
644
- int lowstale; /* index of prev stale leaf */
645
- xfs_dir2_leaf_tail_t *ltp; /* leaf tail pointer */
632
+ int lowstale = 0; /* index of prev stale leaf */
646633 int needbytes; /* leaf block bytes needed */
647634 int needlog; /* need to log data header */
648635 int needscan; /* need to rescan data free */
649
- __be16 *tagp; /* end of data entry */
650
- xfs_trans_t *tp; /* transaction pointer */
651636 xfs_dir2_db_t use_block; /* data block number */
652
- struct xfs_dir2_data_free *bf; /* bestfree table */
653
- struct xfs_dir2_leaf_entry *ents;
654
- struct xfs_dir3_icleaf_hdr leafhdr;
655637
656638 trace_xfs_dir2_leaf_addname(args);
657639
658
- dp = args->dp;
659
- tp = args->trans;
660
-
661
- error = xfs_dir3_leaf_read(tp, dp, args->geo->leafblk, -1, &lbp);
640
+ error = xfs_dir3_leaf_read(tp, dp, args->geo->leafblk, &lbp);
662641 if (error)
663642 return error;
664643
....@@ -671,10 +650,10 @@
671650 index = xfs_dir2_leaf_search_hash(args, lbp);
672651 leaf = lbp->b_addr;
673652 ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
674
- ents = dp->d_ops->leaf_ents_p(leaf);
675
- dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
653
+ xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
654
+ ents = leafhdr.ents;
676655 bestsp = xfs_dir2_leaf_bests_p(ltp);
677
- length = dp->d_ops->data_entsize(args->namelen);
656
+ length = xfs_dir2_data_entsize(dp->i_mount, args->namelen);
678657
679658 /*
680659 * See if there are any entries with the same hash value
....@@ -837,7 +816,7 @@
837816 else
838817 xfs_dir3_leaf_log_bests(args, lbp, use_block, use_block);
839818 hdr = dbp->b_addr;
840
- bf = dp->d_ops->data_bestfree_p(hdr);
819
+ bf = xfs_dir2_data_bestfree_p(dp->i_mount, hdr);
841820 bestsp[use_block] = bf[0].length;
842821 grown = 1;
843822 } else {
....@@ -847,13 +826,13 @@
847826 */
848827 error = xfs_dir3_data_read(tp, dp,
849828 xfs_dir2_db_to_da(args->geo, use_block),
850
- -1, &dbp);
829
+ 0, &dbp);
851830 if (error) {
852831 xfs_trans_brelse(tp, lbp);
853832 return error;
854833 }
855834 hdr = dbp->b_addr;
856
- bf = dp->d_ops->data_bestfree_p(hdr);
835
+ bf = xfs_dir2_data_bestfree_p(dp->i_mount, hdr);
857836 grown = 0;
858837 }
859838 /*
....@@ -879,14 +858,14 @@
879858 dep->inumber = cpu_to_be64(args->inumber);
880859 dep->namelen = args->namelen;
881860 memcpy(dep->name, args->name, dep->namelen);
882
- dp->d_ops->data_put_ftype(dep, args->filetype);
883
- tagp = dp->d_ops->data_entry_tag_p(dep);
861
+ xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
862
+ tagp = xfs_dir2_data_entry_tag_p(dp->i_mount, dep);
884863 *tagp = cpu_to_be16((char *)dep - (char *)hdr);
885864 /*
886865 * Need to scan fix up the bestfree table.
887866 */
888867 if (needscan)
889
- xfs_dir2_data_freescan(dp, hdr, &needlog);
868
+ xfs_dir2_data_freescan(dp->i_mount, hdr, &needlog);
890869 /*
891870 * Need to log the data block's header.
892871 */
....@@ -916,9 +895,9 @@
916895 /*
917896 * Log the leaf fields and give up the buffers.
918897 */
919
- dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
898
+ xfs_dir2_leaf_hdr_to_disk(dp->i_mount, leaf, &leafhdr);
920899 xfs_dir3_leaf_log_header(args, lbp);
921
- xfs_dir3_leaf_log_ents(args, lbp, lfloglow, lfloghigh);
900
+ xfs_dir3_leaf_log_ents(args, &leafhdr, lbp, lfloglow, lfloghigh);
922901 xfs_dir3_leaf_check(dp, lbp);
923902 xfs_dir3_data_check(dp, dbp);
924903 return 0;
....@@ -938,7 +917,6 @@
938917 xfs_dir2_leaf_t *leaf; /* leaf structure */
939918 int loglow; /* first leaf entry to log */
940919 int to; /* target leaf index */
941
- struct xfs_dir2_leaf_entry *ents;
942920 struct xfs_inode *dp = args->dp;
943921
944922 leaf = bp->b_addr;
....@@ -948,9 +926,9 @@
948926 /*
949927 * Compress out the stale entries in place.
950928 */
951
- ents = dp->d_ops->leaf_ents_p(leaf);
952929 for (from = to = 0, loglow = -1; from < leafhdr->count; from++) {
953
- if (ents[from].address == cpu_to_be32(XFS_DIR2_NULL_DATAPTR))
930
+ if (leafhdr->ents[from].address ==
931
+ cpu_to_be32(XFS_DIR2_NULL_DATAPTR))
954932 continue;
955933 /*
956934 * Only actually copy the entries that are different.
....@@ -958,7 +936,7 @@
958936 if (from > to) {
959937 if (loglow == -1)
960938 loglow = to;
961
- ents[to] = ents[from];
939
+ leafhdr->ents[to] = leafhdr->ents[from];
962940 }
963941 to++;
964942 }
....@@ -969,10 +947,10 @@
969947 leafhdr->count -= leafhdr->stale;
970948 leafhdr->stale = 0;
971949
972
- dp->d_ops->leaf_hdr_to_disk(leaf, leafhdr);
950
+ xfs_dir2_leaf_hdr_to_disk(dp->i_mount, leaf, leafhdr);
973951 xfs_dir3_leaf_log_header(args, bp);
974952 if (loglow != -1)
975
- xfs_dir3_leaf_log_ents(args, bp, loglow, to - 1);
953
+ xfs_dir3_leaf_log_ents(args, leafhdr, bp, loglow, to - 1);
976954 }
977955
978956 /*
....@@ -1101,6 +1079,7 @@
11011079 void
11021080 xfs_dir3_leaf_log_ents(
11031081 struct xfs_da_args *args,
1082
+ struct xfs_dir3_icleaf_hdr *hdr,
11041083 struct xfs_buf *bp,
11051084 int first,
11061085 int last)
....@@ -1108,16 +1087,14 @@
11081087 xfs_dir2_leaf_entry_t *firstlep; /* pointer to first entry */
11091088 xfs_dir2_leaf_entry_t *lastlep; /* pointer to last entry */
11101089 struct xfs_dir2_leaf *leaf = bp->b_addr;
1111
- struct xfs_dir2_leaf_entry *ents;
11121090
11131091 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) ||
11141092 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC) ||
11151093 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
11161094 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC));
11171095
1118
- ents = args->dp->d_ops->leaf_ents_p(leaf);
1119
- firstlep = &ents[first];
1120
- lastlep = &ents[last];
1096
+ firstlep = &hdr->ents[first];
1097
+ lastlep = &hdr->ents[last];
11211098 xfs_trans_log_buf(args->trans, bp,
11221099 (uint)((char *)firstlep - (char *)leaf),
11231100 (uint)((char *)lastlep - (char *)leaf + sizeof(*lastlep) - 1));
....@@ -1140,7 +1117,7 @@
11401117
11411118 xfs_trans_log_buf(args->trans, bp,
11421119 (uint)((char *)&leaf->hdr - (char *)leaf),
1143
- args->dp->d_ops->leaf_hdr_size - 1);
1120
+ args->geo->leaf_hdr_size - 1);
11441121 }
11451122
11461123 /*
....@@ -1179,28 +1156,27 @@
11791156 int error; /* error return code */
11801157 int index; /* found entry index */
11811158 struct xfs_buf *lbp; /* leaf buffer */
1182
- xfs_dir2_leaf_t *leaf; /* leaf structure */
11831159 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
11841160 xfs_trans_t *tp; /* transaction pointer */
1185
- struct xfs_dir2_leaf_entry *ents;
1161
+ struct xfs_dir3_icleaf_hdr leafhdr;
11861162
11871163 trace_xfs_dir2_leaf_lookup(args);
11881164
11891165 /*
11901166 * Look up name in the leaf block, returning both buffers and index.
11911167 */
1192
- if ((error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp))) {
1168
+ error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp, &leafhdr);
1169
+ if (error)
11931170 return error;
1194
- }
1171
+
11951172 tp = args->trans;
11961173 dp = args->dp;
11971174 xfs_dir3_leaf_check(dp, lbp);
1198
- leaf = lbp->b_addr;
1199
- ents = dp->d_ops->leaf_ents_p(leaf);
1175
+
12001176 /*
12011177 * Get to the leaf entry and contained data entry address.
12021178 */
1203
- lep = &ents[index];
1179
+ lep = &leafhdr.ents[index];
12041180
12051181 /*
12061182 * Point to the data entry.
....@@ -1212,7 +1188,7 @@
12121188 * Return the found inode number & CI name if appropriate
12131189 */
12141190 args->inumber = be64_to_cpu(dep->inumber);
1215
- args->filetype = dp->d_ops->data_get_ftype(dep);
1191
+ args->filetype = xfs_dir2_data_get_ftype(dp->i_mount, dep);
12161192 error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
12171193 xfs_trans_brelse(tp, dbp);
12181194 xfs_trans_brelse(tp, lbp);
....@@ -1230,7 +1206,8 @@
12301206 xfs_da_args_t *args, /* operation arguments */
12311207 struct xfs_buf **lbpp, /* out: leaf buffer */
12321208 int *indexp, /* out: index in leaf block */
1233
- struct xfs_buf **dbpp) /* out: data buffer */
1209
+ struct xfs_buf **dbpp, /* out: data buffer */
1210
+ struct xfs_dir3_icleaf_hdr *leafhdr)
12341211 {
12351212 xfs_dir2_db_t curdb = -1; /* current data block number */
12361213 struct xfs_buf *dbp = NULL; /* data buffer */
....@@ -1246,22 +1223,19 @@
12461223 xfs_trans_t *tp; /* transaction pointer */
12471224 xfs_dir2_db_t cidb = -1; /* case match data block no. */
12481225 enum xfs_dacmp cmp; /* name compare result */
1249
- struct xfs_dir2_leaf_entry *ents;
1250
- struct xfs_dir3_icleaf_hdr leafhdr;
12511226
12521227 dp = args->dp;
12531228 tp = args->trans;
12541229 mp = dp->i_mount;
12551230
1256
- error = xfs_dir3_leaf_read(tp, dp, args->geo->leafblk, -1, &lbp);
1231
+ error = xfs_dir3_leaf_read(tp, dp, args->geo->leafblk, &lbp);
12571232 if (error)
12581233 return error;
12591234
12601235 *lbpp = lbp;
12611236 leaf = lbp->b_addr;
12621237 xfs_dir3_leaf_check(dp, lbp);
1263
- ents = dp->d_ops->leaf_ents_p(leaf);
1264
- dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
1238
+ xfs_dir2_leaf_hdr_from_disk(mp, leafhdr, leaf);
12651239
12661240 /*
12671241 * Look for the first leaf entry with our hash value.
....@@ -1271,8 +1245,9 @@
12711245 * Loop over all the entries with the right hash value
12721246 * looking to match the name.
12731247 */
1274
- for (lep = &ents[index];
1275
- index < leafhdr.count && be32_to_cpu(lep->hashval) == args->hashval;
1248
+ for (lep = &leafhdr->ents[index];
1249
+ index < leafhdr->count &&
1250
+ be32_to_cpu(lep->hashval) == args->hashval;
12761251 lep++, index++) {
12771252 /*
12781253 * Skip over stale leaf entries.
....@@ -1293,7 +1268,7 @@
12931268 xfs_trans_brelse(tp, dbp);
12941269 error = xfs_dir3_data_read(tp, dp,
12951270 xfs_dir2_db_to_da(args->geo, newdb),
1296
- -1, &dbp);
1271
+ 0, &dbp);
12971272 if (error) {
12981273 xfs_trans_brelse(tp, lbp);
12991274 return error;
....@@ -1311,7 +1286,7 @@
13111286 * and buffer. If it's the first case-insensitive match, store
13121287 * the index and buffer and continue looking for an exact match.
13131288 */
1314
- cmp = mp->m_dirnameops->compname(args, dep->name, dep->namelen);
1289
+ cmp = xfs_dir2_compname(args, dep->name, dep->namelen);
13151290 if (cmp != XFS_CMP_DIFFERENT && cmp != args->cmpresult) {
13161291 args->cmpresult = cmp;
13171292 *indexp = index;
....@@ -1335,7 +1310,7 @@
13351310 xfs_trans_brelse(tp, dbp);
13361311 error = xfs_dir3_data_read(tp, dp,
13371312 xfs_dir2_db_to_da(args->geo, cidb),
1338
- -1, &dbp);
1313
+ 0, &dbp);
13391314 if (error) {
13401315 xfs_trans_brelse(tp, lbp);
13411316 return error;
....@@ -1361,6 +1336,7 @@
13611336 xfs_dir2_leaf_removename(
13621337 xfs_da_args_t *args) /* operation arguments */
13631338 {
1339
+ struct xfs_da_geometry *geo = args->geo;
13641340 __be16 *bestsp; /* leaf block best freespace */
13651341 xfs_dir2_data_hdr_t *hdr; /* data block header */
13661342 xfs_dir2_db_t db; /* data block number */
....@@ -1378,7 +1354,6 @@
13781354 int needscan; /* need to rescan data frees */
13791355 xfs_dir2_data_off_t oldbest; /* old value of best free */
13801356 struct xfs_dir2_data_free *bf; /* bestfree table */
1381
- struct xfs_dir2_leaf_entry *ents;
13821357 struct xfs_dir3_icleaf_hdr leafhdr;
13831358
13841359 trace_xfs_dir2_leaf_removename(args);
....@@ -1386,51 +1361,54 @@
13861361 /*
13871362 * Lookup the leaf entry, get the leaf and data blocks read in.
13881363 */
1389
- if ((error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp))) {
1364
+ error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp, &leafhdr);
1365
+ if (error)
13901366 return error;
1391
- }
1367
+
13921368 dp = args->dp;
13931369 leaf = lbp->b_addr;
13941370 hdr = dbp->b_addr;
13951371 xfs_dir3_data_check(dp, dbp);
1396
- bf = dp->d_ops->data_bestfree_p(hdr);
1397
- dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
1398
- ents = dp->d_ops->leaf_ents_p(leaf);
1372
+ bf = xfs_dir2_data_bestfree_p(dp->i_mount, hdr);
1373
+
13991374 /*
14001375 * Point to the leaf entry, use that to point to the data entry.
14011376 */
1402
- lep = &ents[index];
1403
- db = xfs_dir2_dataptr_to_db(args->geo, be32_to_cpu(lep->address));
1377
+ lep = &leafhdr.ents[index];
1378
+ db = xfs_dir2_dataptr_to_db(geo, be32_to_cpu(lep->address));
14041379 dep = (xfs_dir2_data_entry_t *)((char *)hdr +
1405
- xfs_dir2_dataptr_to_off(args->geo, be32_to_cpu(lep->address)));
1380
+ xfs_dir2_dataptr_to_off(geo, be32_to_cpu(lep->address)));
14061381 needscan = needlog = 0;
14071382 oldbest = be16_to_cpu(bf[0].length);
1408
- ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
1383
+ ltp = xfs_dir2_leaf_tail_p(geo, leaf);
14091384 bestsp = xfs_dir2_leaf_bests_p(ltp);
1410
- if (be16_to_cpu(bestsp[db]) != oldbest)
1385
+ if (be16_to_cpu(bestsp[db]) != oldbest) {
1386
+ xfs_buf_mark_corrupt(lbp);
14111387 return -EFSCORRUPTED;
1388
+ }
14121389 /*
14131390 * Mark the former data entry unused.
14141391 */
14151392 xfs_dir2_data_make_free(args, dbp,
14161393 (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr),
1417
- dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan);
1394
+ xfs_dir2_data_entsize(dp->i_mount, dep->namelen), &needlog,
1395
+ &needscan);
14181396 /*
14191397 * We just mark the leaf entry stale by putting a null in it.
14201398 */
14211399 leafhdr.stale++;
1422
- dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
1400
+ xfs_dir2_leaf_hdr_to_disk(dp->i_mount, leaf, &leafhdr);
14231401 xfs_dir3_leaf_log_header(args, lbp);
14241402
14251403 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
1426
- xfs_dir3_leaf_log_ents(args, lbp, index, index);
1404
+ xfs_dir3_leaf_log_ents(args, &leafhdr, lbp, index, index);
14271405
14281406 /*
14291407 * Scan the freespace in the data block again if necessary,
14301408 * log the data block header if necessary.
14311409 */
14321410 if (needscan)
1433
- xfs_dir2_data_freescan(dp, hdr, &needlog);
1411
+ xfs_dir2_data_freescan(dp->i_mount, hdr, &needlog);
14341412 if (needlog)
14351413 xfs_dir2_data_log_header(args, dbp);
14361414 /*
....@@ -1446,8 +1424,8 @@
14461424 * If the data block is now empty then get rid of the data block.
14471425 */
14481426 if (be16_to_cpu(bf[0].length) ==
1449
- args->geo->blksize - dp->d_ops->data_entry_offset) {
1450
- ASSERT(db != args->geo->datablk);
1427
+ geo->blksize - geo->data_entry_offset) {
1428
+ ASSERT(db != geo->datablk);
14511429 if ((error = xfs_dir2_shrink_inode(args, db, dbp))) {
14521430 /*
14531431 * Nope, can't get rid of it because it caused
....@@ -1489,7 +1467,7 @@
14891467 /*
14901468 * If the data block was not the first one, drop it.
14911469 */
1492
- else if (db != args->geo->datablk)
1470
+ else if (db != geo->datablk)
14931471 dbp = NULL;
14941472
14951473 xfs_dir3_leaf_check(dp, lbp);
....@@ -1512,26 +1490,24 @@
15121490 int error; /* error return code */
15131491 int index; /* index of leaf entry */
15141492 struct xfs_buf *lbp; /* leaf buffer */
1515
- xfs_dir2_leaf_t *leaf; /* leaf structure */
15161493 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
15171494 xfs_trans_t *tp; /* transaction pointer */
1518
- struct xfs_dir2_leaf_entry *ents;
1495
+ struct xfs_dir3_icleaf_hdr leafhdr;
15191496
15201497 trace_xfs_dir2_leaf_replace(args);
15211498
15221499 /*
15231500 * Look up the entry.
15241501 */
1525
- if ((error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp))) {
1502
+ error = xfs_dir2_leaf_lookup_int(args, &lbp, &index, &dbp, &leafhdr);
1503
+ if (error)
15261504 return error;
1527
- }
1505
+
15281506 dp = args->dp;
1529
- leaf = lbp->b_addr;
1530
- ents = dp->d_ops->leaf_ents_p(leaf);
15311507 /*
15321508 * Point to the leaf entry, get data address from it.
15331509 */
1534
- lep = &ents[index];
1510
+ lep = &leafhdr.ents[index];
15351511 /*
15361512 * Point to the data entry.
15371513 */
....@@ -1543,7 +1519,7 @@
15431519 * Put the new inode number in, log it.
15441520 */
15451521 dep->inumber = cpu_to_be64(args->inumber);
1546
- dp->d_ops->data_put_ftype(dep, args->filetype);
1522
+ xfs_dir2_data_put_ftype(dp->i_mount, dep, args->filetype);
15471523 tp = args->trans;
15481524 xfs_dir2_data_log_entry(args, dbp, dep);
15491525 xfs_dir3_leaf_check(dp, lbp);
....@@ -1565,21 +1541,17 @@
15651541 xfs_dahash_t hashwant; /* hash value looking for */
15661542 int high; /* high leaf index */
15671543 int low; /* low leaf index */
1568
- xfs_dir2_leaf_t *leaf; /* leaf structure */
15691544 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
15701545 int mid=0; /* current leaf index */
1571
- struct xfs_dir2_leaf_entry *ents;
15721546 struct xfs_dir3_icleaf_hdr leafhdr;
15731547
1574
- leaf = lbp->b_addr;
1575
- ents = args->dp->d_ops->leaf_ents_p(leaf);
1576
- args->dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
1548
+ xfs_dir2_leaf_hdr_from_disk(args->dp->i_mount, &leafhdr, lbp->b_addr);
15771549
15781550 /*
15791551 * Note, the table cannot be empty, so we have to go through the loop.
15801552 * Binary search the leaf entries looking for our hash value.
15811553 */
1582
- for (lep = ents, low = 0, high = leafhdr.count - 1,
1554
+ for (lep = leafhdr.ents, low = 0, high = leafhdr.count - 1,
15831555 hashwant = args->hashval;
15841556 low <= high; ) {
15851557 mid = (low + high) >> 1;
....@@ -1616,6 +1588,7 @@
16161588 struct xfs_buf *lbp, /* leaf buffer */
16171589 xfs_dir2_db_t db) /* data block number */
16181590 {
1591
+ struct xfs_da_geometry *geo = args->geo;
16191592 __be16 *bestsp; /* leaf bests table */
16201593 struct xfs_buf *dbp; /* data block buffer */
16211594 xfs_inode_t *dp; /* incore directory inode */
....@@ -1629,23 +1602,23 @@
16291602 /*
16301603 * Read the offending data block. We need its buffer.
16311604 */
1632
- error = xfs_dir3_data_read(tp, dp, xfs_dir2_db_to_da(args->geo, db),
1633
- -1, &dbp);
1605
+ error = xfs_dir3_data_read(tp, dp, xfs_dir2_db_to_da(geo, db), 0, &dbp);
16341606 if (error)
16351607 return error;
16361608
16371609 leaf = lbp->b_addr;
1638
- ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
1610
+ ltp = xfs_dir2_leaf_tail_p(geo, leaf);
16391611
16401612 #ifdef DEBUG
16411613 {
16421614 struct xfs_dir2_data_hdr *hdr = dbp->b_addr;
1643
- struct xfs_dir2_data_free *bf = dp->d_ops->data_bestfree_p(hdr);
1615
+ struct xfs_dir2_data_free *bf =
1616
+ xfs_dir2_data_bestfree_p(dp->i_mount, hdr);
16441617
16451618 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
16461619 hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC));
16471620 ASSERT(be16_to_cpu(bf[0].length) ==
1648
- args->geo->blksize - dp->d_ops->data_entry_offset);
1621
+ geo->blksize - geo->data_entry_offset);
16491622 ASSERT(db == be32_to_cpu(ltp->bestcount) - 1);
16501623 }
16511624 #endif
....@@ -1703,7 +1676,6 @@
17031676 int error; /* error return code */
17041677 struct xfs_buf *fbp; /* buffer for freespace block */
17051678 xfs_fileoff_t fo; /* freespace file offset */
1706
- xfs_dir2_free_t *free; /* freespace structure */
17071679 struct xfs_buf *lbp; /* buffer for leaf block */
17081680 xfs_dir2_leaf_tail_t *ltp; /* tail of leaf structure */
17091681 xfs_dir2_leaf_t *leaf; /* leaf structure */
....@@ -1761,7 +1733,7 @@
17611733 return 0;
17621734 lbp = state->path.blk[0].bp;
17631735 leaf = lbp->b_addr;
1764
- dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
1736
+ xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, leaf);
17651737
17661738 ASSERT(leafhdr.magic == XFS_DIR2_LEAFN_MAGIC ||
17671739 leafhdr.magic == XFS_DIR3_LEAFN_MAGIC);
....@@ -1772,8 +1744,7 @@
17721744 error = xfs_dir2_free_read(tp, dp, args->geo->freeblk, &fbp);
17731745 if (error)
17741746 return error;
1775
- free = fbp->b_addr;
1776
- dp->d_ops->free_hdr_from_disk(&freehdr, free);
1747
+ xfs_dir2_free_hdr_from_disk(mp, &freehdr, fbp->b_addr);
17771748
17781749 ASSERT(!freehdr.firstdb);
17791750
....@@ -1807,10 +1778,10 @@
18071778 /*
18081779 * Set up the leaf bests table.
18091780 */
1810
- memcpy(xfs_dir2_leaf_bests_p(ltp), dp->d_ops->free_bests_p(free),
1781
+ memcpy(xfs_dir2_leaf_bests_p(ltp), freehdr.bests,
18111782 freehdr.nvalid * sizeof(xfs_dir2_data_off_t));
18121783
1813
- dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
1784
+ xfs_dir2_leaf_hdr_to_disk(mp, leaf, &leafhdr);
18141785 xfs_dir3_leaf_log_header(args, lbp);
18151786 xfs_dir3_leaf_log_bests(args, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
18161787 xfs_dir3_leaf_log_tail(args, lbp);