All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] xfs: support shrinking empty AGs
@ 2021-04-14 19:52 Gao Xiang
  2021-04-14 19:52 ` [RFC PATCH 1/4] xfs: support deactivating AGs Gao Xiang
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Gao Xiang @ 2021-04-14 19:52 UTC (permalink / raw)
  To: linux-xfs; +Cc: Gao Xiang

Hi folks,

Sorry for some delay... After "support shrinking unused space in
the last AG" patchset was settled for-next, I spent some time working
on arranging this patchset in order to shrink empty AGs as well.

As mentioned before, freespace can be shrinked atomicly with the
following steps:

 - make sure the pending-for-discard AGs are all stablized as empty;
 - a transaction to
     fix up freespace btrees for the target tail AG;
     decrease agcount to the target value.

All pending-for-discard per-ags will be marked as inactive in advance
and excluded from most fs paths. A per-ag lock is used to stablize
the inactive status together with agi/agf buffer lock. It also
introduces a new max_agcount in order to free such inactive perags.

This patchset has been preliminary manually tested by hand and it
seems work. but I still haven't tested with other fs workloads
together. I will work on refine previous fstests to cover this.
But meanwhile I think it'd be better hear more ideas about this
first.

Kindly point out any strange or what I'm missing so I could revise
it and get it in shape as soon as possible...

xfsprogs is still:
https://lore.kernel.org/r/20210326024631.12921-1-hsiangkao@aol.com

Thanks for your time!

Thanks,
Gao Xiang

Gao Xiang (4):
  xfs: support deactivating AGs
  xfs: check ag is empty
  xfs: introduce max_agcount
  xfs: support shrinking empty AGs

 fs/xfs/libxfs/xfs_ag.c     |  17 ++++-
 fs/xfs/libxfs/xfs_ag.h     |   2 +-
 fs/xfs/libxfs/xfs_alloc.c  | 111 +++++++++++++++++++++++++++-
 fs/xfs/libxfs/xfs_alloc.h  |   4 +
 fs/xfs/libxfs/xfs_bmap.c   |   8 +-
 fs/xfs/libxfs/xfs_ialloc.c |  28 ++++++-
 fs/xfs/libxfs/xfs_sb.c     |   1 +
 fs/xfs/xfs_extent_busy.c   |   2 +-
 fs/xfs/xfs_fsops.c         | 148 ++++++++++++++++++++++++++++++++++---
 fs/xfs/xfs_mount.c         |  89 ++++++++++++++++++----
 fs/xfs/xfs_mount.h         |   7 ++
 fs/xfs/xfs_trans.c         |   3 +-
 12 files changed, 379 insertions(+), 41 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [RFC PATCH 4/4] xfs: support shrinking empty AGs
@ 2021-04-15 14:58 kernel test robot
  0 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2021-04-15 14:58 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3673 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210414195240.1802221-5-hsiangkao@redhat.com>
References: <20210414195240.1802221-5-hsiangkao@redhat.com>
TO: Gao Xiang <hsiangkao@redhat.com>

Hi Gao,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on xfs-linux/for-next]
[also build test WARNING on next-20210415]
[cannot apply to xiang-erofs/dev-test v5.12-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Gao-Xiang/xfs-support-shrinking-empty-AGs/20210415-035456
base:   https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git for-next
:::::: branch date: 19 hours ago
:::::: commit date: 19 hours ago
config: x86_64-randconfig-m001-20210415 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
fs/xfs/xfs_fsops.c:114 xfs_shrinkfs_deactivate_ags() error: uninitialized symbol 'error'.

vim +/error +114 fs/xfs/xfs_fsops.c

c789c83c7ef8f98 Gao Xiang 2021-03-23   83  
cc44e74a238999c Gao Xiang 2021-04-15   84  static int
cc44e74a238999c Gao Xiang 2021-04-15   85  xfs_shrinkfs_deactivate_ags(
cc44e74a238999c Gao Xiang 2021-04-15   86  	struct xfs_mount        *mp,
cc44e74a238999c Gao Xiang 2021-04-15   87  	xfs_agnumber_t		oagcount,
cc44e74a238999c Gao Xiang 2021-04-15   88  	xfs_agnumber_t		nagcount)
cc44e74a238999c Gao Xiang 2021-04-15   89  {
cc44e74a238999c Gao Xiang 2021-04-15   90  	xfs_agnumber_t		agno;
cc44e74a238999c Gao Xiang 2021-04-15   91  	int			error;
cc44e74a238999c Gao Xiang 2021-04-15   92  
cc44e74a238999c Gao Xiang 2021-04-15   93  	/* confirm AGs pending for shrinking are all inactive */
cc44e74a238999c Gao Xiang 2021-04-15   94  	for (agno = nagcount; agno < oagcount; ++agno) {
cc44e74a238999c Gao Xiang 2021-04-15   95  		struct xfs_buf *agfbp, *agibp;
cc44e74a238999c Gao Xiang 2021-04-15   96  		struct xfs_perag *pag = xfs_perag_get(mp, agno);
cc44e74a238999c Gao Xiang 2021-04-15   97  
cc44e74a238999c Gao Xiang 2021-04-15   98  		down_write(&pag->pag_inactive_rwsem);
cc44e74a238999c Gao Xiang 2021-04-15   99  		/* need to lock agi, agf buffers here to close all races */
cc44e74a238999c Gao Xiang 2021-04-15  100  		error = xfs_read_agi(mp, NULL, agno, &agibp);
cc44e74a238999c Gao Xiang 2021-04-15  101  		if (!error) {
cc44e74a238999c Gao Xiang 2021-04-15  102  			error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agfbp);
cc44e74a238999c Gao Xiang 2021-04-15  103  			if (!error) {
cc44e74a238999c Gao Xiang 2021-04-15  104  				pag->pag_inactive = true;
cc44e74a238999c Gao Xiang 2021-04-15  105  				xfs_buf_relse(agfbp);
cc44e74a238999c Gao Xiang 2021-04-15  106  			}
cc44e74a238999c Gao Xiang 2021-04-15  107  			xfs_buf_relse(agibp);
cc44e74a238999c Gao Xiang 2021-04-15  108  		}
cc44e74a238999c Gao Xiang 2021-04-15  109  		up_write(&pag->pag_inactive_rwsem);
cc44e74a238999c Gao Xiang 2021-04-15  110  		xfs_perag_put(pag);
cc44e74a238999c Gao Xiang 2021-04-15  111  		if (error)
cc44e74a238999c Gao Xiang 2021-04-15  112  			break;
cc44e74a238999c Gao Xiang 2021-04-15  113  	}
cc44e74a238999c Gao Xiang 2021-04-15 @114  	return error;
cc44e74a238999c Gao Xiang 2021-04-15  115  }
cc44e74a238999c Gao Xiang 2021-04-15  116  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36207 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-04-15 21:24 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 19:52 [RFC PATCH 0/4] xfs: support shrinking empty AGs Gao Xiang
2021-04-14 19:52 ` [RFC PATCH 1/4] xfs: support deactivating AGs Gao Xiang
2021-04-15  3:42   ` Dave Chinner
2021-04-15  4:28     ` Gao Xiang
2021-04-15  6:28       ` Dave Chinner
2021-04-15  7:08         ` Gao Xiang
2021-04-15  8:44           ` Dave Chinner
2021-04-14 19:52 ` [RFC PATCH 2/4] xfs: check ag is empty Gao Xiang
2021-04-15  3:52   ` Dave Chinner
2021-04-15  4:34     ` Gao Xiang
2021-04-14 19:52 ` [RFC PATCH 3/4] xfs: introduce max_agcount Gao Xiang
2021-04-15  3:59   ` Dave Chinner
2021-04-14 19:52 ` [RFC PATCH 4/4] xfs: support shrinking empty AGs Gao Xiang
2021-04-15  4:25   ` Dave Chinner
2021-04-15  5:22     ` Gao Xiang
2021-04-15  8:33       ` Dave Chinner
2021-04-15 17:00         ` Darrick J. Wong
2021-04-15 21:24           ` Dave Chinner
2021-04-15 14:58 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.