inode iterator cleanups
Hi all,
this series cleans up a bunch of lose ends in the inode iterator functions.
PATCH 1/6 xfs: remove xfs_inode_ag_iterator
This function is entirely unused.
--- fs/xfs/xfs_icache.c | 11 ----------- fs/xfs/xfs_icache.h | 5 +---- 2 files changed, 1 insertion(+), 15 deletions(-)
fs/xfs/xfs_icache.c +0 -11
@@ -979,17 +979,6 @@ xfs_inode_ag_iterator_flags(return last_error; } -int -xfs_inode_ag_iterator ( -struct xfs_mount *mp, -int (*execute)(struct xfs_inode *ip,int flags, -void *args), -int flags, -void *args) -{ -return xfs_inode_ag_iterator_flags (mp, execute, flags, args,0 ); -} - int xfs_inode_ag_iterator_tag( struct xfs_mount *mp,
fs/xfs/xfs_icache.h +1 -4
@@ -24,7 +24,7 @@ struct xfs_eofblocks {* tags for inode radix tree */ #define XFS_ICI_NO_TAG (-1)/* special flag for an untagged lookup -in xfs_inode_ag_iterator */ +in xfs_inode_ag_iterator* */ #define XFS_ICI_RECLAIM_TAG 0/* inode is to be reclaimed */ #define XFS_ICI_EOFBLOCKS_TAG 1/* inode has blocks beyond EOF */ #define XFS_ICI_COWBLOCKS_TAG 2/* inode can have cow blocks to gc */
@@ -71,9 +71,6 @@ int xfs_inode_free_quota_cowblocks(struct xfs_inode *ip);void xfs_cowblocks_worker (struct work_struct *);void xfs_queue_cowblocks (struct xfs_mount *); -int xfs_inode_ag_iterator (struct xfs_mount *mp, -int (*execute)(struct xfs_inode *ip,int flags,void *args), -int flags,void *args);int xfs_inode_ag_iterator_flags (struct xfs_mount *mp,int (*execute)(struct xfs_inode *ip,int flags,void *args),int flags,void *args,int iter_flags);
Signature · 1 line
2.26.2
PATCH 2/6 xfs: mark xfs_inode_ag_iterator_tag static
In reply to Christoph HellwigNo users outside of xfs_icache.c.
--- fs/xfs/xfs_icache.c | 2 +- fs/xfs/xfs_icache.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)
fs/xfs/xfs_icache.c +1 -1
@@ -979,7 +979,7 @@ xfs_inode_ag_iterator_flags(return last_error; } -int +static int xfs_inode_ag_iterator_tag( struct xfs_mount *mp, int (*execute)(struct xfs_inode *ip, int flags,
fs/xfs/xfs_icache.h +0 -3
@@ -74,9 +74,6 @@ void xfs_queue_cowblocks(struct xfs_mount *);int xfs_inode_ag_iterator_flags (struct xfs_mount *mp,int (*execute)(struct xfs_inode *ip,int flags,void *args),int flags,void *args,int iter_flags); -int xfs_inode_ag_iterator_tag (struct xfs_mount *mp, -int (*execute)(struct xfs_inode *ip,int flags,void *args), -int flags,void *args,int tag);static inline int xfs_fs_eofblocks_from_user(
Signature · 1 line
2.26.2
PATCH 3/6 xfs: remove __xfs_icache_free_eofblocks
In reply to Christoph HellwigJust open code the trivial logic in the two callers.
--- fs/xfs/xfs_icache.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-)
fs/xfs/xfs_icache.c +11 -20
@@ -1504,30 +1504,17 @@ xfs_inode_free_eofblocks(return ret; } -static int -__xfs_icache_free_eofblocks ( +int +xfs_icache_free_eofblocks (struct xfs_mount *mp, -struct xfs_eofblocks *eofb, -int (*execute)(struct xfs_inode *ip,int flags, -void *args), -int tag) +struct xfs_eofblocks *eofb) {int flags =SYNC_TRYLOCK ;if (eofb && (eofb->eof_flags &XFS_EOF_FLAGS_SYNC )) flags =SYNC_WAIT ; - -return xfs_inode_ag_iterator_tag (mp, execute, flags, - eofb, tag); -} - -int -xfs_icache_free_eofblocks ( -struct xfs_mount *mp, -struct xfs_eofblocks *eofb) -{ -return __xfs_icache_free_eofblocks (mp, eofb, xfs_inode_free_eofblocks, -XFS_ICI_EOFBLOCKS_TAG ); +return xfs_inode_ag_iterator_tag (mp, xfs_inode_free_eofblocks, flags, + eofb,XFS_ICI_EOFBLOCKS_TAG ); }/*
@@ -1789,8 +1776,12 @@ xfs_icache_free_cowblocks(struct xfs_mount *mp, struct xfs_eofblocks *eofb) { - return __xfs_icache_free_eofblocks(mp, eofb, xfs_inode_free_cowblocks, -XFS_ICI_COWBLOCKS_TAG ); + int flags = SYNC_TRYLOCK; + +if (eofb && (eofb->eof_flags &XFS_EOF_FLAGS_SYNC )) + flags =SYNC_WAIT ; +return xfs_inode_ag_iterator_tag (mp, xfs_inode_free_cowblocks, flags, + eofb,XFS_ICI_COWBLOCKS_TAG ); }int
Signature · 1 line
2.26.2
PATCH 4/6 xfs: merge xfs_inode_free_quota_{eof,cow}blocks
In reply to Christoph HellwigThese two are always called together.
--- fs/xfs/xfs_file.c | 5 +---- fs/xfs/xfs_icache.c | 28 +++++++--------------------- fs/xfs/xfs_icache.h | 3 +-- 3 files changed, 9 insertions(+), 27 deletions(-)
fs/xfs/xfs_file.c +1 -4
@@ -650,10 +650,7 @@ xfs_file_buffered_aio_write(*/ if (ret == -EDQUOT && !enospc) {xfs_iunlock (ip, iolock); - enospc =xfs_inode_free_quota_eofblocks (ip); -if (enospc) - goto write_retry; - enospc =xfs_inode_free_quota_cowblocks (ip); + enospc =xfs_inode_free_quota_blocks (ip);if (enospc) goto write_retry; iolock =0 ;
fs/xfs/xfs_icache.c +7 -21
@@ -1523,11 +1523,9 @@ xfs_icache_free_eofblocks(* failure. We make a best effort by including each quota under low free space * conditions (less than 1% free space) in the scan. */ -static int -__xfs_inode_free_quota_eofblocks ( -struct xfs_inode *ip, -int (*execute)(struct xfs_mount *mp, -struct xfs_eofblocks *eofb)) +int +xfs_inode_free_quota_blocks ( +struct xfs_inode *ip) {int scan =0 ;struct xfs_eofblocks eofb = {0 };
@@ -1557,19 +1555,14 @@ __xfs_inode_free_quota_eofblocks( } } -if (scan) -execute (ip->i_mount, &eofb); +if (scan) { +xfs_icache_free_eofblocks (ip->i_mount, &eofb); +xfs_icache_free_cowblocks (ip->i_mount, &eofb); + }return scan; } -int -xfs_inode_free_quota_eofblocks ( -struct xfs_inode *ip) -{ -return __xfs_inode_free_quota_eofblocks (ip, xfs_icache_free_eofblocks); -} -static inline unsigned long xfs_iflag_for_tag (int tag)
@@ -1784,13 +1777,6 @@ xfs_icache_free_cowblocks( eofb, XFS_ICI_COWBLOCKS_TAG); } -int -xfs_inode_free_quota_cowblocks ( -struct xfs_inode *ip) -{ -return __xfs_inode_free_quota_eofblocks (ip, xfs_icache_free_cowblocks); -} -void xfs_inode_set_cowblocks_tag (xfs_inode_t *ip)
fs/xfs/xfs_icache.h +1 -2
@@ -60,14 +60,13 @@ void xfs_inode_set_reclaim_tag(struct xfs_inode *ip);void xfs_inode_set_eofblocks_tag (struct xfs_inode *ip);void xfs_inode_clear_eofblocks_tag (struct xfs_inode *ip);int xfs_icache_free_eofblocks (struct xfs_mount *,struct xfs_eofblocks *); -int xfs_inode_free_quota_eofblocks (struct xfs_inode *ip); +int xfs_inode_free_quota_blocks (struct xfs_inode *ip);void xfs_eofblocks_worker (struct work_struct *);void xfs_queue_eofblocks (struct xfs_mount *);void xfs_inode_set_cowblocks_tag (struct xfs_inode *ip);void xfs_inode_clear_cowblocks_tag (struct xfs_inode *ip);int xfs_icache_free_cowblocks (struct xfs_mount *,struct xfs_eofblocks *); -int xfs_inode_free_quota_cowblocks (struct xfs_inode *ip);void xfs_cowblocks_worker (struct work_struct *);void xfs_queue_cowblocks (struct xfs_mount *);
Signature · 1 line
2.26.2
PATCH 5/6 xfs: add a flags argument to xfs_icache_free_cowblocks
In reply to Christoph HellwigPass the SYNC_* flags directly instead of hiding the information in the eofblocks structure.
--- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_icache.c | 11 ++++------- fs/xfs/xfs_icache.h | 3 ++- fs/xfs/xfs_super.c | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-)
fs/xfs/xfs_file.c +1 -1
@@ -663,7 +663,7 @@ xfs_file_buffered_aio_write(xfs_iunlock (ip, iolock); eofb.eof_flags =XFS_EOF_FLAGS_SYNC ;xfs_icache_free_eofblocks (ip->i_mount, &eofb); -xfs_icache_free_cowblocks (ip->i_mount, &eofb); +xfs_icache_free_cowblocks (ip->i_mount, &eofb,SYNC_WAIT ); goto write_retry; }
fs/xfs/xfs_icache.c +4 -7
@@ -944,7 +944,7 @@ xfs_cowblocks_worker(if (!sb_start_write_trylock (mp->m_super))return ; -xfs_icache_free_cowblocks (mp,NULL ); +xfs_icache_free_cowblocks (mp,NULL ,SYNC_TRYLOCK );sb_end_write (mp->m_super);xfs_queue_cowblocks (mp);
@@ -1557,7 +1557,7 @@ xfs_inode_free_quota_blocks(if (scan) {xfs_icache_free_eofblocks (ip->i_mount, &eofb); -xfs_icache_free_cowblocks (ip->i_mount, &eofb); +xfs_icache_free_cowblocks (ip->i_mount, &eofb,SYNC_WAIT ); }return scan;
@@ -1767,12 +1767,9 @@ xfs_inode_free_cowblocks(int xfs_icache_free_cowblocks (struct xfs_mount *mp, -struct xfs_eofblocks *eofb) +struct xfs_eofblocks *eofb, +int flags) { -int flags =SYNC_TRYLOCK ; - -if (eofb && (eofb->eof_flags &XFS_EOF_FLAGS_SYNC )) - flags =SYNC_WAIT ;return xfs_inode_ag_iterator_tag (mp, xfs_inode_free_cowblocks, flags, eofb,XFS_ICI_COWBLOCKS_TAG ); }
fs/xfs/xfs_icache.h +2 -1
@@ -66,7 +66,8 @@ void xfs_queue_eofblocks(struct xfs_mount *);void xfs_inode_set_cowblocks_tag (struct xfs_inode *ip);void xfs_inode_clear_cowblocks_tag (struct xfs_inode *ip); -int xfs_icache_free_cowblocks (struct xfs_mount *,struct xfs_eofblocks *); +int xfs_icache_free_cowblocks (struct xfs_mount *mp,struct xfs_eofblocks *eofb, +int flags);void xfs_cowblocks_worker (struct work_struct *);void xfs_queue_cowblocks (struct xfs_mount *);
fs/xfs/xfs_super.c +1 -1
@@ -1670,7 +1670,7 @@ xfs_remount_ro(xfs_stop_block_reaping (mp);/* Get rid of any leftover CoW reservations... */ - error =xfs_icache_free_cowblocks (mp,NULL ); + error =xfs_icache_free_cowblocks (mp,NULL ,SYNC_TRYLOCK );if (error) {xfs_force_shutdown (mp,SHUTDOWN_CORRUPT_INCORE );return error;
Signature · 1 line
2.26.2
PATCH 6/6 xfs: add a flags argument to xfs_icache_free_eofblocks
In reply to Christoph HellwigPass the SYNC_* flags directly instead of hiding the information in the eofblocks structure.
--- fs/xfs/xfs_file.c | 3 +-- fs/xfs/xfs_icache.c | 11 ++++------- fs/xfs/xfs_icache.h | 3 ++- fs/xfs/xfs_ioctl.c | 4 +++- 4 files changed, 10 insertions(+), 11 deletions(-)
fs/xfs/xfs_file.c +1 -2
@@ -661,8 +661,7 @@ xfs_file_buffered_aio_write(xfs_flush_inodes (ip->i_mount);xfs_iunlock (ip, iolock); - eofb.eof_flags =XFS_EOF_FLAGS_SYNC ; -xfs_icache_free_eofblocks (ip->i_mount, &eofb); +xfs_icache_free_eofblocks (ip->i_mount, &eofb,SYNC_WAIT );xfs_icache_free_cowblocks (ip->i_mount, &eofb,SYNC_WAIT ); goto write_retry; }
fs/xfs/xfs_icache.c +4 -7
@@ -912,7 +912,7 @@ xfs_eofblocks_worker(if (!sb_start_write_trylock (mp->m_super))return ; -xfs_icache_free_eofblocks (mp,NULL ); +xfs_icache_free_eofblocks (mp,NULL ,SYNC_TRYLOCK );sb_end_write (mp->m_super);xfs_queue_eofblocks (mp);
@@ -1507,12 +1507,9 @@ xfs_inode_free_eofblocks(int xfs_icache_free_eofblocks (struct xfs_mount *mp, -struct xfs_eofblocks *eofb) +struct xfs_eofblocks *eofb, +int flags) { -int flags =SYNC_TRYLOCK ; - -if (eofb && (eofb->eof_flags &XFS_EOF_FLAGS_SYNC )) - flags =SYNC_WAIT ;return xfs_inode_ag_iterator_tag (mp, xfs_inode_free_eofblocks, flags, eofb,XFS_ICI_EOFBLOCKS_TAG ); }
@@ -1556,7 +1553,7 @@ xfs_inode_free_quota_blocks( }if (scan) { -xfs_icache_free_eofblocks (ip->i_mount, &eofb); +xfs_icache_free_eofblocks (ip->i_mount, &eofb,SYNC_WAIT );xfs_icache_free_cowblocks (ip->i_mount, &eofb,SYNC_WAIT ); }
fs/xfs/xfs_icache.h +2 -1
@@ -59,7 +59,8 @@ void xfs_inode_set_reclaim_tag(struct xfs_inode *ip);void xfs_inode_set_eofblocks_tag (struct xfs_inode *ip);void xfs_inode_clear_eofblocks_tag (struct xfs_inode *ip); -int xfs_icache_free_eofblocks (struct xfs_mount *,struct xfs_eofblocks *); +int xfs_icache_free_eofblocks (struct xfs_mount *mp,struct xfs_eofblocks *eofb, +int flags);int xfs_inode_free_quota_blocks (struct xfs_inode *ip);void xfs_eofblocks_worker (struct work_struct *);void xfs_queue_eofblocks (struct xfs_mount *);
fs/xfs/xfs_ioctl.c +3 -1
@@ -2330,7 +2330,9 @@ xfs_file_ioctl(return error;sb_start_write (mp->m_super); - error =xfs_icache_free_eofblocks (mp, &keofb); + error =xfs_icache_free_eofblocks (mp, &keofb, + (keofb.eof_flags &XFS_EOF_FLAGS_SYNC ) ? +SYNC_WAIT :SYNC_TRYLOCK );sb_end_write (mp->m_super);return error; }
Signature · 1 line
2.26.2
Quoted 4 lines · Christoph Hellwig
Hi all,
this series cleans up a bunch of lose ends in the inode iterator functions.
Funny, I was going to send a series next cycle that refactors a fair amount of the incore inode iterators and then collapses the free_cowblocks/free_eofblocks code into a single worker and radix tree tag that takes care of all the speculative preallocation extent gc stuff...
incore walks:
https://lore.kernel.org/linux-xfs/157784075463.1360343.1278255546758019580.stgit@magnolia/
reworking of the quota flushing:
https://lore.kernel.org/linux-xfs/157784083298.1361522.7064886067520069080.stgit@magnolia/
posteof/cowblocks consolidation:
https://lore.kernel.org/linux-xfs/157784087594.1361683.5987233633798863051.stgit@magnolia/
--D
Quoted 6 lines · Darrick J. Wong
Quoted 4 lines · Christoph Hellwig
Hi all,
this series cleans up a bunch of lose ends in the inode iterator functions.
Quoted 8 lines
Funny, I was going to send a series next cycle that refactors a fair amount of the incore inode iterators and then collapses the free_cowblocks/free_eofblocks code into a single worker and radix tree tag that takes care of all the speculative preallocation extent gc stuff...
incore walks:
https://lore.kernel.org/linux-xfs/157784075463.1360343.1278255546758019580.stgit@magnolia/
Except for the last few those seem non-brainers tat would could merge ASAP..
The rest also doesn't look bad, so I'll happily defer this series. OTOH the first on really should go in, either your or my version :)
Quoted 13 lines · Christoph Hellwig
Quoted 12 lines · Darrick J. Wong
Quoted 4 lines · Christoph Hellwig
Hi all,
this series cleans up a bunch of lose ends in the inode iterator functions.
Funny, I was going to send a series next cycle that refactors a fair amount of the incore inode iterators and then collapses the free_cowblocks/free_eofblocks code into a single worker and radix tree tag that takes care of all the speculative preallocation extent gc stuff...
Quoted 8 lines
Quoted 2 lines
incore walks:
https://lore.kernel.org/linux-xfs/157784075463.1360343.1278255546758019580.stgit@magnolia/Except for the last few those seem non-brainers tat would could merge ASAP..
The rest also doesn't look bad, so I'll happily defer this series. OTOH the first on really should go in, either your or my version :)
Well, I'll send the set for a formal review... :)
--D