diff options
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_da_btree.c | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_da_format.c | 220 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2.h | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_block.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_data.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_node.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_readdir.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_sf.c | 6 |
10 files changed, 112 insertions, 176 deletions
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index a51762dae543..796272a2e129 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
@@ -333,8 +333,7 @@ xfs_da3_node_create( | |||
333 | 333 | ||
334 | dp->d_ops->node_hdr_to_disk(node, &ichdr); | 334 | dp->d_ops->node_hdr_to_disk(node, &ichdr); |
335 | xfs_trans_log_buf(tp, bp, | 335 | xfs_trans_log_buf(tp, bp, |
336 | XFS_DA_LOGRANGE(node, &node->hdr, | 336 | XFS_DA_LOGRANGE(node, &node->hdr, dp->d_ops->node_hdr_size)); |
337 | dp->d_ops->node_hdr_size())); | ||
338 | 337 | ||
339 | *bpp = bp; | 338 | *bpp = bp; |
340 | return(0); | 339 | return(0); |
@@ -838,13 +837,12 @@ xfs_da3_node_rebalance( | |||
838 | */ | 837 | */ |
839 | dp->d_ops->node_hdr_to_disk(node1, &nodehdr1); | 838 | dp->d_ops->node_hdr_to_disk(node1, &nodehdr1); |
840 | xfs_trans_log_buf(tp, blk1->bp, | 839 | xfs_trans_log_buf(tp, blk1->bp, |
841 | XFS_DA_LOGRANGE(node1, &node1->hdr, | 840 | XFS_DA_LOGRANGE(node1, &node1->hdr, dp->d_ops->node_hdr_size)); |
842 | dp->d_ops->node_hdr_size())); | ||
843 | 841 | ||
844 | dp->d_ops->node_hdr_to_disk(node2, &nodehdr2); | 842 | dp->d_ops->node_hdr_to_disk(node2, &nodehdr2); |
845 | xfs_trans_log_buf(tp, blk2->bp, | 843 | xfs_trans_log_buf(tp, blk2->bp, |
846 | XFS_DA_LOGRANGE(node2, &node2->hdr, | 844 | XFS_DA_LOGRANGE(node2, &node2->hdr, |
847 | dp->d_ops->node_hdr_size() + | 845 | dp->d_ops->node_hdr_size + |
848 | (sizeof(btree2[0]) * nodehdr2.count))); | 846 | (sizeof(btree2[0]) * nodehdr2.count))); |
849 | 847 | ||
850 | /* | 848 | /* |
@@ -915,7 +913,7 @@ xfs_da3_node_add( | |||
915 | nodehdr.count += 1; | 913 | nodehdr.count += 1; |
916 | dp->d_ops->node_hdr_to_disk(node, &nodehdr); | 914 | dp->d_ops->node_hdr_to_disk(node, &nodehdr); |
917 | xfs_trans_log_buf(state->args->trans, oldblk->bp, | 915 | xfs_trans_log_buf(state->args->trans, oldblk->bp, |
918 | XFS_DA_LOGRANGE(node, &node->hdr, dp->d_ops->node_hdr_size())); | 916 | XFS_DA_LOGRANGE(node, &node->hdr, dp->d_ops->node_hdr_size)); |
919 | 917 | ||
920 | /* | 918 | /* |
921 | * Copy the last hash value from the oldblk to propagate upwards. | 919 | * Copy the last hash value from the oldblk to propagate upwards. |
@@ -1350,7 +1348,7 @@ xfs_da3_node_remove( | |||
1350 | nodehdr.count -= 1; | 1348 | nodehdr.count -= 1; |
1351 | dp->d_ops->node_hdr_to_disk(node, &nodehdr); | 1349 | dp->d_ops->node_hdr_to_disk(node, &nodehdr); |
1352 | xfs_trans_log_buf(state->args->trans, drop_blk->bp, | 1350 | xfs_trans_log_buf(state->args->trans, drop_blk->bp, |
1353 | XFS_DA_LOGRANGE(node, &node->hdr, dp->d_ops->node_hdr_size())); | 1351 | XFS_DA_LOGRANGE(node, &node->hdr, dp->d_ops->node_hdr_size)); |
1354 | 1352 | ||
1355 | /* | 1353 | /* |
1356 | * Copy the last hash value from the block to propagate upwards. | 1354 | * Copy the last hash value from the block to propagate upwards. |
@@ -1423,7 +1421,7 @@ xfs_da3_node_unbalance( | |||
1423 | dp->d_ops->node_hdr_to_disk(save_node, &save_hdr); | 1421 | dp->d_ops->node_hdr_to_disk(save_node, &save_hdr); |
1424 | xfs_trans_log_buf(tp, save_blk->bp, | 1422 | xfs_trans_log_buf(tp, save_blk->bp, |
1425 | XFS_DA_LOGRANGE(save_node, &save_node->hdr, | 1423 | XFS_DA_LOGRANGE(save_node, &save_node->hdr, |
1426 | dp->d_ops->node_hdr_size())); | 1424 | dp->d_ops->node_hdr_size)); |
1427 | 1425 | ||
1428 | /* | 1426 | /* |
1429 | * Save the last hashval in the remaining block for upward propagation. | 1427 | * Save the last hashval in the remaining block for upward propagation. |
diff --git a/fs/xfs/xfs_da_format.c b/fs/xfs/xfs_da_format.c index 01e6f9a9b804..40f18d3b7b9b 100644 --- a/fs/xfs/xfs_da_format.c +++ b/fs/xfs/xfs_da_format.c | |||
@@ -209,31 +209,41 @@ xfs_dir3_sfe_put_ino( | |||
209 | /* | 209 | /* |
210 | * Directory data block operations | 210 | * Directory data block operations |
211 | */ | 211 | */ |
212 | static int | ||
213 | __xfs_dir3_data_entsize( | ||
214 | bool ftype, | ||
215 | int n) | ||
216 | { | ||
217 | int size = offsetof(struct xfs_dir2_data_entry, name[0]); | ||
218 | 212 | ||
219 | size += n; | 213 | /* |
220 | size += sizeof(xfs_dir2_data_off_t); | 214 | * For special situations, the dirent size ends up fixed because we always know |
221 | if (ftype) | 215 | * what the size of the entry is. That's true for the "." and "..", and |
222 | size += sizeof(__uint8_t); | 216 | * therefore we know that they are a fixed size and hence their offsets are |
223 | return roundup(size, XFS_DIR2_DATA_ALIGN); | 217 | * constant, as is the first entry. |
224 | } | 218 | * |
219 | * Hence, this calculation is written as a macro to be able to be calculated at | ||
220 | * compile time and so certain offsets can be calculated directly in the | ||
221 | * structure initaliser via the macro. There are two macros - one for dirents | ||
222 | * with ftype and without so there are no unresolvable conditionals in the | ||
223 | * calculations. We also use round_up() as XFS_DIR2_DATA_ALIGN is always a power | ||
224 | * of 2 and the compiler doesn't reject it (unlike roundup()). | ||
225 | */ | ||
226 | #define XFS_DIR2_DATA_ENTSIZE(n) \ | ||
227 | round_up((offsetof(struct xfs_dir2_data_entry, name[0]) + (n) + \ | ||
228 | sizeof(xfs_dir2_data_off_t)), XFS_DIR2_DATA_ALIGN) | ||
229 | |||
230 | #define XFS_DIR3_DATA_ENTSIZE(n) \ | ||
231 | round_up((offsetof(struct xfs_dir2_data_entry, name[0]) + (n) + \ | ||
232 | sizeof(xfs_dir2_data_off_t) + sizeof(__uint8_t)), \ | ||
233 | XFS_DIR2_DATA_ALIGN) | ||
225 | 234 | ||
226 | static int | 235 | static int |
227 | xfs_dir2_data_entsize( | 236 | xfs_dir2_data_entsize( |
228 | int n) | 237 | int n) |
229 | { | 238 | { |
230 | return __xfs_dir3_data_entsize(false, n); | 239 | return XFS_DIR2_DATA_ENTSIZE(n); |
231 | } | 240 | } |
241 | |||
232 | static int | 242 | static int |
233 | xfs_dir3_data_entsize( | 243 | xfs_dir3_data_entsize( |
234 | int n) | 244 | int n) |
235 | { | 245 | { |
236 | return __xfs_dir3_data_entsize(true, n); | 246 | return XFS_DIR3_DATA_ENTSIZE(n); |
237 | } | 247 | } |
238 | 248 | ||
239 | static __uint8_t | 249 | static __uint8_t |
@@ -294,45 +304,6 @@ xfs_dir3_data_entry_tag_p( | |||
294 | } | 304 | } |
295 | 305 | ||
296 | /* | 306 | /* |
297 | * Offsets of . and .. in data space (always block 0) | ||
298 | */ | ||
299 | static xfs_dir2_data_aoff_t | ||
300 | xfs_dir2_data_dot_offset(void) | ||
301 | { | ||
302 | return sizeof(struct xfs_dir2_data_hdr); | ||
303 | } | ||
304 | |||
305 | static xfs_dir2_data_aoff_t | ||
306 | xfs_dir2_data_dotdot_offset(void) | ||
307 | { | ||
308 | return xfs_dir2_data_dot_offset() + xfs_dir2_data_entsize(1); | ||
309 | } | ||
310 | |||
311 | static xfs_dir2_data_aoff_t | ||
312 | xfs_dir2_data_first_offset(void) | ||
313 | { | ||
314 | return xfs_dir2_data_dotdot_offset() + xfs_dir2_data_entsize(2); | ||
315 | } | ||
316 | |||
317 | static xfs_dir2_data_aoff_t | ||
318 | xfs_dir3_data_dot_offset(void) | ||
319 | { | ||
320 | return sizeof(struct xfs_dir3_data_hdr); | ||
321 | } | ||
322 | |||
323 | static xfs_dir2_data_aoff_t | ||
324 | xfs_dir3_data_dotdot_offset(void) | ||
325 | { | ||
326 | return xfs_dir3_data_dot_offset() + xfs_dir3_data_entsize(1); | ||
327 | } | ||
328 | |||
329 | static xfs_dir2_data_aoff_t | ||
330 | xfs_dir3_data_first_offset(void) | ||
331 | { | ||
332 | return xfs_dir3_data_dotdot_offset() + xfs_dir3_data_entsize(2); | ||
333 | } | ||
334 | |||
335 | /* | ||
336 | * location of . and .. in data space (always block 0) | 307 | * location of . and .. in data space (always block 0) |
337 | */ | 308 | */ |
338 | static struct xfs_dir2_data_entry * | 309 | static struct xfs_dir2_data_entry * |
@@ -340,7 +311,7 @@ xfs_dir2_data_dot_entry_p( | |||
340 | struct xfs_dir2_data_hdr *hdr) | 311 | struct xfs_dir2_data_hdr *hdr) |
341 | { | 312 | { |
342 | return (struct xfs_dir2_data_entry *) | 313 | return (struct xfs_dir2_data_entry *) |
343 | ((char *)hdr + xfs_dir2_data_dot_offset()); | 314 | ((char *)hdr + sizeof(struct xfs_dir2_data_hdr)); |
344 | } | 315 | } |
345 | 316 | ||
346 | static struct xfs_dir2_data_entry * | 317 | static struct xfs_dir2_data_entry * |
@@ -348,7 +319,8 @@ xfs_dir2_data_dotdot_entry_p( | |||
348 | struct xfs_dir2_data_hdr *hdr) | 319 | struct xfs_dir2_data_hdr *hdr) |
349 | { | 320 | { |
350 | return (struct xfs_dir2_data_entry *) | 321 | return (struct xfs_dir2_data_entry *) |
351 | ((char *)hdr + xfs_dir2_data_dotdot_offset()); | 322 | ((char *)hdr + sizeof(struct xfs_dir2_data_hdr) + |
323 | XFS_DIR2_DATA_ENTSIZE(1)); | ||
352 | } | 324 | } |
353 | 325 | ||
354 | static struct xfs_dir2_data_entry * | 326 | static struct xfs_dir2_data_entry * |
@@ -356,7 +328,9 @@ xfs_dir2_data_first_entry_p( | |||
356 | struct xfs_dir2_data_hdr *hdr) | 328 | struct xfs_dir2_data_hdr *hdr) |
357 | { | 329 | { |
358 | return (struct xfs_dir2_data_entry *) | 330 | return (struct xfs_dir2_data_entry *) |
359 | ((char *)hdr + xfs_dir2_data_first_offset()); | 331 | ((char *)hdr + sizeof(struct xfs_dir2_data_hdr) + |
332 | XFS_DIR2_DATA_ENTSIZE(1) + | ||
333 | XFS_DIR2_DATA_ENTSIZE(2)); | ||
360 | } | 334 | } |
361 | 335 | ||
362 | static struct xfs_dir2_data_entry * | 336 | static struct xfs_dir2_data_entry * |
@@ -364,7 +338,7 @@ xfs_dir3_data_dot_entry_p( | |||
364 | struct xfs_dir2_data_hdr *hdr) | 338 | struct xfs_dir2_data_hdr *hdr) |
365 | { | 339 | { |
366 | return (struct xfs_dir2_data_entry *) | 340 | return (struct xfs_dir2_data_entry *) |
367 | ((char *)hdr + xfs_dir3_data_dot_offset()); | 341 | ((char *)hdr + sizeof(struct xfs_dir3_data_hdr)); |
368 | } | 342 | } |
369 | 343 | ||
370 | static struct xfs_dir2_data_entry * | 344 | static struct xfs_dir2_data_entry * |
@@ -372,7 +346,8 @@ xfs_dir3_data_dotdot_entry_p( | |||
372 | struct xfs_dir2_data_hdr *hdr) | 346 | struct xfs_dir2_data_hdr *hdr) |
373 | { | 347 | { |
374 | return (struct xfs_dir2_data_entry *) | 348 | return (struct xfs_dir2_data_entry *) |
375 | ((char *)hdr + xfs_dir3_data_dotdot_offset()); | 349 | ((char *)hdr + sizeof(struct xfs_dir3_data_hdr) + |
350 | XFS_DIR3_DATA_ENTSIZE(1)); | ||
376 | } | 351 | } |
377 | 352 | ||
378 | static struct xfs_dir2_data_entry * | 353 | static struct xfs_dir2_data_entry * |
@@ -380,7 +355,9 @@ xfs_dir3_data_first_entry_p( | |||
380 | struct xfs_dir2_data_hdr *hdr) | 355 | struct xfs_dir2_data_hdr *hdr) |
381 | { | 356 | { |
382 | return (struct xfs_dir2_data_entry *) | 357 | return (struct xfs_dir2_data_entry *) |
383 | ((char *)hdr + xfs_dir3_data_first_offset()); | 358 | ((char *)hdr + sizeof(struct xfs_dir3_data_hdr) + |
359 | XFS_DIR3_DATA_ENTSIZE(1) + | ||
360 | XFS_DIR3_DATA_ENTSIZE(2)); | ||
384 | } | 361 | } |
385 | 362 | ||
386 | static struct xfs_dir2_data_free * | 363 | static struct xfs_dir2_data_free * |
@@ -395,44 +372,32 @@ xfs_dir3_data_bestfree_p(struct xfs_dir2_data_hdr *hdr) | |||
395 | return ((struct xfs_dir3_data_hdr *)hdr)->best_free; | 372 | return ((struct xfs_dir3_data_hdr *)hdr)->best_free; |
396 | } | 373 | } |
397 | 374 | ||
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 * | 375 | static struct xfs_dir2_data_entry * |
405 | xfs_dir2_data_entry_p(struct xfs_dir2_data_hdr *hdr) | 376 | xfs_dir2_data_entry_p(struct xfs_dir2_data_hdr *hdr) |
406 | { | 377 | { |
407 | return (struct xfs_dir2_data_entry *) | 378 | return (struct xfs_dir2_data_entry *) |
408 | ((char *)hdr + xfs_dir2_data_entry_offset()); | 379 | ((char *)hdr + sizeof(struct xfs_dir2_data_hdr)); |
409 | } | 380 | } |
410 | 381 | ||
411 | static struct xfs_dir2_data_unused * | 382 | static struct xfs_dir2_data_unused * |
412 | xfs_dir2_data_unused_p(struct xfs_dir2_data_hdr *hdr) | 383 | xfs_dir2_data_unused_p(struct xfs_dir2_data_hdr *hdr) |
413 | { | 384 | { |
414 | return (struct xfs_dir2_data_unused *) | 385 | return (struct xfs_dir2_data_unused *) |
415 | ((char *)hdr + xfs_dir2_data_entry_offset()); | 386 | ((char *)hdr + sizeof(struct xfs_dir2_data_hdr)); |
416 | } | ||
417 | |||
418 | static size_t | ||
419 | xfs_dir3_data_entry_offset(void) | ||
420 | { | ||
421 | return sizeof(struct xfs_dir3_data_hdr); | ||
422 | } | 387 | } |
423 | 388 | ||
424 | static struct xfs_dir2_data_entry * | 389 | static struct xfs_dir2_data_entry * |
425 | xfs_dir3_data_entry_p(struct xfs_dir2_data_hdr *hdr) | 390 | xfs_dir3_data_entry_p(struct xfs_dir2_data_hdr *hdr) |
426 | { | 391 | { |
427 | return (struct xfs_dir2_data_entry *) | 392 | return (struct xfs_dir2_data_entry *) |
428 | ((char *)hdr + xfs_dir3_data_entry_offset()); | 393 | ((char *)hdr + sizeof(struct xfs_dir3_data_hdr)); |
429 | } | 394 | } |
430 | 395 | ||
431 | static struct xfs_dir2_data_unused * | 396 | static struct xfs_dir2_data_unused * |
432 | xfs_dir3_data_unused_p(struct xfs_dir2_data_hdr *hdr) | 397 | xfs_dir3_data_unused_p(struct xfs_dir2_data_hdr *hdr) |
433 | { | 398 | { |
434 | return (struct xfs_dir2_data_unused *) | 399 | return (struct xfs_dir2_data_unused *) |
435 | ((char *)hdr + xfs_dir3_data_entry_offset()); | 400 | ((char *)hdr + sizeof(struct xfs_dir3_data_hdr)); |
436 | } | 401 | } |
437 | 402 | ||
438 | 403 | ||
@@ -440,15 +405,9 @@ xfs_dir3_data_unused_p(struct xfs_dir2_data_hdr *hdr) | |||
440 | * Directory Leaf block operations | 405 | * Directory Leaf block operations |
441 | */ | 406 | */ |
442 | static int | 407 | static int |
443 | xfs_dir2_leaf_hdr_size(void) | ||
444 | { | ||
445 | return sizeof(struct xfs_dir2_leaf_hdr); | ||
446 | } | ||
447 | |||
448 | static int | ||
449 | xfs_dir2_max_leaf_ents(struct xfs_mount *mp) | 408 | xfs_dir2_max_leaf_ents(struct xfs_mount *mp) |
450 | { | 409 | { |
451 | return (mp->m_dirblksize - xfs_dir2_leaf_hdr_size()) / | 410 | return (mp->m_dirblksize - sizeof(struct xfs_dir2_leaf_hdr)) / |
452 | (uint)sizeof(struct xfs_dir2_leaf_entry); | 411 | (uint)sizeof(struct xfs_dir2_leaf_entry); |
453 | } | 412 | } |
454 | 413 | ||
@@ -459,15 +418,9 @@ xfs_dir2_leaf_ents_p(struct xfs_dir2_leaf *lp) | |||
459 | } | 418 | } |
460 | 419 | ||
461 | static int | 420 | static int |
462 | xfs_dir3_leaf_hdr_size(void) | ||
463 | { | ||
464 | return sizeof(struct xfs_dir3_leaf_hdr); | ||
465 | } | ||
466 | |||
467 | static int | ||
468 | xfs_dir3_max_leaf_ents(struct xfs_mount *mp) | 421 | xfs_dir3_max_leaf_ents(struct xfs_mount *mp) |
469 | { | 422 | { |
470 | return (mp->m_dirblksize - xfs_dir3_leaf_hdr_size()) / | 423 | return (mp->m_dirblksize - sizeof(struct xfs_dir3_leaf_hdr)) / |
471 | (uint)sizeof(struct xfs_dir2_leaf_entry); | 424 | (uint)sizeof(struct xfs_dir2_leaf_entry); |
472 | } | 425 | } |
473 | 426 | ||
@@ -545,25 +498,13 @@ xfs_dir3_leaf_hdr_to_disk( | |||
545 | /* | 498 | /* |
546 | * Directory/Attribute Node block operations | 499 | * Directory/Attribute Node block operations |
547 | */ | 500 | */ |
548 | static inline int | ||
549 | xfs_da2_node_hdr_size(void) | ||
550 | { | ||
551 | return sizeof(struct xfs_da_node_hdr); | ||
552 | } | ||
553 | |||
554 | static struct xfs_da_node_entry * | 501 | static struct xfs_da_node_entry * |
555 | xfs_da2_node_tree_p(struct xfs_da_intnode *dap) | 502 | xfs_da2_node_tree_p(struct xfs_da_intnode *dap) |
556 | { | 503 | { |
557 | return dap->__btree; | 504 | return dap->__btree; |
558 | } | 505 | } |
559 | 506 | ||
560 | static inline int | 507 | static struct xfs_da_node_entry * |
561 | xfs_da3_node_hdr_size(void) | ||
562 | { | ||
563 | return sizeof(struct xfs_da3_node_hdr); | ||
564 | } | ||
565 | |||
566 | static inline struct xfs_da_node_entry * | ||
567 | xfs_da3_node_tree_p(struct xfs_da_intnode *dap) | 508 | xfs_da3_node_tree_p(struct xfs_da_intnode *dap) |
568 | { | 509 | { |
569 | return ((struct xfs_da3_intnode *)dap)->__btree; | 510 | return ((struct xfs_da3_intnode *)dap)->__btree; |
@@ -630,22 +571,16 @@ xfs_da3_node_hdr_to_disk( | |||
630 | * Directory free space block operations | 571 | * Directory free space block operations |
631 | */ | 572 | */ |
632 | static int | 573 | static int |
633 | xfs_dir2_free_hdr_size(void) | ||
634 | { | ||
635 | return sizeof(struct xfs_dir2_free_hdr); | ||
636 | } | ||
637 | |||
638 | static int | ||
639 | xfs_dir2_free_max_bests(struct xfs_mount *mp) | 574 | xfs_dir2_free_max_bests(struct xfs_mount *mp) |
640 | { | 575 | { |
641 | return (mp->m_dirblksize - xfs_dir2_free_hdr_size()) / | 576 | return (mp->m_dirblksize - sizeof(struct xfs_dir2_free_hdr)) / |
642 | sizeof(xfs_dir2_data_off_t); | 577 | sizeof(xfs_dir2_data_off_t); |
643 | } | 578 | } |
644 | 579 | ||
645 | static __be16 * | 580 | static __be16 * |
646 | xfs_dir2_free_bests_p(struct xfs_dir2_free *free) | 581 | xfs_dir2_free_bests_p(struct xfs_dir2_free *free) |
647 | { | 582 | { |
648 | return (__be16 *)((char *)free + xfs_dir2_free_hdr_size()); | 583 | return (__be16 *)((char *)free + sizeof(struct xfs_dir2_free_hdr)); |
649 | } | 584 | } |
650 | 585 | ||
651 | /* | 586 | /* |
@@ -667,22 +602,16 @@ xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db) | |||
667 | } | 602 | } |
668 | 603 | ||
669 | static int | 604 | static int |
670 | xfs_dir3_free_hdr_size(void) | ||
671 | { | ||
672 | return sizeof(struct xfs_dir3_free_hdr); | ||
673 | } | ||
674 | |||
675 | static int | ||
676 | xfs_dir3_free_max_bests(struct xfs_mount *mp) | 605 | xfs_dir3_free_max_bests(struct xfs_mount *mp) |
677 | { | 606 | { |
678 | return (mp->m_dirblksize - xfs_dir3_free_hdr_size()) / | 607 | return (mp->m_dirblksize - sizeof(struct xfs_dir3_free_hdr)) / |
679 | sizeof(xfs_dir2_data_off_t); | 608 | sizeof(xfs_dir2_data_off_t); |
680 | } | 609 | } |
681 | 610 | ||
682 | static __be16 * | 611 | static __be16 * |
683 | xfs_dir3_free_bests_p(struct xfs_dir2_free *free) | 612 | xfs_dir3_free_bests_p(struct xfs_dir2_free *free) |
684 | { | 613 | { |
685 | return (__be16 *)((char *)free + xfs_dir3_free_hdr_size()); | 614 | return (__be16 *)((char *)free + sizeof(struct xfs_dir3_free_hdr)); |
686 | } | 615 | } |
687 | 616 | ||
688 | /* | 617 | /* |
@@ -774,10 +703,13 @@ const struct xfs_dir_ops xfs_dir2_ops = { | |||
774 | .data_entry_tag_p = xfs_dir2_data_entry_tag_p, | 703 | .data_entry_tag_p = xfs_dir2_data_entry_tag_p, |
775 | .data_bestfree_p = xfs_dir2_data_bestfree_p, | 704 | .data_bestfree_p = xfs_dir2_data_bestfree_p, |
776 | 705 | ||
777 | .data_dot_offset = xfs_dir2_data_dot_offset, | 706 | .data_dot_offset = sizeof(struct xfs_dir2_data_hdr), |
778 | .data_dotdot_offset = xfs_dir2_data_dotdot_offset, | 707 | .data_dotdot_offset = sizeof(struct xfs_dir2_data_hdr) + |
779 | .data_first_offset = xfs_dir2_data_first_offset, | 708 | XFS_DIR2_DATA_ENTSIZE(1), |
780 | .data_entry_offset = xfs_dir2_data_entry_offset, | 709 | .data_first_offset = sizeof(struct xfs_dir2_data_hdr) + |
710 | XFS_DIR2_DATA_ENTSIZE(1) + | ||
711 | XFS_DIR2_DATA_ENTSIZE(2), | ||
712 | .data_entry_offset = sizeof(struct xfs_dir2_data_hdr), | ||
781 | 713 | ||
782 | .data_dot_entry_p = xfs_dir2_data_dot_entry_p, | 714 | .data_dot_entry_p = xfs_dir2_data_dot_entry_p, |
783 | .data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, | 715 | .data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, |
@@ -785,18 +717,18 @@ const struct xfs_dir_ops xfs_dir2_ops = { | |||
785 | .data_entry_p = xfs_dir2_data_entry_p, | 717 | .data_entry_p = xfs_dir2_data_entry_p, |
786 | .data_unused_p = xfs_dir2_data_unused_p, | 718 | .data_unused_p = xfs_dir2_data_unused_p, |
787 | 719 | ||
788 | .leaf_hdr_size = xfs_dir2_leaf_hdr_size, | 720 | .leaf_hdr_size = sizeof(struct xfs_dir2_leaf_hdr), |
789 | .leaf_hdr_to_disk = xfs_dir2_leaf_hdr_to_disk, | 721 | .leaf_hdr_to_disk = xfs_dir2_leaf_hdr_to_disk, |
790 | .leaf_hdr_from_disk = xfs_dir2_leaf_hdr_from_disk, | 722 | .leaf_hdr_from_disk = xfs_dir2_leaf_hdr_from_disk, |
791 | .leaf_max_ents = xfs_dir2_max_leaf_ents, | 723 | .leaf_max_ents = xfs_dir2_max_leaf_ents, |
792 | .leaf_ents_p = xfs_dir2_leaf_ents_p, | 724 | .leaf_ents_p = xfs_dir2_leaf_ents_p, |
793 | 725 | ||
794 | .node_hdr_size = xfs_da2_node_hdr_size, | 726 | .node_hdr_size = sizeof(struct xfs_da_node_hdr), |
795 | .node_hdr_to_disk = xfs_da2_node_hdr_to_disk, | 727 | .node_hdr_to_disk = xfs_da2_node_hdr_to_disk, |
796 | .node_hdr_from_disk = xfs_da2_node_hdr_from_disk, | 728 | .node_hdr_from_disk = xfs_da2_node_hdr_from_disk, |
797 | .node_tree_p = xfs_da2_node_tree_p, | 729 | .node_tree_p = xfs_da2_node_tree_p, |
798 | 730 | ||
799 | .free_hdr_size = xfs_dir2_free_hdr_size, | 731 | .free_hdr_size = sizeof(struct xfs_dir2_free_hdr), |
800 | .free_hdr_to_disk = xfs_dir2_free_hdr_to_disk, | 732 | .free_hdr_to_disk = xfs_dir2_free_hdr_to_disk, |
801 | .free_hdr_from_disk = xfs_dir2_free_hdr_from_disk, | 733 | .free_hdr_from_disk = xfs_dir2_free_hdr_from_disk, |
802 | .free_max_bests = xfs_dir2_free_max_bests, | 734 | .free_max_bests = xfs_dir2_free_max_bests, |
@@ -821,10 +753,13 @@ const struct xfs_dir_ops xfs_dir2_ftype_ops = { | |||
821 | .data_entry_tag_p = xfs_dir3_data_entry_tag_p, | 753 | .data_entry_tag_p = xfs_dir3_data_entry_tag_p, |
822 | .data_bestfree_p = xfs_dir2_data_bestfree_p, | 754 | .data_bestfree_p = xfs_dir2_data_bestfree_p, |
823 | 755 | ||
824 | .data_dot_offset = xfs_dir2_data_dot_offset, | 756 | .data_dot_offset = sizeof(struct xfs_dir2_data_hdr), |
825 | .data_dotdot_offset = xfs_dir2_data_dotdot_offset, | 757 | .data_dotdot_offset = sizeof(struct xfs_dir2_data_hdr) + |
826 | .data_first_offset = xfs_dir2_data_first_offset, | 758 | XFS_DIR3_DATA_ENTSIZE(1), |
827 | .data_entry_offset = xfs_dir2_data_entry_offset, | 759 | .data_first_offset = sizeof(struct xfs_dir2_data_hdr) + |
760 | XFS_DIR3_DATA_ENTSIZE(1) + | ||
761 | XFS_DIR3_DATA_ENTSIZE(2), | ||
762 | .data_entry_offset = sizeof(struct xfs_dir2_data_hdr), | ||
828 | 763 | ||
829 | .data_dot_entry_p = xfs_dir2_data_dot_entry_p, | 764 | .data_dot_entry_p = xfs_dir2_data_dot_entry_p, |
830 | .data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, | 765 | .data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, |
@@ -832,18 +767,18 @@ const struct xfs_dir_ops xfs_dir2_ftype_ops = { | |||
832 | .data_entry_p = xfs_dir2_data_entry_p, | 767 | .data_entry_p = xfs_dir2_data_entry_p, |
833 | .data_unused_p = xfs_dir2_data_unused_p, | 768 | .data_unused_p = xfs_dir2_data_unused_p, |
834 | 769 | ||
835 | .leaf_hdr_size = xfs_dir2_leaf_hdr_size, | 770 | .leaf_hdr_size = sizeof(struct xfs_dir2_leaf_hdr), |
836 | .leaf_hdr_to_disk = xfs_dir2_leaf_hdr_to_disk, | 771 | .leaf_hdr_to_disk = xfs_dir2_leaf_hdr_to_disk, |
837 | .leaf_hdr_from_disk = xfs_dir2_leaf_hdr_from_disk, | 772 | .leaf_hdr_from_disk = xfs_dir2_leaf_hdr_from_disk, |
838 | .leaf_max_ents = xfs_dir2_max_leaf_ents, | 773 | .leaf_max_ents = xfs_dir2_max_leaf_ents, |
839 | .leaf_ents_p = xfs_dir2_leaf_ents_p, | 774 | .leaf_ents_p = xfs_dir2_leaf_ents_p, |
840 | 775 | ||
841 | .node_hdr_size = xfs_da2_node_hdr_size, | 776 | .node_hdr_size = sizeof(struct xfs_da_node_hdr), |
842 | .node_hdr_to_disk = xfs_da2_node_hdr_to_disk, | 777 | .node_hdr_to_disk = xfs_da2_node_hdr_to_disk, |
843 | .node_hdr_from_disk = xfs_da2_node_hdr_from_disk, | 778 | .node_hdr_from_disk = xfs_da2_node_hdr_from_disk, |
844 | .node_tree_p = xfs_da2_node_tree_p, | 779 | .node_tree_p = xfs_da2_node_tree_p, |
845 | 780 | ||
846 | .free_hdr_size = xfs_dir2_free_hdr_size, | 781 | .free_hdr_size = sizeof(struct xfs_dir2_free_hdr), |
847 | .free_hdr_to_disk = xfs_dir2_free_hdr_to_disk, | 782 | .free_hdr_to_disk = xfs_dir2_free_hdr_to_disk, |
848 | .free_hdr_from_disk = xfs_dir2_free_hdr_from_disk, | 783 | .free_hdr_from_disk = xfs_dir2_free_hdr_from_disk, |
849 | .free_max_bests = xfs_dir2_free_max_bests, | 784 | .free_max_bests = xfs_dir2_free_max_bests, |
@@ -868,10 +803,13 @@ const struct xfs_dir_ops xfs_dir3_ops = { | |||
868 | .data_entry_tag_p = xfs_dir3_data_entry_tag_p, | 803 | .data_entry_tag_p = xfs_dir3_data_entry_tag_p, |
869 | .data_bestfree_p = xfs_dir3_data_bestfree_p, | 804 | .data_bestfree_p = xfs_dir3_data_bestfree_p, |
870 | 805 | ||
871 | .data_dot_offset = xfs_dir3_data_dot_offset, | 806 | .data_dot_offset = sizeof(struct xfs_dir3_data_hdr), |
872 | .data_dotdot_offset = xfs_dir3_data_dotdot_offset, | 807 | .data_dotdot_offset = sizeof(struct xfs_dir3_data_hdr) + |
873 | .data_first_offset = xfs_dir3_data_first_offset, | 808 | XFS_DIR3_DATA_ENTSIZE(1), |
874 | .data_entry_offset = xfs_dir3_data_entry_offset, | 809 | .data_first_offset = sizeof(struct xfs_dir3_data_hdr) + |
810 | XFS_DIR3_DATA_ENTSIZE(1) + | ||
811 | XFS_DIR3_DATA_ENTSIZE(2), | ||
812 | .data_entry_offset = sizeof(struct xfs_dir3_data_hdr), | ||
875 | 813 | ||
876 | .data_dot_entry_p = xfs_dir3_data_dot_entry_p, | 814 | .data_dot_entry_p = xfs_dir3_data_dot_entry_p, |
877 | .data_dotdot_entry_p = xfs_dir3_data_dotdot_entry_p, | 815 | .data_dotdot_entry_p = xfs_dir3_data_dotdot_entry_p, |
@@ -879,18 +817,18 @@ const struct xfs_dir_ops xfs_dir3_ops = { | |||
879 | .data_entry_p = xfs_dir3_data_entry_p, | 817 | .data_entry_p = xfs_dir3_data_entry_p, |
880 | .data_unused_p = xfs_dir3_data_unused_p, | 818 | .data_unused_p = xfs_dir3_data_unused_p, |
881 | 819 | ||
882 | .leaf_hdr_size = xfs_dir3_leaf_hdr_size, | 820 | .leaf_hdr_size = sizeof(struct xfs_dir3_leaf_hdr), |
883 | .leaf_hdr_to_disk = xfs_dir3_leaf_hdr_to_disk, | 821 | .leaf_hdr_to_disk = xfs_dir3_leaf_hdr_to_disk, |
884 | .leaf_hdr_from_disk = xfs_dir3_leaf_hdr_from_disk, | 822 | .leaf_hdr_from_disk = xfs_dir3_leaf_hdr_from_disk, |
885 | .leaf_max_ents = xfs_dir3_max_leaf_ents, | 823 | .leaf_max_ents = xfs_dir3_max_leaf_ents, |
886 | .leaf_ents_p = xfs_dir3_leaf_ents_p, | 824 | .leaf_ents_p = xfs_dir3_leaf_ents_p, |
887 | 825 | ||
888 | .node_hdr_size = xfs_da3_node_hdr_size, | 826 | .node_hdr_size = sizeof(struct xfs_da3_node_hdr), |
889 | .node_hdr_to_disk = xfs_da3_node_hdr_to_disk, | 827 | .node_hdr_to_disk = xfs_da3_node_hdr_to_disk, |
890 | .node_hdr_from_disk = xfs_da3_node_hdr_from_disk, | 828 | .node_hdr_from_disk = xfs_da3_node_hdr_from_disk, |
891 | .node_tree_p = xfs_da3_node_tree_p, | 829 | .node_tree_p = xfs_da3_node_tree_p, |
892 | 830 | ||
893 | .free_hdr_size = xfs_dir3_free_hdr_size, | 831 | .free_hdr_size = sizeof(struct xfs_dir3_free_hdr), |
894 | .free_hdr_to_disk = xfs_dir3_free_hdr_to_disk, | 832 | .free_hdr_to_disk = xfs_dir3_free_hdr_to_disk, |
895 | .free_hdr_from_disk = xfs_dir3_free_hdr_from_disk, | 833 | .free_hdr_from_disk = xfs_dir3_free_hdr_from_disk, |
896 | .free_max_bests = xfs_dir3_free_max_bests, | 834 | .free_max_bests = xfs_dir3_free_max_bests, |
@@ -900,14 +838,14 @@ const struct xfs_dir_ops xfs_dir3_ops = { | |||
900 | }; | 838 | }; |
901 | 839 | ||
902 | const struct xfs_dir_ops xfs_dir2_nondir_ops = { | 840 | const struct xfs_dir_ops xfs_dir2_nondir_ops = { |
903 | .node_hdr_size = xfs_da2_node_hdr_size, | 841 | .node_hdr_size = sizeof(struct xfs_da_node_hdr), |
904 | .node_hdr_to_disk = xfs_da2_node_hdr_to_disk, | 842 | .node_hdr_to_disk = xfs_da2_node_hdr_to_disk, |
905 | .node_hdr_from_disk = xfs_da2_node_hdr_from_disk, | 843 | .node_hdr_from_disk = xfs_da2_node_hdr_from_disk, |
906 | .node_tree_p = xfs_da2_node_tree_p, | 844 | .node_tree_p = xfs_da2_node_tree_p, |
907 | }; | 845 | }; |
908 | 846 | ||
909 | const struct xfs_dir_ops xfs_dir3_nondir_ops = { | 847 | const struct xfs_dir_ops xfs_dir3_nondir_ops = { |
910 | .node_hdr_size = xfs_da3_node_hdr_size, | 848 | .node_hdr_size = sizeof(struct xfs_da3_node_hdr), |
911 | .node_hdr_to_disk = xfs_da3_node_hdr_to_disk, | 849 | .node_hdr_to_disk = xfs_da3_node_hdr_to_disk, |
912 | .node_hdr_from_disk = xfs_da3_node_hdr_from_disk, | 850 | .node_hdr_from_disk = xfs_da3_node_hdr_from_disk, |
913 | .node_tree_p = xfs_da3_node_tree_p, | 851 | .node_tree_p = xfs_da3_node_tree_p, |
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index 1b44e83924b7..ce16ef02997a 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c | |||
@@ -105,7 +105,7 @@ xfs_dir_mount( | |||
105 | mp->m_dirleafblk = xfs_dir2_db_to_da(mp, XFS_DIR2_LEAF_FIRSTDB(mp)); | 105 | mp->m_dirleafblk = xfs_dir2_db_to_da(mp, XFS_DIR2_LEAF_FIRSTDB(mp)); |
106 | mp->m_dirfreeblk = xfs_dir2_db_to_da(mp, XFS_DIR2_FREE_FIRSTDB(mp)); | 106 | mp->m_dirfreeblk = xfs_dir2_db_to_da(mp, XFS_DIR2_FREE_FIRSTDB(mp)); |
107 | 107 | ||
108 | nodehdr_size = mp->m_dir_inode_ops->node_hdr_size(); | 108 | nodehdr_size = mp->m_dir_inode_ops->node_hdr_size; |
109 | mp->m_attr_node_ents = (mp->m_sb.sb_blocksize - nodehdr_size) / | 109 | mp->m_attr_node_ents = (mp->m_sb.sb_blocksize - nodehdr_size) / |
110 | (uint)sizeof(xfs_da_node_entry_t); | 110 | (uint)sizeof(xfs_da_node_entry_t); |
111 | mp->m_dir_node_ents = (mp->m_dirblksize - nodehdr_size) / | 111 | mp->m_dir_node_ents = (mp->m_dirblksize - nodehdr_size) / |
diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h index 4264cb9199f8..cec70e0781ab 100644 --- a/fs/xfs/xfs_dir2.h +++ b/fs/xfs/xfs_dir2.h | |||
@@ -59,10 +59,10 @@ struct xfs_dir_ops { | |||
59 | struct xfs_dir2_data_free * | 59 | struct xfs_dir2_data_free * |
60 | (*data_bestfree_p)(struct xfs_dir2_data_hdr *hdr); | 60 | (*data_bestfree_p)(struct xfs_dir2_data_hdr *hdr); |
61 | 61 | ||
62 | xfs_dir2_data_aoff_t (*data_dot_offset)(void); | 62 | xfs_dir2_data_aoff_t data_dot_offset; |
63 | xfs_dir2_data_aoff_t (*data_dotdot_offset)(void); | 63 | xfs_dir2_data_aoff_t data_dotdot_offset; |
64 | xfs_dir2_data_aoff_t (*data_first_offset)(void); | 64 | xfs_dir2_data_aoff_t data_first_offset; |
65 | size_t (*data_entry_offset)(void); | 65 | size_t data_entry_offset; |
66 | 66 | ||
67 | struct xfs_dir2_data_entry * | 67 | struct xfs_dir2_data_entry * |
68 | (*data_dot_entry_p)(struct xfs_dir2_data_hdr *hdr); | 68 | (*data_dot_entry_p)(struct xfs_dir2_data_hdr *hdr); |
@@ -75,7 +75,7 @@ struct xfs_dir_ops { | |||
75 | struct xfs_dir2_data_unused * | 75 | struct xfs_dir2_data_unused * |
76 | (*data_unused_p)(struct xfs_dir2_data_hdr *hdr); | 76 | (*data_unused_p)(struct xfs_dir2_data_hdr *hdr); |
77 | 77 | ||
78 | int (*leaf_hdr_size)(void); | 78 | int leaf_hdr_size; |
79 | void (*leaf_hdr_to_disk)(struct xfs_dir2_leaf *to, | 79 | void (*leaf_hdr_to_disk)(struct xfs_dir2_leaf *to, |
80 | struct xfs_dir3_icleaf_hdr *from); | 80 | struct xfs_dir3_icleaf_hdr *from); |
81 | void (*leaf_hdr_from_disk)(struct xfs_dir3_icleaf_hdr *to, | 81 | void (*leaf_hdr_from_disk)(struct xfs_dir3_icleaf_hdr *to, |
@@ -84,7 +84,7 @@ struct xfs_dir_ops { | |||
84 | struct xfs_dir2_leaf_entry * | 84 | struct xfs_dir2_leaf_entry * |
85 | (*leaf_ents_p)(struct xfs_dir2_leaf *lp); | 85 | (*leaf_ents_p)(struct xfs_dir2_leaf *lp); |
86 | 86 | ||
87 | int (*node_hdr_size)(void); | 87 | int node_hdr_size; |
88 | void (*node_hdr_to_disk)(struct xfs_da_intnode *to, | 88 | void (*node_hdr_to_disk)(struct xfs_da_intnode *to, |
89 | struct xfs_da3_icnode_hdr *from); | 89 | struct xfs_da3_icnode_hdr *from); |
90 | void (*node_hdr_from_disk)(struct xfs_da3_icnode_hdr *to, | 90 | void (*node_hdr_from_disk)(struct xfs_da3_icnode_hdr *to, |
@@ -92,7 +92,7 @@ struct xfs_dir_ops { | |||
92 | struct xfs_da_node_entry * | 92 | struct xfs_da_node_entry * |
93 | (*node_tree_p)(struct xfs_da_intnode *dap); | 93 | (*node_tree_p)(struct xfs_da_intnode *dap); |
94 | 94 | ||
95 | int (*free_hdr_size)(void); | 95 | int free_hdr_size; |
96 | void (*free_hdr_to_disk)(struct xfs_dir2_free *to, | 96 | void (*free_hdr_to_disk)(struct xfs_dir2_free *to, |
97 | struct xfs_dir3_icfree_hdr *from); | 97 | struct xfs_dir3_icfree_hdr *from); |
98 | void (*free_hdr_from_disk)(struct xfs_dir3_icfree_hdr *to, | 98 | void (*free_hdr_from_disk)(struct xfs_dir3_icfree_hdr *to, |
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c index c1ff552aa7bf..90cdbf4b5f19 100644 --- a/fs/xfs/xfs_dir2_block.c +++ b/fs/xfs/xfs_dir2_block.c | |||
@@ -951,7 +951,7 @@ xfs_dir2_leaf_to_block( | |||
951 | while (dp->i_d.di_size > mp->m_dirblksize) { | 951 | while (dp->i_d.di_size > mp->m_dirblksize) { |
952 | int hdrsz; | 952 | int hdrsz; |
953 | 953 | ||
954 | hdrsz = dp->d_ops->data_entry_offset(); | 954 | hdrsz = dp->d_ops->data_entry_offset; |
955 | bestsp = xfs_dir2_leaf_bests_p(ltp); | 955 | bestsp = xfs_dir2_leaf_bests_p(ltp); |
956 | if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 1]) == | 956 | if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 1]) == |
957 | mp->m_dirblksize - hdrsz) { | 957 | mp->m_dirblksize - hdrsz) { |
@@ -1185,7 +1185,7 @@ xfs_dir2_sf_to_block( | |||
1185 | blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); | 1185 | blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); |
1186 | blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp, | 1186 | blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp, |
1187 | (char *)dep - (char *)hdr)); | 1187 | (char *)dep - (char *)hdr)); |
1188 | offset = dp->d_ops->data_first_offset(); | 1188 | offset = dp->d_ops->data_first_offset; |
1189 | /* | 1189 | /* |
1190 | * Loop over existing entries, stuff them in. | 1190 | * Loop over existing entries, stuff them in. |
1191 | */ | 1191 | */ |
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c index 32d657fbe6a4..18e920c86be6 100644 --- a/fs/xfs/xfs_dir2_data.c +++ b/fs/xfs/xfs_dir2_data.c | |||
@@ -598,7 +598,7 @@ xfs_dir3_data_init( | |||
598 | hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC); | 598 | hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC); |
599 | 599 | ||
600 | bf = dp->d_ops->data_bestfree_p(hdr); | 600 | bf = dp->d_ops->data_bestfree_p(hdr); |
601 | bf[0].offset = cpu_to_be16(dp->d_ops->data_entry_offset()); | 601 | bf[0].offset = cpu_to_be16(dp->d_ops->data_entry_offset); |
602 | for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) { | 602 | for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) { |
603 | bf[i].length = 0; | 603 | bf[i].length = 0; |
604 | bf[i].offset = 0; | 604 | bf[i].offset = 0; |
@@ -610,7 +610,7 @@ xfs_dir3_data_init( | |||
610 | dup = dp->d_ops->data_unused_p(hdr); | 610 | dup = dp->d_ops->data_unused_p(hdr); |
611 | dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); | 611 | dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); |
612 | 612 | ||
613 | t = mp->m_dirblksize - (uint)dp->d_ops->data_entry_offset(); | 613 | t = mp->m_dirblksize - (uint)dp->d_ops->data_entry_offset; |
614 | bf[0].length = cpu_to_be16(t); | 614 | bf[0].length = cpu_to_be16(t); |
615 | dup->length = cpu_to_be16(t); | 615 | dup->length = cpu_to_be16(t); |
616 | *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16((char *)dup - (char *)hdr); | 616 | *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16((char *)dup - (char *)hdr); |
@@ -663,7 +663,7 @@ xfs_dir2_data_log_header( | |||
663 | hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); | 663 | hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); |
664 | #endif | 664 | #endif |
665 | 665 | ||
666 | xfs_trans_log_buf(tp, bp, 0, dp->d_ops->data_entry_offset() - 1); | 666 | xfs_trans_log_buf(tp, bp, 0, dp->d_ops->data_entry_offset - 1); |
667 | } | 667 | } |
668 | 668 | ||
669 | /* | 669 | /* |
@@ -742,7 +742,7 @@ xfs_dir2_data_make_free( | |||
742 | * If this isn't the start of the block, then back up to | 742 | * If this isn't the start of the block, then back up to |
743 | * the previous entry and see if it's free. | 743 | * the previous entry and see if it's free. |
744 | */ | 744 | */ |
745 | if (offset > dp->d_ops->data_entry_offset()) { | 745 | if (offset > dp->d_ops->data_entry_offset) { |
746 | __be16 *tagp; /* tag just before us */ | 746 | __be16 *tagp; /* tag just before us */ |
747 | 747 | ||
748 | tagp = (__be16 *)((char *)hdr + offset) - 1; | 748 | tagp = (__be16 *)((char *)hdr + offset) - 1; |
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index a3c21b15cf7b..ae47ec6e16c4 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -1116,7 +1116,7 @@ xfs_dir3_leaf_log_header( | |||
1116 | leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); | 1116 | leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); |
1117 | 1117 | ||
1118 | xfs_trans_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf), | 1118 | xfs_trans_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf), |
1119 | dp->d_ops->leaf_hdr_size() - 1); | 1119 | dp->d_ops->leaf_hdr_size - 1); |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | /* | 1122 | /* |
@@ -1424,7 +1424,7 @@ xfs_dir2_leaf_removename( | |||
1424 | * If the data block is now empty then get rid of the data block. | 1424 | * If the data block is now empty then get rid of the data block. |
1425 | */ | 1425 | */ |
1426 | if (be16_to_cpu(bf[0].length) == | 1426 | if (be16_to_cpu(bf[0].length) == |
1427 | mp->m_dirblksize - dp->d_ops->data_entry_offset()) { | 1427 | mp->m_dirblksize - dp->d_ops->data_entry_offset) { |
1428 | ASSERT(db != mp->m_dirdatablk); | 1428 | ASSERT(db != mp->m_dirdatablk); |
1429 | if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { | 1429 | if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { |
1430 | /* | 1430 | /* |
@@ -1623,7 +1623,7 @@ xfs_dir2_leaf_trim_data( | |||
1623 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || | 1623 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
1624 | hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC)); | 1624 | hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC)); |
1625 | ASSERT(be16_to_cpu(bf[0].length) == | 1625 | ASSERT(be16_to_cpu(bf[0].length) == |
1626 | mp->m_dirblksize - dp->d_ops->data_entry_offset()); | 1626 | mp->m_dirblksize - dp->d_ops->data_entry_offset); |
1627 | ASSERT(db == be32_to_cpu(ltp->bestcount) - 1); | 1627 | ASSERT(db == be32_to_cpu(ltp->bestcount) - 1); |
1628 | } | 1628 | } |
1629 | #endif | 1629 | #endif |
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c index 853798519ae9..f90bf0690346 100644 --- a/fs/xfs/xfs_dir2_node.c +++ b/fs/xfs/xfs_dir2_node.c | |||
@@ -274,7 +274,7 @@ xfs_dir2_free_log_header( | |||
274 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) || | 274 | ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) || |
275 | free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC)); | 275 | free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC)); |
276 | #endif | 276 | #endif |
277 | xfs_trans_log_buf(tp, bp, 0, dp->d_ops->free_hdr_size() - 1); | 277 | xfs_trans_log_buf(tp, bp, 0, dp->d_ops->free_hdr_size - 1); |
278 | } | 278 | } |
279 | 279 | ||
280 | /* | 280 | /* |
@@ -1268,7 +1268,7 @@ xfs_dir2_leafn_remove( | |||
1268 | * (usually). | 1268 | * (usually). |
1269 | */ | 1269 | */ |
1270 | if (longest == mp->m_dirblksize - | 1270 | if (longest == mp->m_dirblksize - |
1271 | dp->d_ops->data_entry_offset()) { | 1271 | dp->d_ops->data_entry_offset) { |
1272 | /* | 1272 | /* |
1273 | * Try to punch out the data block. | 1273 | * Try to punch out the data block. |
1274 | */ | 1274 | */ |
@@ -1300,7 +1300,7 @@ xfs_dir2_leafn_remove( | |||
1300 | * Return indication of whether this leaf block is empty enough | 1300 | * Return indication of whether this leaf block is empty enough |
1301 | * to justify trying to join it with a neighbor. | 1301 | * to justify trying to join it with a neighbor. |
1302 | */ | 1302 | */ |
1303 | *rval = (dp->d_ops->leaf_hdr_size() + | 1303 | *rval = (dp->d_ops->leaf_hdr_size + |
1304 | (uint)sizeof(ents[0]) * (leafhdr.count - leafhdr.stale)) < | 1304 | (uint)sizeof(ents[0]) * (leafhdr.count - leafhdr.stale)) < |
1305 | mp->m_dir_magicpct; | 1305 | mp->m_dir_magicpct; |
1306 | return 0; | 1306 | return 0; |
@@ -1409,7 +1409,7 @@ xfs_dir2_leafn_toosmall( | |||
1409 | xfs_dir3_leaf_check(dp, blk->bp); | 1409 | xfs_dir3_leaf_check(dp, blk->bp); |
1410 | 1410 | ||
1411 | count = leafhdr.count - leafhdr.stale; | 1411 | count = leafhdr.count - leafhdr.stale; |
1412 | bytes = dp->d_ops->leaf_hdr_size() + count * sizeof(ents[0]); | 1412 | bytes = dp->d_ops->leaf_hdr_size + count * sizeof(ents[0]); |
1413 | if (bytes > (state->blocksize >> 1)) { | 1413 | if (bytes > (state->blocksize >> 1)) { |
1414 | /* | 1414 | /* |
1415 | * Blk over 50%, don't try to join. | 1415 | * Blk over 50%, don't try to join. |
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c index f45ecac821ec..c4e50c6ed584 100644 --- a/fs/xfs/xfs_dir2_readdir.c +++ b/fs/xfs/xfs_dir2_readdir.c | |||
@@ -119,9 +119,9 @@ xfs_dir2_sf_getdents( | |||
119 | * mp->m_dirdatablk. | 119 | * mp->m_dirdatablk. |
120 | */ | 120 | */ |
121 | dot_offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, | 121 | dot_offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, |
122 | dp->d_ops->data_dot_offset()); | 122 | dp->d_ops->data_dot_offset); |
123 | dotdot_offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, | 123 | dotdot_offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, |
124 | dp->d_ops->data_dotdot_offset()); | 124 | dp->d_ops->data_dotdot_offset); |
125 | 125 | ||
126 | /* | 126 | /* |
127 | * Put . entry unless we're starting past it. | 127 | * Put . entry unless we're starting past it. |
@@ -584,7 +584,7 @@ xfs_dir2_leaf_getdents( | |||
584 | * Skip past the header. | 584 | * Skip past the header. |
585 | */ | 585 | */ |
586 | if (byteoff == 0) | 586 | if (byteoff == 0) |
587 | curoff += dp->d_ops->data_entry_offset(); | 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 42bbcff15cc5..aafc6e46cb58 100644 --- a/fs/xfs/xfs_dir2_sf.c +++ b/fs/xfs/xfs_dir2_sf.c | |||
@@ -473,7 +473,7 @@ xfs_dir2_sf_addname_hard( | |||
473 | * to insert the new entry. | 473 | * to insert the new entry. |
474 | * If it's going to end up at the end then oldsfep will point there. | 474 | * If it's going to end up at the end then oldsfep will point there. |
475 | */ | 475 | */ |
476 | for (offset = dp->d_ops->data_first_offset(), | 476 | for (offset = dp->d_ops->data_first_offset, |
477 | oldsfep = xfs_dir2_sf_firstentry(oldsfp), | 477 | oldsfep = xfs_dir2_sf_firstentry(oldsfp), |
478 | add_datasize = dp->d_ops->data_entsize(args->namelen), | 478 | add_datasize = dp->d_ops->data_entsize(args->namelen), |
479 | eof = (char *)oldsfep == &buf[old_isize]; | 479 | eof = (char *)oldsfep == &buf[old_isize]; |
@@ -556,7 +556,7 @@ xfs_dir2_sf_addname_pick( | |||
556 | 556 | ||
557 | sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; | 557 | sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; |
558 | size = dp->d_ops->data_entsize(args->namelen); | 558 | size = dp->d_ops->data_entsize(args->namelen); |
559 | offset = dp->d_ops->data_first_offset(); | 559 | offset = dp->d_ops->data_first_offset; |
560 | sfep = xfs_dir2_sf_firstentry(sfp); | 560 | sfep = xfs_dir2_sf_firstentry(sfp); |
561 | holefit = 0; | 561 | holefit = 0; |
562 | /* | 562 | /* |
@@ -629,7 +629,7 @@ xfs_dir2_sf_check( | |||
629 | mp = dp->i_mount; | 629 | mp = dp->i_mount; |
630 | 630 | ||
631 | sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; | 631 | sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; |
632 | offset = dp->d_ops->data_first_offset(); | 632 | offset = dp->d_ops->data_first_offset; |
633 | ino = dp->d_ops->sf_get_parent_ino(sfp); | 633 | ino = dp->d_ops->sf_get_parent_ino(sfp); |
634 | i8count = ino > XFS_DIR2_MAX_SHORT_INUM; | 634 | i8count = ino > XFS_DIR2_MAX_SHORT_INUM; |
635 | 635 | ||