]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - fs/xfs/libxfs/xfs_bmap.c
xfs: don't log inode unless extent shift makes extent modifications
authorBrian Foster <bfoster@redhat.com>
Tue, 2 Sep 2014 02:12:53 +0000 (12:12 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 2 Sep 2014 02:12:53 +0000 (12:12 +1000)
commitca446d880c399bb31301e7d8eefbd7fe3c504c4e
treef56c1744deb58bf8c047793c40c851ad06650fca
parent7d4ea3ce63a6bc532abb334c469c18481798af8c
xfs: don't log inode unless extent shift makes extent modifications

The file collapse mechanism uses xfs_bmap_shift_extents() to collapse
all subsequent extents down into the specified, previously punched out,
region. This function performs some validation, such as whether a
sufficient hole exists in the target region of the collapse, then shifts
the remaining exents downward.

The exit path of the function currently logs the inode unconditionally.
While we must log the inode (and abort) if an error occurs and the
transaction is dirty, the initial validation paths can generate errors
before the transaction has been dirtied. This creates an unnecessary
filesystem shutdown scenario, as the caller will cancel a transaction
that has been marked dirty.

Modify xfs_bmap_shift_extents() to OR the logflags bits as modifications
are made to the inode bmap. Only log the inode in the exit path if
logflags has been set. This ensures we only have to cancel a dirty
transaction if modifications have been made and prevents an unnecessary
filesystem shutdown otherwise.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_bmap.c