Skip to content
Permalink
Allison-Hender…
Switch branches/tags

Commits on Nov 17, 2021

  1. xfs: Add helper function xfs_attr_leaf_addname

    This patch adds a helper function xfs_attr_leaf_addname.  While this
    does help to break down xfs_attr_set_iter, it does also hoist out some
    of the state management.  This patch has been moved to the end of the
    clean up series for further discussion.
    
    Suggested-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  2. xfs: Merge xfs_delattr_context into xfs_attr_item

    This is a clean up patch that merges xfs_delattr_context into
    xfs_attr_item.  Now that the refactoring is complete and the delayed
    operation infrastructure is in place, we can combine these to eliminate
    the extra struct
    
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  3. xfs: Add larp debug option

    This patch adds a debug option to enable log attribute replay. Eventually
    this can be removed when delayed attrs becomes permanent.
    
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  4. xfs: Add log attribute error tag

    This patch adds an error tag that we can use to test log attribute
    recovery and replay
    
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  5. xfs: Remove unused xfs_attr_*_args

    Remove xfs_attr_set_args, xfs_attr_remove_args, and xfs_attr_trans_roll.
    These high level loops are now driven by the delayed operations code,
    and can be removed.
    
    Additionally collapse in the leaf_bp parameter of xfs_attr_set_iter
    since we only have one caller that passes dac->leaf_bp
    
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  6. xfs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred

    These routines set up and queue a new deferred attribute operations.
    These functions are meant to be called by any routine needing to
    initiate a deferred attribute operation as opposed to the existing
    inline operations. New helper function xfs_attr_item_init also added.
    
    Finally enable delayed attributes in xfs_attr_set and xfs_attr_remove.
    
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  7. xfs: Skip flip flags for delayed attrs

    This is a clean up patch that skips the flip flag logic for delayed attr
    renames.  Since the log replay keeps the inode locked, we do not need to
    worry about race windows with attr lookups.  So we can skip over
    flipping the flag and the extra transaction roll for it
    
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  8. xfs: Implement attr logging and replay

    This patch adds the needed routines to create, log and recover logged
    extended attribute intents.
    
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  9. xfs: Set up infrastructure for log attribute replay

    Currently attributes are modified directly across one or more
    transactions. But they are not logged or replayed in the event of an
    error. The goal of log attr replay is to enable logging and replaying
    of attribute operations using the existing delayed operations
    infrastructure.  This will later enable the attributes to become part of
    larger multi part operations that also must first be recorded to the
    log.  This is mostly of interest in the scheme of parent pointers which
    would need to maintain an attribute containing parent inode information
    any time an inode is moved, created, or removed.  Parent pointers would
    then be of interest to any feature that would need to quickly derive an
    inode path from the mount point. Online scrub, nfs lookups and fs grow
    or shrink operations are all features that could take advantage of this.
    
    This patch adds two new log item types for setting or removing
    attributes as deferred operations.  The xfs_attri_log_item will log an
    intent to set or remove an attribute.  The corresponding
    xfs_attrd_log_item holds a reference to the xfs_attri_log_item and is
    freed once the transaction is done.  Both log items use a generic
    xfs_attr_log_format structure that contains the attribute name, value,
    flags, inode, and an op_flag that indicates if the operations is a set
    or remove.
    
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  10. xfs: Return from xfs_attr_set_iter if there are no more rmtblks to pr…

    …ocess
    
    During an attr rename operation, blocks are saved for later removal
    as rmtblkno2. The rmtblkno is used in the case of needing to alloc
    more blocks if not enough were available.  However, in the case
    that no further blocks need to be added or removed, we can return as soon
    as xfs_attr_node_addname completes, rather than rolling the transaction
    with an -EAGAIN return.  This extra loop does not hurt anything right
    now, but it will be a problem later when we get into log items because
    we end up with an empty log transaction.  So, add a simple check to
    cut out the unneeded iteration.
    
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  11. xfs: don't commit the first deferred transaction without intents

    If the first operation in a string of defer ops has no intents,
    then there is no reason to commit it before running the first call
    to xfs_defer_finish_one(). This allows the defer ops to be used
    effectively for non-intent based operations without requiring an
    unnecessary extra transaction commit when first called.
    
    This fixes a regression in per-attribute modification transaction
    count when delayed attributes are not being used.
    
    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021
  12. xfs: Fix double unlock in defer capture code

    The new deferred attr patch set uncovered a double unlock in the
    recent port of the defer ops capture and continue code.  During log
    recovery, we're allowed to hold buffers to a transaction that's being
    used to replay an intent item.  When we capture the resources as part
    of scheduling a continuation of an intent chain, we call xfs_buf_hold
    to retain our reference to the buffer beyond the transaction commit,
    but we do /not/ call xfs_trans_bhold to maintain the buffer lock.
    This means that xfs_defer_ops_continue needs to relock the buffers
    before xfs_defer_restore_resources joins then tothe new transaction.
    
    Additionally, the buffers should not be passed back via the dres
    structure since they need to remain locked unlike the inodes.  So
    simply set dr_bufs to zero after populating the dres structure.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
    allisonhenderson authored and intel-lab-lkp committed Nov 17, 2021

Commits on Nov 11, 2021

  1. xfs: sync xfs_btree_split macros with userspace libxfs

    Sync this one last bit of discrepancy between kernel and userspace
    libxfs.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Eric Sandeen <sandeen@redhat.com>
    Darrick J. Wong committed Nov 11, 2021

Commits on Nov 10, 2021

  1. xfs: #ifdef out perag code for userspace

    The xfs_perag structure and initialization is unused in userspace,
    so #ifdef it out with __KERNEL__ to facilitate the xfsprogs sync
    and build.
    
    Signed-off-by: Eric Sandeen <esandeen@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Eric Sandeen authored and Darrick J. Wong committed Nov 10, 2021

Commits on Nov 8, 2021

  1. xfs: use swap() to make dabtree code cleaner

    Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
    opencoding it.
    
    Reported-by: Zeal Robot <zealci@zte.com.cn>
    Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Yang Guang authored and Darrick J. Wong committed Nov 8, 2021

Commits on Oct 30, 2021

  1. xfs: use swap() to make code cleaner

    Use swap() in order to make code cleaner. Issue found by coccinelle.
    
    Reported-by: Zeal Robot <zealci@zte.com.cn>
    Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Changcheng Deng authored and Darrick J. Wong committed Oct 30, 2021
  2. xfs: Remove duplicated include in xfs_super

    Fix following checkincludes.pl warning:
    ./fs/xfs/xfs_super.c: xfs_btree.h is included more than once.
    
    The include is in line 15. Remove the duplicated here.
    
    Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Wan Jiabing authored and Darrick J. Wong committed Oct 30, 2021

Commits on Oct 22, 2021

  1. xfs: punch out data fork delalloc blocks on COW writeback failure

    If writeback I/O to a COW extent fails, the COW fork blocks are
    punched out and the data fork blocks left alone. It is possible for
    COW fork blocks to overlap non-shared data fork blocks (due to
    cowextsz hint prealloc), however, and writeback unconditionally maps
    to the COW fork whenever blocks exist at the corresponding offset of
    the page undergoing writeback. This means it's quite possible for a
    COW fork extent to overlap delalloc data fork blocks, writeback to
    convert and map to the COW fork blocks, writeback to fail, and
    finally for ioend completion to cancel the COW fork blocks and leave
    stale data fork delalloc blocks around in the inode. The blocks are
    effectively stale because writeback failure also discards dirty page
    state.
    
    If this occurs, it is likely to trigger assert failures, free space
    accounting corruption and failures in unrelated file operations. For
    example, a subsequent reflink attempt of the affected file to a new
    target file will trip over the stale delalloc in the source file and
    fail. Several of these issues are occasionally reproduced by
    generic/648, but are reproducible on demand with the right sequence
    of operations and timely I/O error injection.
    
    To fix this problem, update the ioend failure path to also punch out
    underlying data fork delalloc blocks on I/O error. This is analogous
    to the writeback submission failure path in xfs_discard_page() where
    we might fail to map data fork delalloc blocks and consistent with
    the successful COW writeback completion path, which is responsible
    for unmapping from the data fork and remapping in COW fork blocks.
    
    Fixes: 787eb48 ("xfs: fix and streamline error handling in xfs_end_io")
    Signed-off-by: Brian Foster <bfoster@redhat.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Brian Foster authored and Darrick J. Wong committed Oct 22, 2021
  2. xfs: remove unused parameter from refcount code

    The owner info parameter is always NULL, so get rid of the parameter.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
    Darrick J. Wong committed Oct 22, 2021
  3. xfs: reduce the size of struct xfs_extent_free_item

    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>
    Darrick J. Wong committed Oct 22, 2021
  4. xfs: rename xfs_bmap_add_free to xfs_free_extent_later

    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>
    Darrick J. Wong committed Oct 22, 2021
  5. xfs: create slab caches for frequently-used deferred items

    Create slab caches for the high-level structures that coordinate
    deferred intent items, since they're used fairly heavily.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
    Darrick J. Wong committed Oct 22, 2021
  6. xfs: compact deferred intent item structures

    Rearrange these structs to reduce the amount of unused padding bytes.
    This saves eight bytes for each of the three structs changed here, which
    means they're now all (rmap/bmap are 64 bytes, refc is 32 bytes) even
    powers of two.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
    Darrick J. Wong committed Oct 22, 2021
  7. xfs: rename _zone variables to _cache

    Now that we've gotten rid of the kmem_zone_t typedef, rename the
    variables to _cache since that's what they are.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
    Darrick J. Wong committed Oct 22, 2021
  8. xfs: remove kmem_zone typedef

    Remove these typedefs by referencing kmem_cache directly.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
    Darrick J. Wong committed Oct 22, 2021

Commits on Oct 19, 2021

  1. xfs: use separate btree cursor cache for each btree type

    Now that we have the infrastructure to track the max possible height of
    each btree type, we can create a separate slab cache for cursors of each
    type of btree.  For smaller indices like the free space btrees, this
    means that we can pack more cursors into a slab page, improving slab
    utilization.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Darrick J. Wong committed Oct 19, 2021
  2. xfs: compute absolute maximum nlevels for each btree type

    Add code for all five btree types so that we can compute the absolute
    maximum possible btree height for each btree type.  This is a setup for
    the next patch, which makes every btree type have its own cursor cache.
    
    The functions are exported so that we can have xfs_db report the
    absolute maximum btree heights for each btree type, rather than making
    everyone run their own ad-hoc computations.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Darrick J. Wong committed Oct 19, 2021
  3. xfs: kill XFS_BTREE_MAXLEVELS

    Nobody uses this symbol anymore, so kill it.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Darrick J. Wong committed Oct 19, 2021
  4. xfs: compute the maximum height of the rmap btree when reflink enabled

    Instead of assuming that the hardcoded XFS_BTREE_MAXLEVELS value is big
    enough to handle the maximally tall rmap btree when all blocks are in
    use and maximally shared, let's compute the maximum height assuming the
    rmapbt consumes as many blocks as possible.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Darrick J. Wong committed Oct 19, 2021
  5. xfs: clean up xfs_btree_{calc_size,compute_maxlevels}

    During review of the next patch, Dave remarked that he found these two
    btree geometry calculation functions lacking in documentation and that
    they performed more work than was really necessary.
    
    These functions take the same parameters and have nearly the same logic;
    the only real difference is in the return values.  Reword the function
    comment to make it clearer what each function does, and move them to be
    adjacent to reinforce their relation.
    
    Clean up both of them to stop opencoding the howmany functions, stop
    using the uint typedefs, and make them both support computations for
    more than 2^32 leaf records, since we're going to need all of the above
    for files with large data forks and large rmap btrees.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Darrick J. Wong committed Oct 19, 2021
  6. xfs: compute maximum AG btree height for critical reservation calcula…

    …tion
    
    Compute the actual maximum AG btree height for deciding if a per-AG
    block reservation is critically low.  This only affects the sanity check
    condition, since we /generally/ will trigger on the 10% threshold.  This
    is a long-winded way of saying that we're removing one more usage of
    XFS_BTREE_MAXLEVELS.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Darrick J. Wong committed Oct 19, 2021
  7. xfs: rename m_ag_maxlevels to m_allocbt_maxlevels

    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>
    Darrick J. Wong committed Oct 19, 2021
  8. xfs: dynamically allocate cursors based on maxlevels

    To support future btree code, we need to be able to size btree cursors
    dynamically for very large btrees.  Switch the maxlevels computation to
    use the precomputed values in the superblock, and create cursors that
    can handle a certain height.  For now, we retain the btree cursor cache
    that can handle up to 9-level btrees, though a subsequent patch
    introduces separate caches for each btree type, where each cache's
    objects will be exactly tall enough to handle the specific btree type.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Darrick J. Wong committed Oct 19, 2021
  9. xfs: encode the max btree height in the cursor

    Encode the maximum btree height in the cursor, since we're soon going to
    allow smaller cursors for AG btrees and larger cursors for file btrees.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Darrick J. Wong committed Oct 19, 2021
  10. xfs: refactor btree cursor allocation function

    Refactor btree allocation to a common helper.
    
    Signed-off-by: Darrick J. Wong <djwong@kernel.org>
    Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Darrick J. Wong committed Oct 19, 2021
Older