On Fri, Apr 28, 2023 at 12:13:46PM +1000, Dave Chinner wrote: > On Thu, Apr 27, 2023 at 03:49:16PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > > > For an unshare request, we only have to take action if the data fork has > > a shared mapping. We don't care if someone else set up a cow operation. > > If we find nothing in the data fork, return a hole to avoid allocating > > space. > > > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > > --- > > fs/xfs/xfs_iomap.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > Looks ok, but I'm unsure of what bad behaviour this might be fixing. > Did you just notice this, or does it fix some kind of test failure? I noticed it while I was running the freespace defrag code in djwong-dev with tracepoints turned on. THere was a math bug that I was trying to sort out that resulted in FUNSHARE being called on a hole, and I was surprised that it would create a delalloc reservation and then convert it to an unwritten extent instead of going straight to an unwritten extent. AFAICT it has no user visible effect other than not wasting cycles on pointless work. --D > -Dave. > -- > Dave Chinner > david@xxxxxxxxxxxxx