On Mon, Jul 11, 2016 at 12:57:59AM +0800, Kaho Ng wrote: > well, a piece of comment about the corner case i mentioned is found in > xfsprogs/repair/phase5.c, but i still have no idea how that is > prevented by the xfs kernel module. > > /* > * We need to leave some free records in the tree for the corner case of > * setting up the AGFL. This may require allocation of blocks, and as > * such can require insertion of new records into the tree (e.g. moving > * a record in the by-count tree when a long extent is shortened). If we > * pack the records into the leaves with no slack space, this requires a > * leaf split to occur and a block to be allocated from the free list. > * If we don't have any blocks on the free list (because we are setting > * it up!), then we fail, and the filesystem will fail with the same > * failure at runtime. Hence leave a couple of records slack space in > * each block to allow immediate modification of the tree without > * requiring splits to be done. > * > * XXX(hch): any reason we don't just look at mp->m_alloc_mxr? > */ Once mkfs fills the AGFL with the minimum number of blocks to ensure allocations always succeed, the kernel guarantees that minimum number of blocks will always be available on the AGFL and hence allocation and freeing of blocks will always succeed, regardless of whether btree splits are needed or not. i.e. ENOSPC is not reported at "filesystem has zero freespace" but at "freespace btrees are empty and each AGFL is at minimum free blocks". See XFS_ALLOC_SET_ASIDE() and XFS_ALLOC_AG_MAX_USABLE(). Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs