projects/linux·commit c148bc75

Merge tag 'xfs-6.15-merge' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

c148bc75 · Linus Torvalds <[email protected]> · 2025-03-27 13:07:00 -07:00

Pull xfs updates from Carlos Maiolino:

 - XFS zoned allocator: Enables XFS to support zoned devices using its
   real-time allocator

 - Use folios/vmalloc for buffer cache backing memory

 - Some code cleanups and bug fixes

* tag 'xfs-6.15-merge' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (70 commits)
  xfs: remove the flags argument to xfs_buf_get_uncached
  xfs: remove the flags argument to xfs_buf_read_uncached
  xfs: remove xfs_buf_free_maps
  xfs: remove xfs_buf_get_maps
  xfs: call xfs_buf_alloc_backing_mem from _xfs_buf_alloc
  xfs: remove unnecessary NULL check before kvfree()
  xfs: don't wake zone space waiters without m_zone_info
  xfs: don't increment m_generation for all errors in xfs_growfs_data
  xfs: fix a missing unlock in xfs_growfs_data
  xfs: Remove duplicate xfs_rtbitmap.h header
  xfs: trigger zone GC when out of available rt blocks
  xfs: trace what memory backs a buffer
  xfs: cleanup mapping tmpfs folios into the buffer cache
  xfs: use vmalloc instead of vm_map_area for buffer backing memory
  xfs: buffer items don't straddle pages anymore
  xfs: kill XBF_UNMAPPED
  xfs: convert buffer cache to use high order folios
  xfs: remove the kmalloc to page allocator fallback
  xfs: refactor backing memory allocations for buffers
  xfs: remove xfs_buf_is_vmapped
  ...
Commit
c148bc7535650fbfa95a1f571b9ffa2ab478ea33
Parents
0de1e842 · b3f8f290

Merge commit. Changes below are compared with the first parent: 0de1e842.

Changes

82 files changed · +5920 −1488

FileStatusAddDelContent
fs/xfs/Makefilemodified+6−1View file
fs/xfs/libxfs/xfs_ag.cmodified+1−1View file
fs/xfs/libxfs/xfs_bmap.cmodified+23−293View file
fs/xfs/libxfs/xfs_bmap.hmodified+2−5View file
fs/xfs/libxfs/xfs_format.hmodified+16−4View file
fs/xfs/libxfs/xfs_fs.hmodified+13−1View file
fs/xfs/libxfs/xfs_group.hmodified+25−6View file
fs/xfs/libxfs/xfs_ialloc.cmodified+2−2View file
fs/xfs/libxfs/xfs_inode_buf.cmodified+17−6View file
fs/xfs/libxfs/xfs_inode_util.cmodified+1−0View file
fs/xfs/libxfs/xfs_log_format.hmodified+6−1View file
fs/xfs/libxfs/xfs_metafile.cmodified+107−60View file
fs/xfs/libxfs/xfs_metafile.hmodified+3−3View file
fs/xfs/libxfs/xfs_ondisk.hmodified+4−2View file
fs/xfs/libxfs/xfs_rtbitmap.cmodified+11−0View file
fs/xfs/libxfs/xfs_rtgroup.cmodified+23−16View file
fs/xfs/libxfs/xfs_rtgroup.hmodified+39−11View file
fs/xfs/libxfs/xfs_rtrmap_btree.cmodified+19−0View file
fs/xfs/libxfs/xfs_rtrmap_btree.hmodified+2−0View file
fs/xfs/libxfs/xfs_sb.cmodified+74−7View file
fs/xfs/libxfs/xfs_types.hmodified+28−0View file
fs/xfs/libxfs/xfs_zones.cadded+186−0View file
fs/xfs/libxfs/xfs_zones.hadded+35−0View file
fs/xfs/scrub/agheader.cmodified+2−0View file
fs/xfs/scrub/bmap.cmodified+2−2View file
fs/xfs/scrub/fscounters.cmodified+15−7View file
fs/xfs/scrub/fscounters_repair.cmodified+7−5View file
fs/xfs/scrub/inode.cmodified+7−0View file
fs/xfs/scrub/inode_repair.cmodified+4−3View file
fs/xfs/scrub/newbt.cmodified+1−1View file
fs/xfs/scrub/reap.cmodified+6−3View file
fs/xfs/scrub/repair.cmodified+22−15View file
fs/xfs/scrub/rtbitmap.cmodified+9−2View file
fs/xfs/scrub/rtrefcount_repair.cmodified+6−28View file
fs/xfs/scrub/rtrmap_repair.cmodified+5−24View file
fs/xfs/scrub/scrub.cmodified+2−0View file
fs/xfs/xfs_aops.cmodified+161−10View file
fs/xfs/xfs_aops.hmodified+2−1View file
fs/xfs/xfs_bmap_util.cmodified+25−7View file
fs/xfs/xfs_bmap_util.hmodified+7−5View file
fs/xfs/xfs_buf.cmodified+203−355View file
fs/xfs/xfs_buf.hmodified+13−16View file
fs/xfs/xfs_buf_item.cmodified+0−114View file
fs/xfs/xfs_buf_item_recover.cmodified+1−7View file
fs/xfs/xfs_buf_mem.cmodified+10−33View file
fs/xfs/xfs_buf_mem.hmodified+2−4View file
fs/xfs/xfs_discard.cmodified+2−1View file
fs/xfs/xfs_extent_busy.cmodified+1−1View file
fs/xfs/xfs_extfree_item.cmodified+25−10View file
fs/xfs/xfs_file.cmodified+309−38View file
fs/xfs/xfs_fsmap.cmodified+68−18View file
fs/xfs/xfs_fsops.cmodified+36−31View file
fs/xfs/xfs_fsops.hmodified+2−1View file
fs/xfs/xfs_icache.cmodified+3−3View file
fs/xfs/xfs_inode.cmodified+3−3View file
fs/xfs/xfs_inode.hmodified+14−14View file
fs/xfs/xfs_inode_item.cmodified+1−0View file
fs/xfs/xfs_inode_item_recover.cmodified+1−0View file
fs/xfs/xfs_ioctl.cmodified+6−6View file
fs/xfs/xfs_iomap.cmodified+521−7View file
fs/xfs/xfs_iomap.hmodified+5−2View file
fs/xfs/xfs_iops.cmodified+29−2View file
fs/xfs/xfs_log.cmodified+4−0View file
fs/xfs/xfs_message.cmodified+4−0View file
fs/xfs/xfs_message.hmodified+1−0View file
fs/xfs/xfs_mount.cmodified+123−89View file
fs/xfs/xfs_mount.hmodified+108−23View file
fs/xfs/xfs_qm.cmodified+2−1View file
fs/xfs/xfs_reflink.cmodified+6−12View file
fs/xfs/xfs_rtalloc.cmodified+145−99View file
fs/xfs/xfs_rtalloc.hmodified+0−5View file
fs/xfs/xfs_super.cmodified+129−36View file
fs/xfs/xfs_sysfs.cmodified+68−7View file
fs/xfs/xfs_sysfs.hmodified+2−3View file
fs/xfs/xfs_trace.cmodified+2−0View file
fs/xfs/xfs_trace.hmodified+203−15View file
fs/xfs/xfs_zone_alloc.cadded+1220−0View file
fs/xfs/xfs_zone_alloc.hadded+70−0View file
fs/xfs/xfs_zone_gc.cadded+1165−0View file
fs/xfs/xfs_zone_info.cadded+105−0View file
fs/xfs/xfs_zone_priv.hadded+119−0View file
fs/xfs/xfs_zone_space_resv.cadded+263−0View file

Only the first 600 diff lines are shown. Download the complete patch.

fs/xfs/Makefile

View file
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 7afa51e..5bf501c 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -64,6 +64,7 @@ xfs-y += $(addprefix libxfs/, \
xfs-$(CONFIG_XFS_RT) += $(addprefix libxfs/, \
xfs_rtbitmap.o \
xfs_rtgroup.o \
+ xfs_zones.o \
)
# highlevel code
@@ -136,7 +137,11 @@ xfs-$(CONFIG_XFS_QUOTA) += xfs_dquot.o \
xfs_quotaops.o
# xfs_rtbitmap is shared with libxfs
-xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o
+xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o \
+ xfs_zone_alloc.o \
+ xfs_zone_gc.o \
+ xfs_zone_info.o \
+ xfs_zone_space_resv.o
xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o
xfs-$(CONFIG_SYSCTL) += xfs_sysctl.o

fs/xfs/libxfs/xfs_ag.c

View file
diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c
index b59cb46..e6ba914 100644
--- a/fs/xfs/libxfs/xfs_ag.c
+++ b/fs/xfs/libxfs/xfs_ag.c
@@ -301,7 +301,7 @@ xfs_get_aghdr_buf(
struct xfs_buf *bp;
int error;
- error = xfs_buf_get_uncached(mp->m_ddev_targp, numblks, 0, &bp);
+ error = xfs_buf_get_uncached(mp->m_ddev_targp, numblks, &bp);
if (error)
return error;

fs/xfs/libxfs/xfs_bmap.c

View file
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 0ef19f1..6325582 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -34,13 +34,13 @@
#include "xfs_ag.h"
#include "xfs_ag_resv.h"
#include "xfs_refcount.h"
-#include "xfs_icache.h"
#include "xfs_iomap.h"
#include "xfs_health.h"
#include "xfs_bmap_item.h"
#include "xfs_symlink_remote.h"
#include "xfs_inode_util.h"
#include "xfs_rtgroup.h"
+#include "xfs_zone_alloc.h"
struct kmem_cache *xfs_bmap_intent_cache;
@@ -171,18 +171,16 @@ xfs_bmbt_update(
* Compute the worst-case number of indirect blocks that will be used
* for ip's delayed extent of length "len".
*/
-STATIC xfs_filblks_t
+xfs_filblks_t
xfs_bmap_worst_indlen(
- xfs_inode_t *ip, /* incore inode pointer */
- xfs_filblks_t len) /* delayed extent length */
+ struct xfs_inode *ip, /* incore inode pointer */
+ xfs_filblks_t len) /* delayed extent length */
{
- int level; /* btree level number */
- int maxrecs; /* maximum record count at this level */
- xfs_mount_t *mp; /* mount structure */
- xfs_filblks_t rval; /* return value */
+ struct xfs_mount *mp = ip->i_mount;
+ int maxrecs = mp->m_bmap_dmxr[0];
+ int level;
+ xfs_filblks_t rval;
- mp = ip->i_mount;
- maxrecs = mp->m_bmap_dmxr[0];
for (level = 0, rval = 0;
level < XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK);
level++) {
@@ -2572,146 +2570,6 @@ done:
}
/*
- * Convert a hole to a delayed allocation.
- */
-STATIC void
-xfs_bmap_add_extent_hole_delay(
- xfs_inode_t *ip, /* incore inode pointer */
- int whichfork,
- struct xfs_iext_cursor *icur,
- xfs_bmbt_irec_t *new) /* new data to add to file extents */
-{
- struct xfs_ifork *ifp; /* inode fork pointer */
- xfs_bmbt_irec_t left; /* left neighbor extent entry */
- xfs_filblks_t newlen=0; /* new indirect size */
- xfs_filblks_t oldlen=0; /* old indirect size */
- xfs_bmbt_irec_t right; /* right neighbor extent entry */
- uint32_t state = xfs_bmap_fork_to_state(whichfork);
- xfs_filblks_t temp; /* temp for indirect calculations */
-
- ifp = xfs_ifork_ptr(ip, whichfork);
- ASSERT(isnullstartblock(new->br_startblock));
-
- /*
- * Check and set flags if this segment has a left neighbor
- */
- if (xfs_iext_peek_prev_extent(ifp, icur, &left)) {
- state |= BMAP_LEFT_VALID;
- if (isnullstartblock(left.br_startblock))
- state |= BMAP_LEFT_DELAY;
- }
-
- /*
- * Check and set flags if the current (right) segment exists.
- * If it doesn't exist, we're converting the hole at end-of-file.
- */
- if (xfs_iext_get_extent(ifp, icur, &right)) {
- state |= BMAP_RIGHT_VALID;
- if (isnullstartblock(right.br_startblock))
- state |= BMAP_RIGHT_DELAY;
- }
-
- /*
- * Set contiguity flags on the left and right neighbors.
- * Don't let extents get too large, even if the pieces are contiguous.
- */
- if ((state & BMAP_LEFT_VALID) && (state & BMAP_LEFT_DELAY) &&
- left.br_startoff + left.br_blockcount == new->br_startoff &&
- left.br_blockcount + new->br_blockcount <= XFS_MAX_BMBT_EXTLEN)
- state |= BMAP_LEFT_CONTIG;
-
- if ((state & BMAP_RIGHT_VALID) && (state & BMAP_RIGHT_DELAY) &&
- new->br_startoff + new->br_blockcount == right.br_startoff &&
- new->br_blockcount + right.br_blockcount <= XFS_MAX_BMBT_EXTLEN &&
- (!(state & BMAP_LEFT_CONTIG) ||
- (left.br_blockcount + new->br_blockcount +
- right.br_blockcount <= XFS_MAX_BMBT_EXTLEN)))
- state |= BMAP_RIGHT_CONTIG;
-
- /*
- * Switch out based on the contiguity flags.
- */
- switch (state & (BMAP_LEFT_CONTIG | BMAP_RIGHT_CONTIG)) {
- case BMAP_LEFT_CONTIG | BMAP_RIGHT_CONTIG:
- /*
- * New allocation is contiguous with delayed allocations
- * on the left and on the right.
- * Merge all three into a single extent record.
- */
- temp = left.br_blockcount + new->br_blockcount +
- right.br_blockcount;
-
- oldlen = startblockval(left.br_startblock) +
- startblockval(new->br_startblock) +
- startblockval(right.br_startblock);
- newlen = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
- oldlen);
- left.br_startblock = nullstartblock(newlen);
- left.br_blockcount = temp;
-
- xfs_iext_remove(ip, icur, state);
- xfs_iext_prev(ifp, icur);
- xfs_iext_update_extent(ip, state, icur, &left);
- break;
-
- case BMAP_LEFT_CONTIG:
- /*
- * New allocation is contiguous with a delayed allocation
- * on the left.
- * Merge the new allocation with the left neighbor.
- */
- temp = left.br_blockcount + new->br_blockcount;
-
- oldlen = startblockval(left.br_startblock) +
- startblockval(new->br_startblock);
- newlen = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
- oldlen);
- left.br_blockcount = temp;
- left.br_startblock = nullstartblock(newlen);
-
- xfs_iext_prev(ifp, icur);
- xfs_iext_update_extent(ip, state, icur, &left);
- break;
-
- case BMAP_RIGHT_CONTIG:
- /*
- * New allocation is contiguous with a delayed allocation
- * on the right.
- * Merge the new allocation with the right neighbor.
- */
- temp = new->br_blockcount + right.br_blockcount;
- oldlen = startblockval(new->br_startblock) +
- startblockval(right.br_startblock);
- newlen = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
- oldlen);
- right.br_startoff = new->br_startoff;
- right.br_startblock = nullstartblock(newlen);
- right.br_blockcount = temp;
- xfs_iext_update_extent(ip, state, icur, &right);
- break;
-
- case 0:
- /*
- * New allocation is not contiguous with another
- * delayed allocation.
- * Insert a new entry.
- */
- oldlen = newlen = 0;
- xfs_iext_insert(ip, icur, new, state);
- break;
- }
- if (oldlen != newlen) {
- ASSERT(oldlen > newlen);
- xfs_add_fdblocks(ip->i_mount, oldlen - newlen);
-
- /*
- * Nothing to do for disk quota accounting here.
- */
- xfs_mod_delalloc(ip, 0, (int64_t)newlen - oldlen);
- }
-}
-
-/*
* Convert a hole to a real allocation.
*/
STATIC int /* error */
@@ -4039,144 +3897,6 @@ xfs_bmapi_read(
return 0;
}
-/*
- * Add a delayed allocation extent to an inode. Blocks are reserved from the
- * global pool and the extent inserted into the inode in-core extent tree.
- *
- * On entry, got refers to the first extent beyond the offset of the extent to
- * allocate or eof is specified if no such extent exists. On return, got refers
- * to the extent record that was inserted to the inode fork.
- *
- * Note that the allocated extent may have been merged with contiguous extents
- * during insertion into the inode fork. Thus, got does not reflect the current
- * state of the inode fork on return. If necessary, the caller can use lastx to
- * look up the updated record in the inode fork.
- */
-int
-xfs_bmapi_reserve_delalloc(
- struct xfs_inode *ip,
- int whichfork,
- xfs_fileoff_t off,
- xfs_filblks_t len,
- xfs_filblks_t prealloc,
- struct xfs_bmbt_irec *got,
- struct xfs_iext_cursor *icur,
- int eof)
-{
- struct xfs_mount *mp = ip->i_mount;
- struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork);
- xfs_extlen_t alen;
- xfs_extlen_t indlen;
- uint64_t fdblocks;
- int error;
- xfs_fileoff_t aoff;
- bool use_cowextszhint =
- whichfork == XFS_COW_FORK && !prealloc;
-
-retry:
- /*
- * Cap the alloc length. Keep track of prealloc so we know whether to
- * tag the inode before we return.
- */
- aoff = off;
- alen = XFS_FILBLKS_MIN(len + prealloc, XFS_MAX_BMBT_EXTLEN);
- if (!eof)
- alen = XFS_FILBLKS_MIN(alen, got->br_startoff - aoff);
- if (prealloc && alen >= len)
- prealloc = alen - len;
-
- /*
- * If we're targetting the COW fork but aren't creating a speculative
- * posteof preallocation, try to expand the reservation to align with
- * the COW extent size hint if there's sufficient free space.
- *
- * Unlike the data fork, the CoW cancellation functions will free all
- * the reservations at inactivation, so we don't require that every
- * delalloc reservation have a dirty pagecache.
- */
- if (use_cowextszhint) {
- struct xfs_bmbt_irec prev;
- xfs_extlen_t extsz = xfs_get_cowextsz_hint(ip);
-
- if (!xfs_iext_peek_prev_extent(ifp, icur, &prev))
- prev.br_startoff = NULLFILEOFF;
-
- error = xfs_bmap_extsize_align(mp, got, &prev, extsz, 0, eof,
- 1, 0, &aoff, &alen);
- ASSERT(!error);
- }
-
- /*
- * Make a transaction-less quota reservation for delayed allocation
- * blocks. This number gets adjusted later. We return if we haven't
- * allocated blocks already inside this loop.
- */
- error = xfs_quota_reserve_blkres(ip, alen);
- if (error)
- goto out;
-
- /*
- * Split changing sb for alen and indlen since they could be coming
- * from different places.
- */
- indlen = (xfs_extlen_t)xfs_bmap_worst_indlen(ip, alen);
- ASSERT(indlen > 0);
-
- fdblocks = indlen;
- if (XFS_IS_REALTIME_INODE(ip)) {
- error = xfs_dec_frextents(mp, xfs_blen_to_rtbxlen(mp, alen));
- if (error)
- goto out_unreserve_quota;
- } else {
- fdblocks += alen;
- }
-
- error = xfs_dec_fdblocks(mp, fdblocks, false);
- if (error)
- goto out_unreserve_frextents;
-
- ip->i_delayed_blks += alen;
- xfs_mod_delalloc(ip, alen, indlen);
-
- got->br_startoff = aoff;
- got->br_startblock = nullstartblock(indlen);
- got->br_blockcount = alen;
- got->br_state = XFS_EXT_NORM;
-
- xfs_bmap_add_extent_hole_delay(ip, whichfork, icur, got);
-
- /*
- * Tag the inode if blocks were preallocated. Note that COW fork
- * preallocation can occur at the start or end of the extent, even when
- * prealloc == 0, so we must also check the aligned offset and length.
- */
- if (whichfork == XFS_DATA_FORK && prealloc)
- xfs_inode_set_eofblocks_tag(ip);
- if (whichfork == XFS_COW_FORK && (prealloc || aoff < off || alen > len))
- xfs_inode_set_cowblocks_tag(ip);
-
- return 0;
-
-out_unreserve_frextents:
- if (XFS_IS_REALTIME_INODE(ip))
- xfs_add_frextents(mp, xfs_blen_to_rtbxlen(mp, alen));
-out_unreserve_quota:
- if (XFS_IS_QUOTA_ON(mp))
- xfs_quota_unreserve_blkres(ip, alen);
-out:
- if (error == -ENOSPC || error == -EDQUOT) {
- trace_xfs_delalloc_enospc(ip, off, len);
-
- if (prealloc || use_cowextszhint) {
- /* retry without any preallocation */
- use_cowextszhint = false;
- prealloc = 0;
- goto retry;
- }
- }
- return error;
-}
-
static int
xfs_bmapi_allocate(
struct xfs_bmalloca *bma)
@@ -4948,7 +4668,8 @@ xfs_bmap_del_extent_delay(
int whichfork,
struct xfs_iext_cursor *icur,
struct xfs_bmbt_irec *got,
- struct xfs_bmbt_irec *del)
+ struct xfs_bmbt_irec *del,
+ uint32_t bflags) /* bmapi flags */
{
struct xfs_mount *mp = ip->i_mount;
struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork);
@@ -5068,10 +4789,18 @@ xfs_bmap_del_extent_delay(
da_diff = da_old - da_new;
fdblocks = da_diff;
- if (isrt)
- xfs_add_frextents(mp, xfs_blen_to_rtbxlen(mp, del->br_blockcount));
- else
+ if (bflags & XFS_BMAPI_REMAP) {
+ ;
+ } else if (isrt) {
+ xfs_rtbxlen_t rtxlen;
+
+ rtxlen = xfs_blen_to_rtbxlen(mp, del->br_blockcount);
+ if (xfs_is_zoned_inode(ip))
+ xfs_zoned_add_available(mp, rtxlen);
+ xfs_add_frextents(mp, rtxlen);
+ } else {
fdblocks += del->br_blockcount;
+ }
xfs_add_fdblocks(mp, fdblocks);
xfs_mod_delalloc(ip, -(int64_t)del->br_blockcount, -da_diff);
@@ -5670,7 +5399,8 @@ __xfs_bunmapi(
delete:
if (wasdel) {
- xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, &del);
+ xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got,
+ &del, flags);
} else {
error = xfs_bmap_del_extent_real(ip, tp, &icur, cur,
&del, &tmp_logflags, whichfork,

fs/xfs/libxfs/xfs_bmap.h

View file
diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
index 4b721d9..b4d9c6e 100644
--- a/fs/xfs/libxfs/xfs_bmap.h
+++ b/fs/xfs/libxfs/xfs_bmap.h
@@ -204,7 +204,7 @@ int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
xfs_extnum_t nexts, int *done);
void xfs_bmap_del_extent_delay(struct xfs_inode *ip, int whichfork,
struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got,
- struct xfs_bmbt_irec *del);
+ struct xfs_bmbt_irec *del, uint32_t bflags);
void xfs_bmap_del_extent_cow(struct xfs_inode *ip,
struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got,
struct xfs_bmbt_irec *del);
@@ -219,10 +219,6 @@ int xfs_bmap_insert_extents(struct xfs_trans *tp, struct xfs_inode *ip,
bool *done, xfs_fileoff_t stop_fsb);
int xfs_bmap_split_extent(struct xfs_trans *tp, struct xfs_inode *ip,
xfs_fileoff_t split_offset);
-int xfs_bmapi_reserve_delalloc(struct xfs_inode *ip, int whichfork,
- xfs_fileoff_t off, xfs_filblks_t len, xfs_filblks_t prealloc,
- struct xfs_bmbt_irec *got, struct xfs_iext_cursor *cur,
- int eof);
int xfs_bmapi_convert_delalloc(struct xfs_inode *ip, int whichfork,
xfs_off_t offset, struct iomap *iomap, unsigned int *seq);
int xfs_bmap_add_extent_unwritten_real(struct xfs_trans *tp,
@@ -233,6 +229,7 @@ xfs_extlen_t xfs_bmapi_minleft(struct xfs_trans *tp, struct xfs_inode *ip,
int fork);
int xfs_bmap_btalloc_low_space(struct xfs_bmalloca *ap,
struct xfs_alloc_arg *args);
+xfs_filblks_t xfs_bmap_worst_indlen(struct xfs_inode *ip, xfs_filblks_t len);
enum xfs_bmap_intent_type {
XFS_BMAP_MAP = 1,

fs/xfs/libxfs/xfs_format.h

View file
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index b1007fb..9566a76 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -178,9 +178,10 @@ typedef struct xfs_sb {
xfs_rgnumber_t sb_rgcount; /* number of realtime groups */
xfs_rtxlen_t sb_rgextents; /* size of a realtime group in rtx */
-
uint8_t sb_rgblklog; /* rt group number shift */
uint8_t sb_pad[7]; /* zeroes */
+ xfs_rfsblock_t sb_rtstart; /* start of internal RT section (FSB) */
+ xfs_filblks_t sb_rtreserved; /* reserved (zoned) RT blocks */
/* must be padded to 64 bit alignment */
} xfs_sb_t;
@@ -270,9 +271,10 @@ struct xfs_dsb {
__be64 sb_metadirino; /* metadata directory tree root */
__be32 sb_rgcount; /* # of realtime groups */
__be32 sb_rgextents; /* size of rtgroup in rtx */
-
__u8 sb_rgblklog; /* rt group number shift */
__u8 sb_pad[7]; /* zeroes */
+ __be64 sb_rtstart; /* start of internal RT section (FSB) */
+ __be64 sb_rtreserved; /* reserved (zoned) RT blocks */
/*
* The size of this structure must be padded to 64 bit alignment.
@@ -395,6 +397,9 @@ xfs_sb_has_ro_compat_feature(
#define XFS_SB_FEAT_INCOMPAT_EXCHRANGE (1 << 6) /* exchangerange supported */
#define XFS_SB_FEAT_INCOMPAT_PARENT (1 << 7) /* parent pointers */
#define XFS_SB_FEAT_INCOMPAT_METADIR (1 << 8) /* metadata dir tree */
+#define XFS_SB_FEAT_INCOMPAT_ZONED (1 << 9) /* zoned RT allocator */
+#define XFS_SB_FEAT_INCOMPAT_ZONE_GAPS (1 << 10) /* RTGs have LBA gaps */
+
#define XFS_SB_FEAT_INCOMPAT_ALL \
(XFS_SB_FEAT_INCOMPAT_FTYPE | \
XFS_SB_FEAT_INCOMPAT_SPINODES | \
@@ -404,7 +409,9 @@ xfs_sb_has_ro_compat_feature(
XFS_SB_FEAT_INCOMPAT_NREXT64 | \
XFS_SB_FEAT_INCOMPAT_EXCHRANGE | \
XFS_SB_FEAT_INCOMPAT_PARENT | \
- XFS_SB_FEAT_INCOMPAT_METADIR)
+ XFS_SB_FEAT_INCOMPAT_METADIR | \
+ XFS_SB_FEAT_INCOMPAT_ZONED | \
+ XFS_SB_FEAT_INCOMPAT_ZONE_GAPS)
#define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALL
static inline bool
@@ -952,7 +959,12 @@ struct xfs_dinode {
__be64 di_changecount; /* number of attribute changes */
__be64 di_lsn; /* flush sequence */
__be64 di_flags2; /* more random flags */
- __be32 di_cowextsize; /* basic cow extent size for file */
+ union {
+ /* basic cow extent size for (regular) file */
+ __be32 di_cowextsize;
+ /* used blocks in RTG for (zoned) rtrmap inode */
+ __be32 di_used_blocks;
+ };
__u8 di_pad2[12]; /* more padding for future expansion */
/* fields only written to during inode creation */

fs/xfs/libxfs/xfs_fs.h

View file
diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
index 2c31712..12463ba 100644
--- a/fs/xfs/libxfs/xfs_fs.h
+++ b/fs/xfs/libxfs/xfs_fs.h
@@ -189,7 +189,9 @@ struct xfs_fsop_geom {
uint32_t checked; /* o: checked fs & rt metadata */
__u32 rgextents; /* rt extents in a realtime group */
__u32 rgcount; /* number of realtime groups */
- __u64 reserved[16]; /* reserved space */
+ __u64 rtstart; /* start of internal rt section */
+ __u64 rtreserved; /* RT (zoned) reserved blocks */
+ __u64 reserved[14]; /* reserved space */
};
#define XFS_FSOP_GEOM_SICK_COUNTERS (1 << 0) /* summary counters */
@@ -247,6 +249,7 @@ typedef struct xfs_fsop_resblks {
#define XFS_FSOP_GEOM_FLAGS_EXCHANGE_RANGE (1 << 24) /* exchange range */
#define XFS_FSOP_GEOM_FLAGS_PARENT (1 << 25) /* linux parent pointers */
#define XFS_FSOP_GEOM_FLAGS_METADIR (1 << 26) /* metadata directories */
+#define XFS_FSOP_GEOM_FLAGS_ZONED (1 << 27) /* zoned rt device */
/*
* Minimum and maximum sizes need for growth checks.
@@ -1079,6 +1082,15 @@ struct xfs_rtgroup_geometry {
#define XFS_IOC_COMMIT_RANGE _IOW ('X', 131, struct xfs_commit_range)
/* XFS_IOC_GETFSUUID ---------- deprecated 140 */
+/*
+ * Devices supported by a single XFS file system. Reported in fsmaps fmr_device
+ * when using internal RT devices.
+ */
+enum xfs_device {
+ XFS_DEV_DATA = 1,
+ XFS_DEV_LOG = 2,
+ XFS_DEV_RT = 3,
+};
#ifndef HAVE_BBMACROS
/*

fs/xfs/libxfs/xfs_group.h

View file
diff --git a/fs/xfs/libxfs/xfs_group.h b/fs/xfs/libxfs/xfs_group.h
index 242b056..4423932 100644
--- a/fs/xfs/libxfs/xfs_group.h
+++ b/fs/xfs/libxfs/xfs_group.h
@@ -19,10 +19,23 @@ struct xfs_group {
#ifdef __KERNEL__
/* -- kernel only structures below this line -- */
- /*
- * Track freed but not yet committed extents.
- */
- struct xfs_extent_busy_tree *xg_busy_extents;
+ union {
+ /*
+ * For perags and non-zoned RT groups:
+ * Track freed but not yet committed extents.
+ */
+ struct xfs_extent_busy_tree *xg_busy_extents;
+
+ /*
+ * For zoned RT groups:
+ * List of groups that need a zone reset.
+ *
+ * The zonegc code forces a log flush of the rtrmap inode before
+ * resetting the write pointer, so there is no need for
+ * individual busy extent tracking.
+ */
+ struct xfs_group *xg_next_reset;
+ };
/*
* Bitsets of per-ag metadata that have been checked and/or are sick.
@@ -107,9 +120,15 @@ xfs_gbno_to_daddr(
xfs_agblock_t gbno)
{
struct xfs_mount *mp = xg->xg_mount;
- uint32_t blocks = mp->m_groups[xg->xg_type].blocks;
+ struct xfs_groups *g = &mp->m_groups[xg->xg_type];
+ xfs_fsblock_t fsbno;
+
+ if (g->has_daddr_gaps)
+ fsbno = xfs_gbno_to_fsb(xg, gbno);
+ else
+ fsbno = (xfs_fsblock_t)xg->xg_gno * g->blocks + gbno;
- return XFS_FSB_TO_BB(mp, (xfs_fsblock_t)xg->xg_gno * blocks + gbno);
+ return XFS_FSB_TO_BB(mp, g->start_fsb + fsbno);
}

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_ialloc.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_inode_buf.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_inode_util.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_log_format.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_metafile.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_metafile.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_ondisk.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_rtbitmap.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_rtgroup.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_rtgroup.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_rtrmap_btree.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_rtrmap_btree.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_sb.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_types.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_zones.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/libxfs/xfs_zones.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/agheader.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/bmap.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/fscounters.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/fscounters_repair.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/inode_repair.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/newbt.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/reap.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/repair.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/rtbitmap.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/rtrefcount_repair.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/rtrmap_repair.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/scrub/scrub.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_aops.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_aops.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_bmap_util.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_bmap_util.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_buf.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_buf.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_buf_item.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_buf_item_recover.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_buf_mem.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_buf_mem.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_discard.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_extent_busy.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_extfree_item.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_file.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_fsmap.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_fsops.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_fsops.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_icache.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_inode.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_inode.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_inode_item.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_inode_item_recover.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_ioctl.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_iomap.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_iomap.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_iops.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_log.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_message.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_message.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_mount.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_mount.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_qm.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_reflink.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_rtalloc.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_rtalloc.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_super.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_sysfs.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_sysfs.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_trace.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_trace.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_zone_alloc.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_zone_alloc.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_zone_gc.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_zone_info.c

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_zone_priv.h

View file

This diff is incomplete. Download the complete patch.

fs/xfs/xfs_zone_space_resv.c

View file

This diff is incomplete. Download the complete patch.