Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: remove bitfield based superblock updates

When we log changes to the superblock, we first have to write them
to the on-disk buffer, and then log that. Right now we have a
complex bitfield based arrangement to only write the modified field
to the buffer before we log it.

This used to be necessary as a performance optimisation because we
logged the superblock buffer in every extent or inode allocation or
freeing, and so performance was extremely important. We haven't done
this for years, however, ever since the lazy superblock counters
pulled the superblock logging out of the transaction commit
fast path.

Hence we have a bunch of complexity that is not necessary that makes
writing the in-core superblock to disk much more complex than it
needs to be. We only need to log the superblock now during
management operations (e.g. during mount, unmount or quota control
operations) so it is not a performance critical path anymore.

As such, remove the complex field based logging mechanism and
replace it with a simple conversion function similar to what we use
for all other on-disk structures.

This means we always log the entirity of the superblock, but again
because we rarely modify the superblock this is not an issue for log
bandwidth or CPU time. Indeed, if we do log the superblock
frequently, delayed logging will minimise the impact of this
overhead.

[Fixed gquota/pquota inode sharing regression noticed by bfoster.]

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>

authored by

Dave Chinner and committed by
Dave Chinner
4d11a402 97bf6af1

+130 -246
+1 -1
fs/xfs/libxfs/xfs_attr_leaf.c
··· 403 403 if (!xfs_sb_version_hasattr2(&mp->m_sb)) { 404 404 xfs_sb_version_addattr2(&mp->m_sb); 405 405 spin_unlock(&mp->m_sb_lock); 406 - xfs_mod_sb(tp, XFS_SB_VERSIONNUM | XFS_SB_FEATURES2); 406 + xfs_mod_sb(tp); 407 407 } else 408 408 spin_unlock(&mp->m_sb_lock); 409 409 }
+6 -8
fs/xfs/libxfs/xfs_bmap.c
··· 1221 1221 goto bmap_cancel; 1222 1222 if (!xfs_sb_version_hasattr(&mp->m_sb) || 1223 1223 (!xfs_sb_version_hasattr2(&mp->m_sb) && version == 2)) { 1224 - __int64_t sbfields = 0; 1224 + bool mod_sb = false; 1225 1225 1226 1226 spin_lock(&mp->m_sb_lock); 1227 1227 if (!xfs_sb_version_hasattr(&mp->m_sb)) { 1228 1228 xfs_sb_version_addattr(&mp->m_sb); 1229 - sbfields |= XFS_SB_VERSIONNUM; 1229 + mod_sb = true; 1230 1230 } 1231 1231 if (!xfs_sb_version_hasattr2(&mp->m_sb) && version == 2) { 1232 1232 xfs_sb_version_addattr2(&mp->m_sb); 1233 - sbfields |= (XFS_SB_VERSIONNUM | XFS_SB_FEATURES2); 1233 + mod_sb = true; 1234 1234 } 1235 - if (sbfields) { 1236 - spin_unlock(&mp->m_sb_lock); 1237 - xfs_mod_sb(tp, sbfields); 1238 - } else 1239 - spin_unlock(&mp->m_sb_lock); 1235 + spin_unlock(&mp->m_sb_lock); 1236 + if (mod_sb) 1237 + xfs_mod_sb(tp); 1240 1238 } 1241 1239 1242 1240 error = xfs_bmap_finish(&tp, &flist, &committed);
+96 -181
fs/xfs/libxfs/xfs_sb.c
··· 40 40 * Physical superblock buffer manipulations. Shared with libxfs in userspace. 41 41 */ 42 42 43 - static const struct { 44 - short offset; 45 - short type; /* 0 = integer 46 - * 1 = binary / string (no translation) 47 - */ 48 - } xfs_sb_info[] = { 49 - { offsetof(xfs_sb_t, sb_magicnum), 0 }, 50 - { offsetof(xfs_sb_t, sb_blocksize), 0 }, 51 - { offsetof(xfs_sb_t, sb_dblocks), 0 }, 52 - { offsetof(xfs_sb_t, sb_rblocks), 0 }, 53 - { offsetof(xfs_sb_t, sb_rextents), 0 }, 54 - { offsetof(xfs_sb_t, sb_uuid), 1 }, 55 - { offsetof(xfs_sb_t, sb_logstart), 0 }, 56 - { offsetof(xfs_sb_t, sb_rootino), 0 }, 57 - { offsetof(xfs_sb_t, sb_rbmino), 0 }, 58 - { offsetof(xfs_sb_t, sb_rsumino), 0 }, 59 - { offsetof(xfs_sb_t, sb_rextsize), 0 }, 60 - { offsetof(xfs_sb_t, sb_agblocks), 0 }, 61 - { offsetof(xfs_sb_t, sb_agcount), 0 }, 62 - { offsetof(xfs_sb_t, sb_rbmblocks), 0 }, 63 - { offsetof(xfs_sb_t, sb_logblocks), 0 }, 64 - { offsetof(xfs_sb_t, sb_versionnum), 0 }, 65 - { offsetof(xfs_sb_t, sb_sectsize), 0 }, 66 - { offsetof(xfs_sb_t, sb_inodesize), 0 }, 67 - { offsetof(xfs_sb_t, sb_inopblock), 0 }, 68 - { offsetof(xfs_sb_t, sb_fname[0]), 1 }, 69 - { offsetof(xfs_sb_t, sb_blocklog), 0 }, 70 - { offsetof(xfs_sb_t, sb_sectlog), 0 }, 71 - { offsetof(xfs_sb_t, sb_inodelog), 0 }, 72 - { offsetof(xfs_sb_t, sb_inopblog), 0 }, 73 - { offsetof(xfs_sb_t, sb_agblklog), 0 }, 74 - { offsetof(xfs_sb_t, sb_rextslog), 0 }, 75 - { offsetof(xfs_sb_t, sb_inprogress), 0 }, 76 - { offsetof(xfs_sb_t, sb_imax_pct), 0 }, 77 - { offsetof(xfs_sb_t, sb_icount), 0 }, 78 - { offsetof(xfs_sb_t, sb_ifree), 0 }, 79 - { offsetof(xfs_sb_t, sb_fdblocks), 0 }, 80 - { offsetof(xfs_sb_t, sb_frextents), 0 }, 81 - { offsetof(xfs_sb_t, sb_uquotino), 0 }, 82 - { offsetof(xfs_sb_t, sb_gquotino), 0 }, 83 - { offsetof(xfs_sb_t, sb_qflags), 0 }, 84 - { offsetof(xfs_sb_t, sb_flags), 0 }, 85 - { offsetof(xfs_sb_t, sb_shared_vn), 0 }, 86 - { offsetof(xfs_sb_t, sb_inoalignmt), 0 }, 87 - { offsetof(xfs_sb_t, sb_unit), 0 }, 88 - { offsetof(xfs_sb_t, sb_width), 0 }, 89 - { offsetof(xfs_sb_t, sb_dirblklog), 0 }, 90 - { offsetof(xfs_sb_t, sb_logsectlog), 0 }, 91 - { offsetof(xfs_sb_t, sb_logsectsize), 0 }, 92 - { offsetof(xfs_sb_t, sb_logsunit), 0 }, 93 - { offsetof(xfs_sb_t, sb_features2), 0 }, 94 - { offsetof(xfs_sb_t, sb_bad_features2), 0 }, 95 - { offsetof(xfs_sb_t, sb_features_compat), 0 }, 96 - { offsetof(xfs_sb_t, sb_features_ro_compat), 0 }, 97 - { offsetof(xfs_sb_t, sb_features_incompat), 0 }, 98 - { offsetof(xfs_sb_t, sb_features_log_incompat), 0 }, 99 - { offsetof(xfs_sb_t, sb_crc), 0 }, 100 - { offsetof(xfs_sb_t, sb_pad), 0 }, 101 - { offsetof(xfs_sb_t, sb_pquotino), 0 }, 102 - { offsetof(xfs_sb_t, sb_lsn), 0 }, 103 - { sizeof(xfs_sb_t), 0 } 104 - }; 105 - 106 43 /* 107 44 * Reference counting access wrappers to the perag structures. 108 45 * Because we never free per-ag structures, the only thing we ··· 398 461 __xfs_sb_from_disk(to, from, true); 399 462 } 400 463 401 - static inline void 464 + static void 402 465 xfs_sb_quota_to_disk( 403 - xfs_dsb_t *to, 404 - xfs_sb_t *from, 405 - __int64_t *fields) 466 + struct xfs_dsb *to, 467 + struct xfs_sb *from) 406 468 { 407 469 __uint16_t qflags = from->sb_qflags; 408 470 409 - /* 410 - * We need to do these manipilations only if we are working 411 - * with an older version of on-disk superblock. 412 - */ 413 - if (xfs_sb_version_has_pquotino(from)) 471 + to->sb_uquotino = cpu_to_be64(from->sb_uquotino); 472 + if (xfs_sb_version_has_pquotino(from)) { 473 + to->sb_qflags = cpu_to_be16(from->sb_qflags); 474 + to->sb_gquotino = cpu_to_be64(from->sb_gquotino); 475 + to->sb_pquotino = cpu_to_be64(from->sb_pquotino); 414 476 return; 415 - 416 - if (*fields & XFS_SB_QFLAGS) { 417 - /* 418 - * The in-core version of sb_qflags do not have 419 - * XFS_OQUOTA_* flags, whereas the on-disk version 420 - * does. So, convert incore XFS_{PG}QUOTA_* flags 421 - * to on-disk XFS_OQUOTA_* flags. 422 - */ 423 - qflags &= ~(XFS_PQUOTA_ENFD | XFS_PQUOTA_CHKD | 424 - XFS_GQUOTA_ENFD | XFS_GQUOTA_CHKD); 425 - 426 - if (from->sb_qflags & 427 - (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD)) 428 - qflags |= XFS_OQUOTA_ENFD; 429 - if (from->sb_qflags & 430 - (XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) 431 - qflags |= XFS_OQUOTA_CHKD; 432 - to->sb_qflags = cpu_to_be16(qflags); 433 - *fields &= ~XFS_SB_QFLAGS; 434 477 } 435 478 436 479 /* 437 - * GQUOTINO and PQUOTINO cannot be used together in versions of 438 - * superblock that do not have pquotino. from->sb_flags tells us which 439 - * quota is active and should be copied to disk. If neither are active, 440 - * make sure we write NULLFSINO to the sb_gquotino field as a quota 441 - * inode value of "0" is invalid when the XFS_SB_VERSION_QUOTA feature 442 - * bit is set. 443 - * 444 - * Note that we don't need to handle the sb_uquotino or sb_pquotino here 445 - * as they do not require any translation. Hence the main sb field loop 446 - * will write them appropriately from the in-core superblock. 480 + * The in-core version of sb_qflags do not have XFS_OQUOTA_* 481 + * flags, whereas the on-disk version does. So, convert incore 482 + * XFS_{PG}QUOTA_* flags to on-disk XFS_OQUOTA_* flags. 447 483 */ 448 - if ((*fields & XFS_SB_GQUOTINO) && 449 - (from->sb_qflags & XFS_GQUOTA_ACCT)) 484 + qflags &= ~(XFS_PQUOTA_ENFD | XFS_PQUOTA_CHKD | 485 + XFS_GQUOTA_ENFD | XFS_GQUOTA_CHKD); 486 + 487 + if (from->sb_qflags & 488 + (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD)) 489 + qflags |= XFS_OQUOTA_ENFD; 490 + if (from->sb_qflags & 491 + (XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) 492 + qflags |= XFS_OQUOTA_CHKD; 493 + to->sb_qflags = cpu_to_be16(qflags); 494 + 495 + /* 496 + * GQUOTINO and PQUOTINO cannot be used together in versions 497 + * of superblock that do not have pquotino. from->sb_flags 498 + * tells us which quota is active and should be copied to 499 + * disk. If neither are active, we should NULL the inode. 500 + * 501 + * In all cases, the separate pquotino must remain 0 because it 502 + * it beyond the "end" of the valid non-pquotino superblock. 503 + */ 504 + if (from->sb_qflags & XFS_GQUOTA_ACCT) 450 505 to->sb_gquotino = cpu_to_be64(from->sb_gquotino); 451 - else if ((*fields & XFS_SB_PQUOTINO) && 452 - (from->sb_qflags & XFS_PQUOTA_ACCT)) 506 + else if (from->sb_qflags & XFS_PQUOTA_ACCT) 453 507 to->sb_gquotino = cpu_to_be64(from->sb_pquotino); 454 508 else { 455 509 /* ··· 454 526 to->sb_gquotino = cpu_to_be64(NULLFSINO); 455 527 } 456 528 457 - *fields &= ~(XFS_SB_PQUOTINO | XFS_SB_GQUOTINO); 529 + to->sb_pquotino = 0; 458 530 } 459 531 460 - /* 461 - * Copy in core superblock to ondisk one. 462 - * 463 - * The fields argument is mask of superblock fields to copy. 464 - */ 465 532 void 466 533 xfs_sb_to_disk( 467 - xfs_dsb_t *to, 468 - xfs_sb_t *from, 469 - __int64_t fields) 534 + struct xfs_dsb *to, 535 + struct xfs_sb *from) 470 536 { 471 - xfs_caddr_t to_ptr = (xfs_caddr_t)to; 472 - xfs_caddr_t from_ptr = (xfs_caddr_t)from; 473 - xfs_sb_field_t f; 474 - int first; 475 - int size; 537 + xfs_sb_quota_to_disk(to, from); 476 538 477 - ASSERT(fields); 478 - if (!fields) 479 - return; 539 + to->sb_magicnum = cpu_to_be32(from->sb_magicnum); 540 + to->sb_blocksize = cpu_to_be32(from->sb_blocksize); 541 + to->sb_dblocks = cpu_to_be64(from->sb_dblocks); 542 + to->sb_rblocks = cpu_to_be64(from->sb_rblocks); 543 + to->sb_rextents = cpu_to_be64(from->sb_rextents); 544 + memcpy(&to->sb_uuid, &from->sb_uuid, sizeof(to->sb_uuid)); 545 + to->sb_logstart = cpu_to_be64(from->sb_logstart); 546 + to->sb_rootino = cpu_to_be64(from->sb_rootino); 547 + to->sb_rbmino = cpu_to_be64(from->sb_rbmino); 548 + to->sb_rsumino = cpu_to_be64(from->sb_rsumino); 549 + to->sb_rextsize = cpu_to_be32(from->sb_rextsize); 550 + to->sb_agblocks = cpu_to_be32(from->sb_agblocks); 551 + to->sb_agcount = cpu_to_be32(from->sb_agcount); 552 + to->sb_rbmblocks = cpu_to_be32(from->sb_rbmblocks); 553 + to->sb_logblocks = cpu_to_be32(from->sb_logblocks); 554 + to->sb_versionnum = cpu_to_be16(from->sb_versionnum); 555 + to->sb_sectsize = cpu_to_be16(from->sb_sectsize); 556 + to->sb_inodesize = cpu_to_be16(from->sb_inodesize); 557 + to->sb_inopblock = cpu_to_be16(from->sb_inopblock); 558 + memcpy(&to->sb_fname, &from->sb_fname, sizeof(to->sb_fname)); 559 + to->sb_blocklog = from->sb_blocklog; 560 + to->sb_sectlog = from->sb_sectlog; 561 + to->sb_inodelog = from->sb_inodelog; 562 + to->sb_inopblog = from->sb_inopblog; 563 + to->sb_agblklog = from->sb_agblklog; 564 + to->sb_rextslog = from->sb_rextslog; 565 + to->sb_inprogress = from->sb_inprogress; 566 + to->sb_imax_pct = from->sb_imax_pct; 567 + to->sb_icount = cpu_to_be64(from->sb_icount); 568 + to->sb_ifree = cpu_to_be64(from->sb_ifree); 569 + to->sb_fdblocks = cpu_to_be64(from->sb_fdblocks); 570 + to->sb_frextents = cpu_to_be64(from->sb_frextents); 480 571 481 - /* We should never write the crc here, it's updated in the IO path */ 482 - fields &= ~XFS_SB_CRC; 483 572 484 - xfs_sb_quota_to_disk(to, from, &fields); 485 - while (fields) { 486 - f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields); 487 - first = xfs_sb_info[f].offset; 488 - size = xfs_sb_info[f + 1].offset - first; 573 + to->sb_flags = from->sb_flags; 574 + to->sb_shared_vn = from->sb_shared_vn; 575 + to->sb_inoalignmt = cpu_to_be32(from->sb_inoalignmt); 576 + to->sb_unit = cpu_to_be32(from->sb_unit); 577 + to->sb_width = cpu_to_be32(from->sb_width); 578 + to->sb_dirblklog = from->sb_dirblklog; 579 + to->sb_logsectlog = from->sb_logsectlog; 580 + to->sb_logsectsize = cpu_to_be16(from->sb_logsectsize); 581 + to->sb_logsunit = cpu_to_be32(from->sb_logsunit); 582 + to->sb_features2 = cpu_to_be32(from->sb_features2); 583 + to->sb_bad_features2 = cpu_to_be32(from->sb_bad_features2); 489 584 490 - ASSERT(xfs_sb_info[f].type == 0 || xfs_sb_info[f].type == 1); 491 - 492 - if (size == 1 || xfs_sb_info[f].type == 1) { 493 - memcpy(to_ptr + first, from_ptr + first, size); 494 - } else { 495 - switch (size) { 496 - case 2: 497 - *(__be16 *)(to_ptr + first) = 498 - cpu_to_be16(*(__u16 *)(from_ptr + first)); 499 - break; 500 - case 4: 501 - *(__be32 *)(to_ptr + first) = 502 - cpu_to_be32(*(__u32 *)(from_ptr + first)); 503 - break; 504 - case 8: 505 - *(__be64 *)(to_ptr + first) = 506 - cpu_to_be64(*(__u64 *)(from_ptr + first)); 507 - break; 508 - default: 509 - ASSERT(0); 510 - } 511 - } 512 - 513 - fields &= ~(1LL << f); 585 + if (xfs_sb_version_hascrc(from)) { 586 + to->sb_features_compat = cpu_to_be32(from->sb_features_compat); 587 + to->sb_features_ro_compat = 588 + cpu_to_be32(from->sb_features_ro_compat); 589 + to->sb_features_incompat = 590 + cpu_to_be32(from->sb_features_incompat); 591 + to->sb_features_log_incompat = 592 + cpu_to_be32(from->sb_features_log_incompat); 593 + to->sb_pad = 0; 594 + to->sb_lsn = cpu_to_be64(from->sb_lsn); 514 595 } 515 596 } 516 597 ··· 760 823 * access. 761 824 */ 762 825 void 763 - xfs_mod_sb(xfs_trans_t *tp, __int64_t fields) 826 + xfs_mod_sb( 827 + struct xfs_trans *tp) 764 828 { 765 - xfs_buf_t *bp; 766 - int first; 767 - int last; 768 - xfs_mount_t *mp; 769 - xfs_sb_field_t f; 829 + struct xfs_mount *mp = tp->t_mountp; 830 + struct xfs_buf *bp = xfs_trans_getsb(tp, mp, 0); 770 831 771 - ASSERT(fields); 772 - if (!fields) 773 - return; 774 - mp = tp->t_mountp; 775 - bp = xfs_trans_getsb(tp, mp, 0); 776 - first = sizeof(xfs_sb_t); 777 - last = 0; 778 - 779 - /* translate/copy */ 780 - 781 - xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, fields); 782 - 783 - /* find modified range */ 784 - f = (xfs_sb_field_t)xfs_highbit64((__uint64_t)fields); 785 - ASSERT((1LL << f) & XFS_SB_MOD_BITS); 786 - last = xfs_sb_info[f + 1].offset - 1; 787 - 788 - f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields); 789 - ASSERT((1LL << f) & XFS_SB_MOD_BITS); 790 - first = xfs_sb_info[f].offset; 791 - 832 + xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb); 792 833 xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SB_BUF); 793 - xfs_trans_log_buf(tp, bp, first, last); 834 + xfs_trans_log_buf(tp, bp, 0, sizeof(struct xfs_dsb)); 794 835 }
+5 -5
fs/xfs/libxfs/xfs_sb.h
··· 27 27 extern void xfs_perag_put(struct xfs_perag *pag); 28 28 extern int xfs_initialize_perag_data(struct xfs_mount *, xfs_agnumber_t); 29 29 30 - extern void xfs_sb_calc_crc(struct xfs_buf *); 31 - extern void xfs_mod_sb(struct xfs_trans *, __int64_t); 32 - extern void xfs_sb_mount_common(struct xfs_mount *, struct xfs_sb *); 33 - extern void xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *); 34 - extern void xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t); 30 + extern void xfs_sb_calc_crc(struct xfs_buf *bp); 31 + extern void xfs_mod_sb(struct xfs_trans *tp); 32 + extern void xfs_sb_mount_common(struct xfs_mount *mp, struct xfs_sb *sbp); 33 + extern void xfs_sb_from_disk(struct xfs_sb *to, struct xfs_dsb *from); 34 + extern void xfs_sb_to_disk(struct xfs_dsb *to, struct xfs_sb *from); 35 35 extern void xfs_sb_quota_from_disk(struct xfs_sb *sbp); 36 36 37 37 #endif /* __XFS_SB_H__ */
+2 -4
fs/xfs/xfs_fsops.c
··· 541 541 saved_error = error; 542 542 continue; 543 543 } 544 - xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, XFS_SB_ALL_BITS); 544 + xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb); 545 545 546 546 error = xfs_bwrite(bp); 547 547 xfs_buf_relse(bp); ··· 780 780 xfs_trans_cancel(tp, 0); 781 781 return error; 782 782 } 783 - 784 - /* log the UUID because it is an unchanging field */ 785 - xfs_mod_sb(tp, XFS_SB_UUID); 783 + xfs_mod_sb(tp); 786 784 xfs_trans_set_sync(tp); 787 785 return xfs_trans_commit(tp, 0); 788 786 }
+8 -14
fs/xfs/xfs_mount.c
··· 613 613 return error; 614 614 } 615 615 616 - xfs_mod_sb(tp, XFS_SB_QFLAGS); 616 + xfs_mod_sb(tp); 617 617 return xfs_trans_commit(tp, 0); 618 618 } 619 619 ··· 896 896 * perform the update e.g. for the root filesystem. 897 897 */ 898 898 if (mp->m_update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY)) { 899 - error = xfs_mount_log_sb(mp, mp->m_update_flags); 899 + error = xfs_mount_log_sb(mp); 900 900 if (error) { 901 901 xfs_warn(mp, "failed to write sb changes"); 902 902 goto out_rtunmount; ··· 1126 1126 return error; 1127 1127 } 1128 1128 1129 - xfs_mod_sb(tp, XFS_SB_IFREE | XFS_SB_ICOUNT | XFS_SB_FDBLOCKS); 1129 + xfs_mod_sb(tp); 1130 1130 xfs_trans_set_sync(tp); 1131 1131 error = xfs_trans_commit(tp, 0); 1132 1132 return error; ··· 1429 1429 */ 1430 1430 int 1431 1431 xfs_mount_log_sb( 1432 - xfs_mount_t *mp, 1433 - __int64_t fields) 1432 + struct xfs_mount *mp) 1434 1433 { 1435 - xfs_trans_t *tp; 1436 - int error; 1437 - 1438 - ASSERT(fields & (XFS_SB_UNIT | XFS_SB_WIDTH | XFS_SB_UUID | 1439 - XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2 | 1440 - XFS_SB_VERSIONNUM)); 1434 + struct xfs_trans *tp; 1435 + int error; 1441 1436 1442 1437 tp = xfs_trans_alloc(mp, XFS_TRANS_SB_UNIT); 1443 1438 error = xfs_trans_reserve(tp, &M_RES(mp)->tr_sb, 0, 0); ··· 1440 1445 xfs_trans_cancel(tp, 0); 1441 1446 return error; 1442 1447 } 1443 - xfs_mod_sb(tp, fields); 1444 - error = xfs_trans_commit(tp, 0); 1445 - return error; 1448 + xfs_mod_sb(tp); 1449 + return xfs_trans_commit(tp, 0); 1446 1450 } 1447 1451 1448 1452 /*
+1 -1
fs/xfs/xfs_mount.h
··· 378 378 extern int xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int64_t, int); 379 379 extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, 380 380 uint, int); 381 - extern int xfs_mount_log_sb(xfs_mount_t *, __int64_t); 381 + extern int xfs_mount_log_sb(xfs_mount_t *); 382 382 extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int); 383 383 extern int xfs_readsb(xfs_mount_t *, int); 384 384 extern void xfs_freesb(xfs_mount_t *);
+5 -21
fs/xfs/xfs_qm.c
··· 714 714 xfs_qm_qino_alloc( 715 715 xfs_mount_t *mp, 716 716 xfs_inode_t **ip, 717 - __int64_t sbfields, 718 717 uint flags) 719 718 { 720 719 xfs_trans_t *tp; ··· 776 777 spin_lock(&mp->m_sb_lock); 777 778 if (flags & XFS_QMOPT_SBVERSION) { 778 779 ASSERT(!xfs_sb_version_hasquota(&mp->m_sb)); 779 - ASSERT((sbfields & (XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | 780 - XFS_SB_GQUOTINO | XFS_SB_PQUOTINO | XFS_SB_QFLAGS)) == 781 - (XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | 782 - XFS_SB_GQUOTINO | XFS_SB_PQUOTINO | 783 - XFS_SB_QFLAGS)); 784 780 785 781 xfs_sb_version_addquota(&mp->m_sb); 786 782 mp->m_sb.sb_uquotino = NULLFSINO; ··· 792 798 else 793 799 mp->m_sb.sb_pquotino = (*ip)->i_ino; 794 800 spin_unlock(&mp->m_sb_lock); 795 - xfs_mod_sb(tp, sbfields); 801 + xfs_mod_sb(tp); 796 802 797 803 if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) { 798 804 xfs_alert(mp, "%s failed (error %d)!", __func__, error); ··· 1445 1451 spin_unlock(&mp->m_sb_lock); 1446 1452 1447 1453 if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) { 1448 - if (xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS)) { 1454 + if (xfs_qm_write_sb_changes(mp)) { 1449 1455 /* 1450 1456 * We could only have been turning quotas off. 1451 1457 * We aren't in very good shape actually because ··· 1476 1482 struct xfs_inode *gip = NULL; 1477 1483 struct xfs_inode *pip = NULL; 1478 1484 int error; 1479 - __int64_t sbflags = 0; 1480 1485 uint flags = 0; 1481 1486 1482 1487 ASSERT(mp->m_quotainfo); ··· 1510 1517 } 1511 1518 } else { 1512 1519 flags |= XFS_QMOPT_SBVERSION; 1513 - sbflags |= (XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | 1514 - XFS_SB_GQUOTINO | XFS_SB_PQUOTINO | 1515 - XFS_SB_QFLAGS); 1516 1520 } 1517 1521 1518 1522 /* ··· 1520 1530 */ 1521 1531 if (XFS_IS_UQUOTA_ON(mp) && uip == NULL) { 1522 1532 error = xfs_qm_qino_alloc(mp, &uip, 1523 - sbflags | XFS_SB_UQUOTINO, 1524 1533 flags | XFS_QMOPT_UQUOTA); 1525 1534 if (error) 1526 1535 goto error_rele; ··· 1528 1539 } 1529 1540 if (XFS_IS_GQUOTA_ON(mp) && gip == NULL) { 1530 1541 error = xfs_qm_qino_alloc(mp, &gip, 1531 - sbflags | XFS_SB_GQUOTINO, 1532 1542 flags | XFS_QMOPT_GQUOTA); 1533 1543 if (error) 1534 1544 goto error_rele; ··· 1536 1548 } 1537 1549 if (XFS_IS_PQUOTA_ON(mp) && pip == NULL) { 1538 1550 error = xfs_qm_qino_alloc(mp, &pip, 1539 - sbflags | XFS_SB_PQUOTINO, 1540 1551 flags | XFS_QMOPT_PQUOTA); 1541 1552 if (error) 1542 1553 goto error_rele; ··· 1580 1593 */ 1581 1594 int 1582 1595 xfs_qm_write_sb_changes( 1583 - xfs_mount_t *mp, 1584 - __int64_t flags) 1596 + struct xfs_mount *mp) 1585 1597 { 1586 1598 xfs_trans_t *tp; 1587 1599 int error; ··· 1592 1606 return error; 1593 1607 } 1594 1608 1595 - xfs_mod_sb(tp, flags); 1596 - error = xfs_trans_commit(tp, 0); 1597 - 1598 - return error; 1609 + xfs_mod_sb(tp); 1610 + return xfs_trans_commit(tp, 0); 1599 1611 } 1600 1612 1601 1613
+1 -1
fs/xfs/xfs_qm.h
··· 157 157 #define XFS_QM_RTBWARNLIMIT 5 158 158 159 159 extern void xfs_qm_destroy_quotainfo(struct xfs_mount *); 160 - extern int xfs_qm_write_sb_changes(struct xfs_mount *, __int64_t); 160 + extern int xfs_qm_write_sb_changes(struct xfs_mount *); 161 161 162 162 /* dquot stuff */ 163 163 extern void xfs_qm_dqpurge_all(struct xfs_mount *, uint);
+4 -9
fs/xfs/xfs_qm_syscalls.c
··· 92 92 mutex_unlock(&q->qi_quotaofflock); 93 93 94 94 /* XXX what to do if error ? Revert back to old vals incore ? */ 95 - error = xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS); 96 - return error; 95 + return xfs_qm_write_sb_changes(mp); 97 96 } 98 97 99 98 dqtype = 0; ··· 313 314 { 314 315 int error; 315 316 uint qf; 316 - __int64_t sbflags; 317 317 318 318 flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD); 319 319 /* 320 320 * Switching on quota accounting must be done at mount time. 321 321 */ 322 322 flags &= ~(XFS_ALL_QUOTA_ACCT); 323 - 324 - sbflags = 0; 325 323 326 324 if (flags == 0) { 327 325 xfs_debug(mp, "%s: zero flags, m_qflags=%x", ··· 366 370 /* 367 371 * There's nothing to change if it's the same. 368 372 */ 369 - if ((qf & flags) == flags && sbflags == 0) 373 + if ((qf & flags) == flags) 370 374 return -EEXIST; 371 - sbflags |= XFS_SB_QFLAGS; 372 375 373 - if ((error = xfs_qm_write_sb_changes(mp, sbflags))) 376 + if ((error = xfs_qm_write_sb_changes(mp))) 374 377 return error; 375 378 /* 376 379 * If we aren't trying to switch on quota enforcement, we are done. ··· 796 801 mp->m_sb.sb_qflags = (mp->m_qflags & ~(flags)) & XFS_MOUNT_QUOTA_ALL; 797 802 spin_unlock(&mp->m_sb_lock); 798 803 799 - xfs_mod_sb(tp, XFS_SB_QFLAGS); 804 + xfs_mod_sb(tp); 800 805 801 806 /* 802 807 * We have to make sure that the transaction is secure on disk before we
+1 -1
fs/xfs/xfs_super.c
··· 1258 1258 * might have some superblock changes to update. 1259 1259 */ 1260 1260 if (mp->m_update_flags) { 1261 - error = xfs_mount_log_sb(mp, mp->m_update_flags); 1261 + error = xfs_mount_log_sb(mp); 1262 1262 if (error) { 1263 1263 xfs_warn(mp, "failed to write sb changes"); 1264 1264 return error;