Commit Graph

75 Commits

Author SHA1 Message Date
Bill O'Donnell c9a31c0097 xfs: repair free space btrees
JIRA: https://issues.redhat.com/browse/RHEL-65728

commit 4bdfd7d15747b170ce93a06fafccaf20544b6684
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Fri Dec 15 10:03:32 2023 -0800

    xfs: repair free space btrees

    Rebuild the free space btrees from the gaps in the rmap btree.  Refer to
    the case study in Documentation/filesystems/xfs-online-fsck-design.rst
    for more details.

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-11-20 11:26:03 -06:00
Bill O'Donnell 7f20970b7d xfs: automatic freeing of freshly allocated unwritten space
JIRA: https://issues.redhat.com/browse/RHEL-65728

commit e3042be36c343207b7af249a09f50b4e37e9fda4
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Wed Dec 6 18:40:57 2023 -0800

    xfs: automatic freeing of freshly allocated unwritten space

    As mentioned in the previous commit, online repair wants to allocate
    space to write out a new metadata structure, and it also wants to hedge
    against system crashes during repairs by logging (and later cancelling)
    EFIs to free the space if we crash before committing the new data
    structure.

    Therefore, create a trio of functions to schedule automatic reaping of
    freshly allocated unwritten space.  xfs_alloc_schedule_autoreap creates
    a paused EFI representing the space we just allocated.  Once the
    allocations are made and the autoreaps scheduled, we can start writing
    to disk.

    If the writes succeed, xfs_alloc_cancel_autoreap marks the EFI work
    items as stale and unpauses the pending deferred work item.  Assuming
    that's done in the same transaction that commits the new structure into
    the filesystem, we guarantee that either the new object is fully
    visible, or that all the space gets reclaimed.

    If the writes succeed but only part of an extent was used, repair must
    call the same _cancel_autoreap function to kill the first EFI and then
    log a new EFI to free the unused space.  The first EFI is already
    committed, so it cannot be changed.

    For full extents that aren't used, xfs_alloc_commit_autoreap will
    unpause the EFI, which results in the space being freed during the next
    _defer_finish cycle.

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-11-20 11:25:54 -06:00
Bill O'Donnell 059e57c35e xfs: remove __xfs_free_extent_later
JIRA: https://issues.redhat.com/browse/RHEL-65728

commit 4c88fef3af4a51c2cdba6a28237e98da4873e8dc
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Wed Dec 6 18:40:57 2023 -0800

    xfs: remove __xfs_free_extent_later

    xfs_free_extent_later is a trivial helper, so remove it to reduce the
    amount of thinking required to understand the deferred freeing
    interface.  This will make it easier to introduce automatic reaping of
    speculative allocations in the next patch.

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-11-20 11:25:54 -06:00
Bill O'Donnell 6f62276e77 xfs: AGI length should be bounds checked
JIRA: https://issues.redhat.com/browse/RHEL-25419

commit 2d7d1e7ea321b0b2810eb00183e21332ee9c4b6f
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Thu Jun 29 10:15:45 2023 -0700

    xfs: AGI length should be bounds checked

    Similar to the recent patch strengthening the AGF agf_length
    verification, the AGI verifier does not check that the AGI length field
    is within known good bounds.  This isn't currently checked by runtime
    kernel code, yet we assume in many places that it is correct and verify
    other metadata against it.

    Add length verification to the AGI verifier.  Just like the AGF length
    checking, the length of the AGI must be equal to the size of the AG
    specified in the superblock, unless it is the last AG in the filesystem.
    In that case, it must be less than or equal to sb->sb_agblocks and
    greater than XFS_MIN_AG_BLOCKS, which is the smallest AG a growfs
    operation will allow to exist.

    There's only one place in the filesystem that actually uses agi_length,
    but let's not leave it vulnerable to the same weird nonsense that
    generates syzbot bugs, eh?

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-06-06 10:32:54 -05:00
Bill O'Donnell 956aec9216 xfs: don't block in busy flushing when freeing extents
JIRA: https://issues.redhat.com/browse/RHEL-25419

commit 8ebbf262d4684e035af5e7aa2a71cab636673a9b
Author: Dave Chinner <dchinner@redhat.com>
Date:   Wed Jun 28 11:04:33 2023 -0700

    xfs: don't block in busy flushing when freeing extents

    If the current transaction holds a busy extent and we are trying to
    allocate a new extent to fix up the free list, we can deadlock if
    the AG is entirely empty except for the busy extent held by the
    transaction.

    This can occur at runtime processing an XEFI with multiple extents
    in this path:

    __schedule+0x22f at ffffffff81f75e8f
    schedule+0x46 at ffffffff81f76366
    xfs_extent_busy_flush+0x69 at ffffffff81477d99
    xfs_alloc_ag_vextent_size+0x16a at ffffffff8141711a
    xfs_alloc_ag_vextent+0x19b at ffffffff81417edb
    xfs_alloc_fix_freelist+0x22f at ffffffff8141896f
    xfs_free_extent_fix_freelist+0x6a at ffffffff8141939a
    __xfs_free_extent+0x99 at ffffffff81419499
    xfs_trans_free_extent+0x3e at ffffffff814a6fee
    xfs_extent_free_finish_item+0x24 at ffffffff814a70d4
    xfs_defer_finish_noroll+0x1f7 at ffffffff81441407
    xfs_defer_finish+0x11 at ffffffff814417e1
    xfs_itruncate_extents_flags+0x13d at ffffffff8148b7dd
    xfs_inactive_truncate+0xb9 at ffffffff8148bb89
    xfs_inactive+0x227 at ffffffff8148c4f7
    xfs_fs_destroy_inode+0xb8 at ffffffff81496898
    destroy_inode+0x3b at ffffffff8127d2ab
    do_unlinkat+0x1d1 at ffffffff81270df1
    do_syscall_64+0x40 at ffffffff81f6b5f0
    entry_SYSCALL_64_after_hwframe+0x44 at ffffffff8200007c

    This can also happen in log recovery when processing an EFI
    with multiple extents through this path:

    context_switch() kernel/sched/core.c:3881
    __schedule() kernel/sched/core.c:5111
    schedule() kernel/sched/core.c:5186
    xfs_extent_busy_flush() fs/xfs/xfs_extent_busy.c:598
    xfs_alloc_ag_vextent_size() fs/xfs/libxfs/xfs_alloc.c:1641
    xfs_alloc_ag_vextent() fs/xfs/libxfs/xfs_alloc.c:828
    xfs_alloc_fix_freelist() fs/xfs/libxfs/xfs_alloc.c:2362
    xfs_free_extent_fix_freelist() fs/xfs/libxfs/xfs_alloc.c:3029
    __xfs_free_extent() fs/xfs/libxfs/xfs_alloc.c:3067
    xfs_trans_free_extent() fs/xfs/xfs_extfree_item.c:370
    xfs_efi_recover() fs/xfs/xfs_extfree_item.c:626
    xlog_recover_process_efi() fs/xfs/xfs_log_recover.c:4605
    xlog_recover_process_intents() fs/xfs/xfs_log_recover.c:4893
    xlog_recover_finish() fs/xfs/xfs_log_recover.c:5824
    xfs_log_mount_finish() fs/xfs/xfs_log.c:764
    xfs_mountfs() fs/xfs/xfs_mount.c:978
    xfs_fs_fill_super() fs/xfs/xfs_super.c:1908
    mount_bdev() fs/super.c:1417
    xfs_fs_mount() fs/xfs/xfs_super.c:1985
    legacy_get_tree() fs/fs_context.c:647
    vfs_get_tree() fs/super.c:1547
    do_new_mount() fs/namespace.c:2843
    do_mount() fs/namespace.c:3163
    ksys_mount() fs/namespace.c:3372
    __do_sys_mount() fs/namespace.c:3386
    __se_sys_mount() fs/namespace.c:3383
    __x64_sys_mount() fs/namespace.c:3383
    do_syscall_64() arch/x86/entry/common.c:296
    entry_SYSCALL_64() arch/x86/entry/entry_64.S:180

    To avoid this deadlock, we should not block in
    xfs_extent_busy_flush() if we hold a busy extent in the current
    transaction.

    Now that the EFI processing code can handle requeuing a partially
    completed EFI, we can detect this situation in
    xfs_extent_busy_flush() and return -EAGAIN rather than going to
    sleep forever. The -EAGAIN get propagated back out to the
    xfs_trans_free_extent() context, where the EFD is populated and the
    transaction is rolled, thereby moving the busy extents into the CIL.

    At this point, we can retry the extent free operation again with a
    clean transaction. If we hit the same "all free extents are busy"
    situation when trying to fix up the free list, we can safely call
    xfs_extent_busy_flush() and wait for the busy extents to resolve
    and wake us. At this point, the allocation search can make progress
    again and we can fix up the free list.

    This deadlock was first reported by Chandan in mid-2021, but I
    couldn't make myself understood during review, and didn't have time
    to fix it myself.

    It was reported again in March 2023, and again I have found myself
    unable to explain the complexities of the solution needed during
    review.

    As such, I don't have hours more time to waste trying to get the
    fix written the way it needs to be written, so I'm just doing it
    myself. This patchset is largely based on Wengang Wang's last patch,
    but with all the unnecessary stuff removed, split up into multiple
    patches and cleaned up somewhat.

    Reported-by: Chandan Babu R <chandanrlinux@gmail.com>
    Reported-by: Wengang Wang <wen.gang.wang@oracle.com>
    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-06-06 10:32:53 -05:00
Bill O'Donnell a0ff01e521 xfs: pass alloc flags through to xfs_extent_busy_flush()
JIRA: https://issues.redhat.com/browse/RHEL-25419

commit 6a2a9d776c4ae24a797e25eed2b9f7f33f756296
Author: Dave Chinner <dchinner@redhat.com>
Date:   Wed Jun 28 11:04:32 2023 -0700

    xfs: pass alloc flags through to xfs_extent_busy_flush()

    To avoid blocking in xfs_extent_busy_flush() when freeing extents
    and the only busy extents are held by the current transaction, we
    need to pass the XFS_ALLOC_FLAG_FREEING flag context all the way
    into xfs_extent_busy_flush().

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-06-06 10:32:52 -05:00
Bill O'Donnell 53919fd386 xfs: use deferred frees for btree block freeing
JIRA: https://issues.redhat.com/browse/RHEL-25419

Conflicts: context

commit b742d7b4f0e03df25c2a772adcded35044b625ca
Author: Dave Chinner <dchinner@redhat.com>
Date:   Wed Jun 28 11:04:32 2023 -0700

    xfs: use deferred frees for btree block freeing

    Btrees that aren't freespace management trees use the normal extent
    allocation and freeing routines for their blocks. Hence when a btree
    block is freed, a direct call to xfs_free_extent() is made and the
    extent is immediately freed. This puts the entire free space
    management btrees under this path, so we are stacking btrees on
    btrees in the call stack. The inobt, finobt and refcount btrees
    all do this.

    However, the bmap btree does not do this - it calls
    xfs_free_extent_later() to defer the extent free operation via an
    XEFI and hence it gets processed in deferred operation processing
    during the commit of the primary transaction (i.e. via intent
    chaining).

    We need to change xfs_free_extent() to behave in a non-blocking
    manner so that we can avoid deadlocks with busy extents near ENOSPC
    in transactions that free multiple extents. Inserting or removing a
    record from a btree can cause a multi-level tree merge operation and
    that will free multiple blocks from the btree in a single
    transaction. i.e. we can call xfs_free_extent() multiple times, and
    hence the btree manipulation transaction is vulnerable to this busy
    extent deadlock vector.

    To fix this, convert all the remaining callers of xfs_free_extent()
    to use xfs_free_extent_later() to queue XEFIs and hence defer
    processing of the extent frees to a context that can be safely
    restarted if a deadlock condition is detected.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-06-06 10:32:52 -05:00
Bill O'Donnell de02d9af50 xfs: replace xfs_btree_has_record with a general keyspace scanner
JIRA: https://issues.redhat.com/browse/RHEL-25419

commit 6abc7aef85b1f42cb39a3149f4ab64ca255e41e6
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Tue Apr 11 19:00:10 2023 -0700

    xfs: replace xfs_btree_has_record with a general keyspace scanner

    The current implementation of xfs_btree_has_record returns true if it
    finds /any/ record within the given range.  Unfortunately, that's not
    sufficient for scrub.  We want to be able to tell if a range of keyspace
    for a btree is devoid of records, is totally mapped to records, or is
    somewhere in between.  By forcing this to be a boolean, we conflated
    sparseness and fullness, which caused scrub to return incorrect results.
    Fix the API so that we can tell the caller which of those three is the
    current state.

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-06-05 16:56:20 -05:00
Bill O'Donnell c19da56a05 xfs: standardize ondisk to incore conversion for free space btrees
JIRA: https://issues.redhat.com/browse/RHEL-25419

commit 35e3b9a11740b53387e7af151768c13700f80696
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Tue Apr 11 19:00:01 2023 -0700

    xfs: standardize ondisk to incore conversion for free space btrees

    Create a xfs_alloc_btrec_to_irec function to convert an ondisk record to
    an incore record, and a xfs_alloc_check_irec function to detect
    corruption.  Replace all the open-coded logic with calls to the new
    helpers and bubble up corruption reports.

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-06-05 16:56:16 -05:00
Bill O'Donnell fcbd76dd29 xfs: give xfs_extfree_intent its own perag reference
JIRA: https://issues.redhat.com/browse/RHEL-25419

Conflicts: context differences.

commit f6b384631e1e3482c24e35b53adbd3da50e47e8f
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Tue Apr 11 18:59:54 2023 -0700

    xfs: give xfs_extfree_intent its own perag reference

    Give the xfs_extfree_intent an passive reference to the perag structure
    data.  This reference will be used to enable scrub intent draining
    functionality in subsequent patches.  The space being freed must already
    be allocated, so we need to able to run even if the AG is being offlined
    or shrunk.

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-06-05 16:56:13 -05:00
Bill O'Donnell 720387b2f7 xfs: pass per-ag references to xfs_free_extent
JIRA: https://issues.redhat.com/browse/RHEL-25419

commit b2ccab3199aa7cea9154d80ea2585312c5f6eba0
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Tue Apr 11 18:59:53 2023 -0700

    xfs: pass per-ag references to xfs_free_extent

    Pass a reference to the per-AG structure to xfs_free_extent.  Most
    callers already have one, so we can eliminate unnecessary lookups.  The
    one exception to this is the EFI code, which the next patch will fix.

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2024-06-05 16:56:13 -05:00
Bill O'Donnell 253e8028aa xfs: validate block number being freed before adding to xefi
JIRA: https://issues.redhat.com/browse/RHEL-2002

Conflicts: diffs in xfs_alloc.c due to out of order patch application

commit 7dfee17b13e5024c5c0ab1911859ded4182de3e5
Author: Dave Chinner <dchinner@redhat.com>
Date:   Mon Jun 5 14:48:15 2023 +1000

    xfs: validate block number being freed before adding to xefi

    Bad things happen in defered extent freeing operations if it is
    passed a bad block number in the xefi. This can come from a bogus
    agno/agbno pair from deferred agfl freeing, or just a bad fsbno
    being passed to __xfs_free_extent_later(). Either way, it's very
    difficult to diagnose where a null perag oops in EFI creation
    is coming from when the operation that queued the xefi has already
    been completed and there's no longer any trace of it around....

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Dave Chinner <david@fromorbit.com>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-11-10 07:22:26 -06:00
Bill O'Donnell 7fba5130ec xfs: fold xfs_alloc_ag_vextent() into callers
JIRA: https://issues.redhat.com/browse/RHEL-2002

commit 230e8fe8462ffda0849ea40b61dcf9f233854076
Author: Dave Chinner <dchinner@redhat.com>
Date:   Mon Feb 13 09:14:54 2023 +1100

    xfs: fold xfs_alloc_ag_vextent() into callers

    We don't need the multiplexing xfs_alloc_ag_vextent() provided
    anymore - we can just call the exact/near/size variants directly.
    This allows us to remove args->type completely and stop using
    args->fsbno as an input to the allocator algorithms.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-11-10 07:22:22 -06:00
Bill O'Donnell c3a9573941 xfs: introduce xfs_alloc_vextent_exact_bno()
JIRA: https://issues.redhat.com/browse/RHEL-2002

commit 5f36b2ce79f254dd00cdc88374271df7ce843d56
Author: Dave Chinner <dchinner@redhat.com>
Date:   Mon Feb 13 09:14:54 2023 +1100

    xfs: introduce xfs_alloc_vextent_exact_bno()

    Two of the callers to xfs_alloc_vextent_this_ag() actually want
    exact block number allocation, not anywhere-in-ag allocation. Split
    this out from _this_ag() as a first class citizen so no external
    extent allocation code needs to care about args->type anymore.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-11-10 07:22:22 -06:00
Bill O'Donnell 8ed52fa327 xfs: introduce xfs_alloc_vextent_near_bno()
JIRA: https://issues.redhat.com/browse/RHEL-2002

commit db4710fd12248e5d4c3842520cd13f034136576b
Author: Dave Chinner <dchinner@redhat.com>
Date:   Mon Feb 13 09:14:54 2023 +1100

    xfs: introduce xfs_alloc_vextent_near_bno()

    The remaining callers of xfs_alloc_vextent() are all doing NEAR_BNO
    allocations. We can replace that function with a new
    xfs_alloc_vextent_near_bno() function that does this explicitly.

    We also multiplex NEAR_BNO allocations through
    xfs_alloc_vextent_this_ag via args->type. Replace all of these with
    direct calls to xfs_alloc_vextent_near_bno(), too.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-11-10 07:22:22 -06:00
Bill O'Donnell 1dae8c9676 xfs: use xfs_alloc_vextent_start_bno() where appropriate
JIRA: https://issues.redhat.com/browse/RHEL-2002

commit 2a7f6d41d8b72412228ede538bdf0e81bf9738f4
Author: Dave Chinner <dchinner@redhat.com>
Date:   Mon Feb 13 09:14:53 2023 +1100

    xfs: use xfs_alloc_vextent_start_bno() where appropriate

    Change obvious callers of single AG allocation to use
    xfs_alloc_vextent_start_bno(). Callers no long need to specify
    XFS_ALLOCTYPE_START_BNO, and so the type can be driven inward and
    removed.

    While doing this, also pass the allocation target fsb as a parameter
    rather than encoding it in args->fsbno.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-11-10 07:22:22 -06:00
Bill O'Donnell 2a92353426 xfs: use xfs_alloc_vextent_first_ag() where appropriate
JIRA: https://issues.redhat.com/browse/RHEL-2002

commit 319c9e874ac8721acdb6583e3459ef595e5ed0a6
Author: Dave Chinner <dchinner@redhat.com>
Date:   Mon Feb 13 09:14:53 2023 +1100

    xfs: use xfs_alloc_vextent_first_ag() where appropriate

    Change obvious callers of single AG allocation to use
    xfs_alloc_vextent_first_ag(). This gets rid of
    XFS_ALLOCTYPE_FIRST_AG as the type used within
    xfs_alloc_vextent_first_ag() during iteration is _THIS_AG. Hence we
    can remove the setting of args->type from all the callers of
    _first_ag() and remove the alloctype.

    While doing this, pass the allocation target fsb as a parameter
    rather than encoding it in args->fsbno. This starts the process
    of making args->fsbno an output only variable rather than
    input/output.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-11-10 07:22:22 -06:00
Bill O'Donnell f393aca22e xfs: use xfs_alloc_vextent_this_ag() where appropriate
JIRA: https://issues.redhat.com/browse/RHEL-2002

commit 74c36a8689d3d8ca9d9e96759c9bbf337e049097
Author: Dave Chinner <dchinner@redhat.com>
Date:   Mon Feb 13 09:14:53 2023 +1100

    xfs: use xfs_alloc_vextent_this_ag() where appropriate

    Change obvious callers of single AG allocation to use
    xfs_alloc_vextent_this_ag(). Drive the per-ag grabbing out to the
    callers, too, so that callers with active references don't need
    to do new lookups just for an allocation in a context that already
    has a perag reference.

    The only remaining caller that does single AG allocation through
    xfs_alloc_vextent() is xfs_bmap_btalloc() with
    XFS_ALLOCTYPE_NEAR_BNO. That is going to need more untangling before
    it can be converted cleanly.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-11-10 07:22:21 -06:00
Bill O'Donnell 4a73255629 xfs: pass perag to xfs_alloc_read_agfl
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2167832

commit cec7bb7d58fa0e644f8cec46b081bf5427c1a0f8
Author: Dave Chinner <dchinner@redhat.com>
Date:   Thu Jul 7 19:08:15 2022 +1000

    xfs: pass perag to xfs_alloc_read_agfl

    We have the perag in most places we call xfs_alloc_read_agfl, so
    pass the perag instead of a mount/agno pair.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-05-18 11:11:40 -05:00
Bill O'Donnell 575255a927 xfs: pass perag to xfs_alloc_put_freelist
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2167832

commit 8c392eb27f7a98e403658d066e387c7b1c604f2b
Author: Dave Chinner <dchinner@redhat.com>
Date:   Thu Jul 7 19:08:08 2022 +1000

    xfs: pass perag to xfs_alloc_put_freelist

    It's available in all callers, so pass it in so that the perag can
    be passed further down the stack.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-05-18 11:11:40 -05:00
Bill O'Donnell 27a6f3dcff xfs: pass perag to xfs_alloc_get_freelist
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2167832

commit 49f0d84ec1db5bd46dcf3796fc792fce74ff25a3
Author: Dave Chinner <dchinner@redhat.com>
Date:   Thu Jul 7 19:08:01 2022 +1000

    xfs: pass perag to xfs_alloc_get_freelist

    It's available in all callers, so pass it in so that the perag can
    be passed further down the stack.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-05-18 11:11:40 -05:00
Bill O'Donnell 17cdfdc435 xfs: pass perag to xfs_read_agf
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2167832

commit fa044ae70c64343b07277256952d22a0dc05b319
Author: Dave Chinner <dchinner@redhat.com>
Date:   Thu Jul 7 19:07:54 2022 +1000

    xfs: pass perag to xfs_read_agf

    We have the perag in most places we call xfs_read_agf, so pass the
    perag instead of a mount/agno pair.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-05-18 11:11:39 -05:00
Bill O'Donnell d1a077edc7 xfs: pass perag to xfs_alloc_read_agf()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2167832

commit 08d3e84feeb8cb8e20d54f659446b98fe17913aa
Author: Dave Chinner <dchinner@redhat.com>
Date:   Thu Jul 7 19:07:40 2022 +1000

    xfs: pass perag to xfs_alloc_read_agf()

    xfs_alloc_read_agf() initialises the perag if it hasn't been done
    yet, so it makes sense to pass it the perag rather than pull a
    reference from the buffer. This allows callers to be per-ag centric
    rather than passing mount/agno pairs everywhere.

    Whilst modifying the xfs_reflink_find_shared() function definition,
    declare it static and remove the extern declaration as it is an
    internal function only these days.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-05-18 11:11:39 -05:00
Bill O'Donnell 51f3b2d709 xfs: kill xfs_alloc_pagf_init()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2167832

commit 76b47e528e3a27a3bf3b3f9153aad9435e03be8c
Author: Dave Chinner <dchinner@redhat.com>
Date:   Thu Jul 7 19:07:32 2022 +1000

    xfs: kill xfs_alloc_pagf_init()

    Trivial wrapper around xfs_alloc_read_agf(), can be easily replaced
    by passing a NULL agfbp to xfs_alloc_read_agf().

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-05-18 11:11:39 -05:00
Bill O'Donnell 4ad6256e1e xfs: convert AGF log flags to unsigned.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2167832

commit f53dde11b405e7c655997513822c90ac9761efdb
Author: Dave Chinner <dchinner@redhat.com>
Date:   Thu Apr 21 10:46:16 2022 +1000

    xfs: convert AGF log flags to unsigned.

    5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
    fields to be unsigned.

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Dave Chinner <david@fromorbit.com>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-05-18 11:11:06 -05:00
Bill O'Donnell 8a273eed09 xfs: document the XFS_ALLOC_AGFL_RESERVE constant
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2167832

commit 93defd5a15dd74791532692cc59be3a1aaa045fe
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Wed Mar 16 11:38:27 2022 -0700

    xfs: document the XFS_ALLOC_AGFL_RESERVE constant

    Currently, we use this undocumented macro to encode the minimum number
    of blocks needed to replenish a completely empty AGFL when an AG is
    nearly full.  This has lead to confusion on the part of the maintainers,
    so let's document what the value actually means, and move it to
    xfs_alloc.c since it's not used outside of that module.

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-05-18 11:10:51 -05:00
Carlos Maiolino 13965fbe6b xfs: reduce the size of struct xfs_extent_free_item
Bugzilla: https://bugzilla.redhat.com/2125724

We only use EFIs to free metadata blocks -- not regular data/attr fork
extents.  Remove all the fields that we never use, for a net reduction
of 16 bytes.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
(cherry picked from commit b3b5ff412ab04afd99173bb12d3cc146ee478ae7)
2022-10-21 12:50:46 +02:00
Carlos Maiolino 93fff0d397 xfs: rename xfs_bmap_add_free to xfs_free_extent_later
Bugzilla: https://bugzilla.redhat.com/2125724

xfs_bmap_add_free isn't a block mapping function; it schedules deferred
freeing operations for a later point in a compound transaction chain.
While it's primarily used by bunmapi, its use has expanded beyond that.
Move it to xfs_alloc.c and rename the function since it's now general
freeing functionality.  Bring the slab cache bits in line with the
way we handle the other intent items.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
(cherry picked from commit c201d9ca5392b20f04882848a071025b0e194c17)
2022-10-21 12:50:46 +02:00
Carlos Maiolino 4771fa63ec xfs: rename m_ag_maxlevels to m_allocbt_maxlevels
Bugzilla: https://bugzilla.redhat.com/2125724

Years ago when XFS was thought to be much more simple, we introduced
m_ag_maxlevels to specify the maximum btree height of per-AG btrees for
a given filesystem mount.  Then we observed that inode btrees don't
actually have the same height and split that off; and now we have rmap
and refcount btrees with much different geometries and separate
maxlevels variables.

The 'ag' part of the name doesn't make much sense anymore, so rename
this to m_alloc_maxlevels to reinforce that this is the maximum height
of the *free space* btrees.  This sets us up for the next patch, which
will add a variable to track the maximum height of all AG btrees.

(Also take the opportunity to improve adjacent comments and fix minor
style problems.)

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
(cherry picked from commit 7cb3efb4cfdd4f3eb1f36b0ce39254b848ff2371)
2022-10-21 12:50:46 +02:00
Brian Foster d3185fdb89 xfs: convert xfs_sb_version_has checks to use mount features
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2083143
Upstream Status: linux.git

commit ebd9027d088b3a4e49d294f79e6cadb7b7a88b28
Author: Dave Chinner <dchinner@redhat.com>
Date:   Wed Aug 18 18:46:55 2021 -0700

    xfs: convert xfs_sb_version_has checks to use mount features

    This is a conversion of the remaining xfs_sb_version_has..(sbp)
    checks to use xfs_has_..(mp) feature checks.

    This was largely done with a vim replacement macro that did:

    :0,$s/xfs_sb_version_has\(.*\)&\(.*\)->m_sb/xfs_has_\1\2/g<CR>

    A couple of other variants were also used, and the rest touched up
    by hand.

    $ size -t fs/xfs/built-in.a
               text    data     bss     dec     hex filename
    before  1127533  311352     484 1439369  15f689 (TOTALS)
    after   1125360  311352     484 1437196  15ee0c (TOTALS)

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Brian Foster <bfoster@redhat.com>
2022-08-25 08:11:35 -04:00
Brian Foster af9b90b846 xfs: make the record pointer passed to query_range functions const
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2083143
Upstream Status: linux.git

commit 159eb69dba8baf6d5b58b69936920fb311324c82
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Tue Aug 10 17:02:16 2021 -0700

    xfs: make the record pointer passed to query_range functions const

    The query_range functions are supposed to call a caller-supplied
    function on each record found in the dataset.  These functions don't
    own the memory storing the record, so don't let them change the record.

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>

Signed-off-by: Brian Foster <bfoster@redhat.com>
2022-08-25 08:11:29 -04:00
Brian Foster 86b20de508 xfs: make the key parameters to all btree query range functions const
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2083143
Upstream Status: linux.git

commit 04dcb47482a9d9e27feba48ca92613edced42ef9
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Tue Aug 10 17:02:15 2021 -0700

    xfs: make the key parameters to all btree query range functions const

    Range query functions are not supposed to modify the query keys that are
    being passed in, so mark them all const.

    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>

Signed-off-by: Brian Foster <bfoster@redhat.com>
2022-08-25 08:11:29 -04:00
Dave Chinner 45d0662117 xfs: pass perags through to the busy extent code
All of the callers of the busy extent API either have perag
references available to use so we can pass a perag to the busy
extent functions rather than having them have to do unnecessary
lookups.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
2021-06-02 10:48:24 +10:00
Chandan Babu R 3015196746 xfs: Introduce error injection to allocate only minlen size extents for files
This commit adds XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT error tag which
helps userspace test programs to get xfs_bmap_btalloc() to always
allocate minlen sized extents.

This is required for test programs which need a guarantee that minlen
extents allocated for a file do not get merged with their existing
neighbours in the inode's BMBT. "Inode fork extent overflow check" for
Directories, Xattrs and extension of realtime inodes need this since the
file offset at which the extents are being allocated cannot be
explicitly controlled from userspace.

One way to use this error tag is to,
1. Consume all of the free space by sequentially writing to a file.
2. Punch alternate blocks of the file. This causes CNTBT to contain
   sufficient number of one block sized extent records.
3. Inject XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT error tag.
After step 3, xfs_bmap_btalloc() will issue space allocation
requests for minlen sized extents only.

ENOSPC error code is returned to userspace when there aren't any "one
block sized" extents left in any of the AGs.

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2021-01-22 16:54:49 -08:00
Nishad Kamdar 508578f2f5 xfs: Use the correct style for SPDX License Identifier
This patch corrects the SPDX License Identifier style in header files
related to XFS File System support. For C header files
Documentation/process/license-rules.rst mandates C-like comments.
(opposed to C source files where C++ style should be used).

Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2020-05-13 15:32:45 -07:00
Christoph Hellwig 183606d824 xfs: remove the agfl_bno member from struct xfs_agfl
struct xfs_agfl is a header in front of the AGFL entries that exists
for CRC enabled file systems.  For not CRC enabled file systems the AGFL
is simply a list of agbno.  Make the CRC case similar to that by just
using the list behind the new header.  This indirectly solves a problem
with modern gcc versions that warn about taking addresses of packed
structures (and we have to pack the AGFL given that gcc rounds up
structure sizes).  Also replace the helper macro to get from a buffer
with an inline function in xfs_alloc.h to make the code easier to
read.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2020-03-11 09:11:38 -07:00
Christoph Hellwig c34d570d15 xfs: cleanup use of the XFS_ALLOC_ flags
Always set XFS_ALLOC_USERDATA for data fork allocations, and check it
in xfs_alloc_is_userdata instead of the current obsfucated check.
Also remove the xfs_alloc_is_userdata and xfs_alloc_allow_busy_reuse
helpers to make the code a little easier to understand.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-11-03 10:22:31 -08:00
Christoph Hellwig fd638f1de1 xfs: move extent zeroing to xfs_bmapi_allocate
Move the extent zeroing case there for the XFS_BMAPI_ZERO flag outside
the low-level allocator and into xfs_bmapi_allocate, where is still
is in transaction context, but outside the very lowlevel code where
it doesn't belong.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-11-03 10:22:30 -08:00
Darrick J. Wong ce84042926 xfs: revert 1baa2800e6 ("xfs: remove the unused XFS_ALLOC_USERDATA flag")
Revert this commit, as it caused periodic regressions in xfs/173 w/
1k blocks.

[1] https://lore.kernel.org/lkml/20190919014602.GN15734@shao2-debian/

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
2019-09-23 13:05:00 -07:00
Christoph Hellwig 1baa2800e6 xfs: remove the unused XFS_ALLOC_USERDATA flag
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2019-08-30 22:43:58 -07:00
Darrick J. Wong 66e3237e72 xfs: const-ify xfs_owner_info arguments
Only certain functions actually change the contents of an
xfs_owner_info; the rest can accept a const struct pointer.  This will
enable us to save stack space by hoisting static owner info types to
be const global variables.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
2018-12-12 08:47:16 -08:00
Brian Foster 64396ff2c2 xfs: remove xfs_alloc_arg firstblock field
The xfs_alloc_arg.firstblock field is used to control the starting
agno for an allocation. The structure already carries a pointer to
the transaction, which carries the current firstblock value.

Remove the field and access ->t_firstblock directly in the
allocation code.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2018-07-11 22:26:30 -07:00
Dave Chinner 86210fbeba xfs: move various type verifiers to common file
New verification functions like xfs_verify_fsbno() and
xfs_verify_agino() are spread across multiple files and different
header files. They really don't fit cleanly into the places they've
been put, and have wider scope than the current header includes.

Move the type verifiers to a new file in libxfs (xfs-types.c) and
the prototypes to xfs_types.h where they will be visible to all the
code that uses the types.

Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2018-06-08 10:07:51 -07:00
Dave Chinner 0b61f8a407 xfs: convert to SPDX license tags
Remove the verbose license text from XFS files and replace them
with SPDX tags. This does not change the license of any of the code,
merely refers to the common, up-to-date license files in LICENSES/

This change was mostly scripted. fs/xfs/Makefile and
fs/xfs/libxfs/xfs_fs.h were modified by hand, the rest were detected
and modified by the following command:

for f in `git grep -l "GNU General" fs/xfs/` ; do
	echo $f
	cat $f | awk -f hdr.awk > $f.new
	mv -f $f.new $f
done

And the hdr.awk script that did the modification (including
detecting the difference between GPL-2.0 and GPL-2.0+ licenses)
is as follows:

$ cat hdr.awk
BEGIN {
	hdr = 1.0
	tag = "GPL-2.0"
	str = ""
}

/^ \* This program is free software/ {
	hdr = 2.0;
	next
}

/any later version./ {
	tag = "GPL-2.0+"
	next
}

/^ \*\// {
	if (hdr > 0.0) {
		print "// SPDX-License-Identifier: " tag
		print str
		print $0
		str=""
		hdr = 0.0
		next
	}
	print $0
	next
}

/^ \* / {
	if (hdr > 1.0)
		next
	if (hdr > 0.0) {
		if (str != "")
			str = str "\n"
		str = str $0
		next
	}
	print $0
	next
}

/^ \*/ {
	if (hdr > 0.0)
		next
	print $0
	next
}

// {
	if (hdr > 0.0) {
		if (str != "")
			str = str "\n"
		str = str $0
		next
	}
	print $0
}

END { }
$

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2018-06-06 14:17:53 -07:00
Darrick J. Wong 9f3a080ef1 xfs: hoist xfs_scrub_agfl_walk to libxfs as xfs_agfl_walk
This function is basically a generic AGFL block iterator, so promote it
to libxfs ahead of online repair wanting to use it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
2018-05-15 18:12:50 -07:00
Brian Foster 4e529339af xfs: factor out nodiscard helpers
The changes to skip discards of speculative preallocation and
unwritten extents introduced several new wrapper functions through
the bunmapi -> extent free codepath to reduce churn in all of the
associated callers. In several cases, these wrappers simply toggle a
single flag to skip or not skip discards for the resulting blocks.

The explicit _nodiscard() wrappers for such an isolated set of
callers is a bit overkill. Kill off these wrappers and replace with
the calls to the underlying functions in the contexts that need to
control discard behavior. Retain the wrappers that preserve the
original calling conventions to serve the original purpose of
reducing code churn.

This is a refactoring patch and does not change behavior.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2018-05-15 17:57:05 -07:00
Brian Foster fcb762f5de xfs: add bmapi nodiscard flag
Freed extents are unconditionally discarded when online discard is
enabled. Define XFS_BMAPI_NODISCARD to allow callers to bypass
discards when unnecessary. For example, this will be useful for
eofblocks trimming.

This patch does not change behavior.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2018-05-10 08:56:46 -07:00
Brian Foster 4223f659dd xfs: create agfl block free helper function
Refactor the AGFL block free code into a new helper such that it can
be invoked from deferred context. No functional changes.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2018-05-09 10:04:01 -07:00
Eric Sandeen a1f69417c6 xfs: non-scrub - remove unused function parameters
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2018-04-09 10:23:42 -07:00
Dave Chinner a78ee256c3 xfs: convert XFS_AGFL_SIZE to a helper function
The AGFL size calculation is about to get more complex, so lets turn
the macro into a function first and remove the macro.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
[darrick: forward port to newer kernel, simplify the helper]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
2018-03-11 20:27:56 -07:00