• Dave Chinner's avatar
    xfs: use an empty transaction for fstrim · 178231af
    Dave Chinner authored
    We currently use a btree walk in the fstrim code. This requires a
    btree cursor and btree cursors are only used inside transactions
    except for the fstrim code. This means that all the btree operations
    that allocate memory operate in both GFP_KERNEL and GFP_NOFS
    contexts.
    
    This causes problems with lockdep being unable to determine the
    difference between objects that are safe to lock both above and
    below memory reclaim. Free space btree buffers are definitely locked
    both above and below reclaim and that means we have to mark all
    btree infrastructure allocations with GFP_NOFS to avoid potential
    lockdep false positives.
    
    If we wrap this btree walk in an empty cursor, all btree walks are
    now done under transaction context and so all allocations inherit
    GFP_NOFS context from the tranaction. This enables us to move all
    the btree allocations to GFP_KERNEL context and hence help remove
    the explicit use of GFP_NOFS in XFS.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
    178231af
xfs_discard.c 12.5 KB