Skip to content

Commit 5631c5e

Browse files
committed
Merge tag 'xfs-5.9-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs updates from Darrick Wong: "There are quite a few changes in this release, the most notable of which is that we've made inode flushing fully asynchronous, and we no longer block memory reclaim on this. Furthermore, we have fixed a long-standing bug in the quota code where soft limit warnings and inode limits were never tracked properly. Moving further down the line, the reflink control loops have been redesigned to behave more efficiently; and numerous small bugs have been fixed (see below). The xattr and quota code have been extensively refactored in preparation for more new features coming down the line. Finally, the behavior of DAX between ext4 and xfs has been stabilized, which gets us a step closer to removing the experimental tag from that feature. We have a few new contributors this time around. Welcome, all! I anticipate a second pull request next week for a few small bugfixes that have been trickling in, but this is it for big changes. Summary: - Fix some btree block pingponging problems when swapping extents - Redesign the reflink copy loop so that we only run one remapping operation per transaction. This helps us avoid running out of block reservation on highly deduped filesystems. - Take the MMAPLOCK around filemap_map_pages. - Make inode reclaim fully async so that we avoid stalling processes on flushing inodes to disk. - Reduce inode cluster buffer RMW cycles by attaching the buffer to dirty inodes so we won't let go of the cluster buffer when we know we're going to need it soon. - Add some more checks to the realtime bitmap file scrubber. - Don't trip false lockdep warnings in fs freeze. - Remove various redundant lines of code. - Remove unnecessary calls to xfs_perag_{get,put}. - Preserve I_VERSION state across remounts. - Fix an unmount hang due to AIL going to sleep with a non-empty delwri buffer list. - Fix an error in the inode allocation space reservation macro that caused regressions in generic/531. - Fix a potential livelock when dquot flush fails because the dquot buffer is locked. - Fix a miscalculation when reserving inode quota that could cause users to exceed a hardlimit. - Refactor struct xfs_dquot to use native types for incore fields instead of abusing the ondisk struct for this purpose. This will eventually enable proper y2038+ support, but for now it merely cleans up the quota function declarations. - Actually increment the quota softlimit warning counter so that soft failures turn into hard(er) failures when they exceed the softlimit warning counter limits set by the administrator. - Split incore dquot state flags into their own field and namespace, to avoid mixing them with quota type flags. - Create a new quota type flags namespace so that we can make it obvious when a quota function takes a quota type (user, group, project) as an argument. - Rename the ondisk dquot flags field to type, as that more accurately represents what we store in it. - Drop our bespoke memory allocation flags in favor of GFP_*. - Rearrange the xattr functions so that we no longer mix metadata updates and transaction management (e.g. rolling complex transactions) in the same functions. This work will prepare us for atomic xattr operations (itself a prerequisite for directory backrefs) in future release cycles. - Support FS_DAX_FL (aka FS_XFLAG_DAX) via GETFLAGS/SETFLAGS" * tag 'xfs-5.9-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (117 commits) fs/xfs: Support that ioctl(SETXFLAGS/GETXFLAGS) can set/get inode DAX on XFS. xfs: Lift -ENOSPC handler from xfs_attr_leaf_addname xfs: Simplify xfs_attr_node_addname xfs: Simplify xfs_attr_leaf_addname xfs: Add helper function xfs_attr_node_removename_rmt xfs: Add helper function xfs_attr_node_removename_setup xfs: Add remote block helper functions xfs: Add helper function xfs_attr_leaf_mark_incomplete xfs: Add helpers xfs_attr_is_shortform and xfs_attr_set_shortform xfs: Remove xfs_trans_roll in xfs_attr_node_removename xfs: Remove unneeded xfs_trans_roll_inode calls xfs: Add helper function xfs_attr_node_shrink xfs: Pull up xfs_attr_rmtval_invalidate xfs: Refactor xfs_attr_rmtval_remove xfs: Pull up trans roll in xfs_attr3_leaf_clearflag xfs: Factor out xfs_attr_rmtval_invalidate xfs: Pull up trans roll from xfs_attr3_leaf_setflag xfs: Refactor xfs_attr_try_sf_addname xfs: Split apart xfs_attr_leaf_addname xfs: Pull up trans handling in xfs_attr3_leaf_flipflags ...
2 parents e514181 + 818d5a9 commit 5631c5e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+3250
-2929
lines changed

fs/xfs/kmem.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,3 @@ kmem_realloc(const void *old, size_t newsize, xfs_km_flags_t flags)
115115
congestion_wait(BLK_RW_ASYNC, HZ/50);
116116
} while (1);
117117
}
118-
119-
void *
120-
kmem_zone_alloc(kmem_zone_t *zone, xfs_km_flags_t flags)
121-
{
122-
int retries = 0;
123-
gfp_t lflags = kmem_flags_convert(flags);
124-
void *ptr;
125-
126-
trace_kmem_zone_alloc(kmem_cache_size(zone), flags, _RET_IP_);
127-
do {
128-
ptr = kmem_cache_alloc(zone, lflags);
129-
if (ptr || (flags & KM_MAYFAIL))
130-
return ptr;
131-
if (!(++retries % 100))
132-
xfs_err(NULL,
133-
"%s(%u) possible memory allocation deadlock in %s (mode:0x%x)",
134-
current->comm, current->pid,
135-
__func__, lflags);
136-
congestion_wait(BLK_RW_ASYNC, HZ/50);
137-
} while (1);
138-
}

fs/xfs/kmem.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,6 @@ kmem_zalloc_large(size_t size, xfs_km_flags_t flags)
8585
#define kmem_zone kmem_cache
8686
#define kmem_zone_t struct kmem_cache
8787

88-
extern void *kmem_zone_alloc(kmem_zone_t *, xfs_km_flags_t);
89-
90-
static inline void *
91-
kmem_zone_zalloc(kmem_zone_t *zone, xfs_km_flags_t flags)
92-
{
93-
return kmem_zone_alloc(zone, flags | KM_ZERO);
94-
}
95-
9688
static inline struct page *
9789
kmem_to_page(void *addr)
9890
{

fs/xfs/libxfs/xfs_ag.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ xfs_ag_get_geometry(
563563
error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agf_bp);
564564
if (error)
565565
goto out_agi;
566-
pag = xfs_perag_get(mp, agno);
566+
567+
pag = agi_bp->b_pag;
567568

568569
/* Fill out form. */
569570
memset(ageo, 0, sizeof(*ageo));
@@ -583,7 +584,6 @@ xfs_ag_get_geometry(
583584
xfs_ag_geom_health(pag, ageo);
584585

585586
/* Release resources. */
586-
xfs_perag_put(pag);
587587
xfs_buf_relse(agf_bp);
588588
out_agi:
589589
xfs_buf_relse(agi_bp);

fs/xfs/libxfs/xfs_ag_resv.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,4 @@ xfs_ag_resv_rmapbt_alloc(
3737
xfs_perag_put(pag);
3838
}
3939

40-
static inline void
41-
xfs_ag_resv_rmapbt_free(
42-
struct xfs_mount *mp,
43-
xfs_agnumber_t agno)
44-
{
45-
struct xfs_perag *pag;
46-
47-
pag = xfs_perag_get(mp, agno);
48-
xfs_ag_resv_free_extent(pag, XFS_AG_RESV_RMAPBT, NULL, 1);
49-
xfs_perag_put(pag);
50-
}
51-
5240
#endif /* __XFS_AG_RESV_H__ */

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -710,13 +710,12 @@ xfs_alloc_read_agfl(
710710
STATIC int
711711
xfs_alloc_update_counters(
712712
struct xfs_trans *tp,
713-
struct xfs_perag *pag,
714713
struct xfs_buf *agbp,
715714
long len)
716715
{
717716
struct xfs_agf *agf = agbp->b_addr;
718717

719-
pag->pagf_freeblks += len;
718+
agbp->b_pag->pagf_freeblks += len;
720719
be32_add_cpu(&agf->agf_freeblks, len);
721720

722721
xfs_trans_agblocks_delta(tp, len);
@@ -1175,8 +1174,7 @@ xfs_alloc_ag_vextent(
11751174
}
11761175

11771176
if (!args->wasfromfl) {
1178-
error = xfs_alloc_update_counters(args->tp, args->pag,
1179-
args->agbp,
1177+
error = xfs_alloc_update_counters(args->tp, args->agbp,
11801178
-((long)(args->len)));
11811179
if (error)
11821180
return error;
@@ -1887,7 +1885,6 @@ xfs_free_ag_extent(
18871885
enum xfs_ag_resv_type type)
18881886
{
18891887
struct xfs_mount *mp;
1890-
struct xfs_perag *pag;
18911888
struct xfs_btree_cur *bno_cur;
18921889
struct xfs_btree_cur *cnt_cur;
18931890
xfs_agblock_t gtbno; /* start of right neighbor */
@@ -2167,10 +2164,8 @@ xfs_free_ag_extent(
21672164
/*
21682165
* Update the freespace totals in the ag and superblock.
21692166
*/
2170-
pag = xfs_perag_get(mp, agno);
2171-
error = xfs_alloc_update_counters(tp, pag, agbp, len);
2172-
xfs_ag_resv_free_extent(pag, type, tp, len);
2173-
xfs_perag_put(pag);
2167+
error = xfs_alloc_update_counters(tp, agbp, len);
2168+
xfs_ag_resv_free_extent(agbp->b_pag, type, tp, len);
21742169
if (error)
21752170
goto error0;
21762171

@@ -2467,7 +2462,8 @@ xfs_defer_agfl_block(
24672462
ASSERT(xfs_bmap_free_item_zone != NULL);
24682463
ASSERT(oinfo != NULL);
24692464

2470-
new = kmem_zone_alloc(xfs_bmap_free_item_zone, 0);
2465+
new = kmem_cache_alloc(xfs_bmap_free_item_zone,
2466+
GFP_KERNEL | __GFP_NOFAIL);
24712467
new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno);
24722468
new->xefi_blockcount = 1;
24732469
new->xefi_oinfo = *oinfo;
@@ -2689,7 +2685,7 @@ xfs_alloc_get_freelist(
26892685
if (be32_to_cpu(agf->agf_flfirst) == xfs_agfl_size(mp))
26902686
agf->agf_flfirst = 0;
26912687

2692-
pag = xfs_perag_get(mp, be32_to_cpu(agf->agf_seqno));
2688+
pag = agbp->b_pag;
26932689
ASSERT(!pag->pagf_agflreset);
26942690
be32_add_cpu(&agf->agf_flcount, -1);
26952691
xfs_trans_agflist_delta(tp, -1);
@@ -2701,7 +2697,6 @@ xfs_alloc_get_freelist(
27012697
pag->pagf_btreeblks++;
27022698
logflags |= XFS_AGF_BTREEBLKS;
27032699
}
2704-
xfs_perag_put(pag);
27052700

27062701
xfs_alloc_log_agf(tp, agbp, logflags);
27072702
*bnop = bno;
@@ -2797,7 +2792,7 @@ xfs_alloc_put_freelist(
27972792
if (be32_to_cpu(agf->agf_fllast) == xfs_agfl_size(mp))
27982793
agf->agf_fllast = 0;
27992794

2800-
pag = xfs_perag_get(mp, be32_to_cpu(agf->agf_seqno));
2795+
pag = agbp->b_pag;
28012796
ASSERT(!pag->pagf_agflreset);
28022797
be32_add_cpu(&agf->agf_flcount, 1);
28032798
xfs_trans_agflist_delta(tp, 1);
@@ -2809,7 +2804,6 @@ xfs_alloc_put_freelist(
28092804
pag->pagf_btreeblks--;
28102805
logflags |= XFS_AGF_BTREEBLKS;
28112806
}
2812-
xfs_perag_put(pag);
28132807

28142808
xfs_alloc_log_agf(tp, agbp, logflags);
28152809

@@ -3006,7 +3000,7 @@ xfs_alloc_read_agf(
30063000
ASSERT(!(*bpp)->b_error);
30073001

30083002
agf = (*bpp)->b_addr;
3009-
pag = xfs_perag_get(mp, agno);
3003+
pag = (*bpp)->b_pag;
30103004
if (!pag->pagf_init) {
30113005
pag->pagf_freeblks = be32_to_cpu(agf->agf_freeblks);
30123006
pag->pagf_btreeblks = be32_to_cpu(agf->agf_btreeblks);
@@ -3034,7 +3028,6 @@ xfs_alloc_read_agf(
30343028
be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]));
30353029
}
30363030
#endif
3037-
xfs_perag_put(pag);
30383031
return 0;
30393032
}
30403033

fs/xfs/libxfs/xfs_alloc_btree.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ xfs_allocbt_set_root(
3838
{
3939
struct xfs_buf *agbp = cur->bc_ag.agbp;
4040
struct xfs_agf *agf = agbp->b_addr;
41-
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
4241
int btnum = cur->bc_btnum;
43-
struct xfs_perag *pag = xfs_perag_get(cur->bc_mp, seqno);
42+
struct xfs_perag *pag = agbp->b_pag;
4443

4544
ASSERT(ptr->s != 0);
4645

4746
agf->agf_roots[btnum] = ptr->s;
4847
be32_add_cpu(&agf->agf_levels[btnum], inc);
4948
pag->pagf_levels[btnum] += inc;
50-
xfs_perag_put(pag);
5149

5250
xfs_alloc_log_agf(cur->bc_tp, agbp, XFS_AGF_ROOTS | XFS_AGF_LEVELS);
5351
}
@@ -115,7 +113,6 @@ xfs_allocbt_update_lastrec(
115113
int reason)
116114
{
117115
struct xfs_agf *agf = cur->bc_ag.agbp->b_addr;
118-
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
119116
struct xfs_perag *pag;
120117
__be32 len;
121118
int numrecs;
@@ -160,9 +157,8 @@ xfs_allocbt_update_lastrec(
160157
}
161158

162159
agf->agf_longest = len;
163-
pag = xfs_perag_get(cur->bc_mp, seqno);
160+
pag = cur->bc_ag.agbp->b_pag;
164161
pag->pagf_longest = be32_to_cpu(len);
165-
xfs_perag_put(pag);
166162
xfs_alloc_log_agf(cur->bc_tp, cur->bc_ag.agbp, XFS_AGF_LONGEST);
167163
}
168164

@@ -484,7 +480,7 @@ xfs_allocbt_init_common(
484480

485481
ASSERT(btnum == XFS_BTNUM_BNO || btnum == XFS_BTNUM_CNT);
486482

487-
cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_NOFS);
483+
cur = kmem_cache_zalloc(xfs_btree_cur_zone, GFP_NOFS | __GFP_NOFAIL);
488484

489485
cur->bc_tp = tp;
490486
cur->bc_mp = mp;

0 commit comments

Comments
 (0)