mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
[XFS] kill BMAPI_UNWRITTEN
There is no reason to go through xfs_iomap for the BMAPI_UNWRITTEN because it has nothing in common with the other cases. Instead check for the shutdown filesystem in xfs_end_bio_unwritten and perform a direct call to xfs_iomap_write_unwritten (which should be renamed to something more sensible one day) SGI-PV: 970241 SGI-Modid: xfs-linux-melb:xfs-kern:29681a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Donald Douwsma <donaldd@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
This commit is contained in:
parent
6214ed4461
commit
7642861b7e
3 changed files with 5 additions and 15 deletions
|
@ -238,12 +238,13 @@ xfs_end_bio_unwritten(
|
||||||
{
|
{
|
||||||
xfs_ioend_t *ioend =
|
xfs_ioend_t *ioend =
|
||||||
container_of(work, xfs_ioend_t, io_work);
|
container_of(work, xfs_ioend_t, io_work);
|
||||||
|
struct xfs_inode *ip = XFS_I(ioend->io_inode);
|
||||||
xfs_off_t offset = ioend->io_offset;
|
xfs_off_t offset = ioend->io_offset;
|
||||||
size_t size = ioend->io_size;
|
size_t size = ioend->io_size;
|
||||||
|
|
||||||
if (likely(!ioend->io_error)) {
|
if (likely(!ioend->io_error)) {
|
||||||
xfs_bmap(XFS_I(ioend->io_inode), offset, size,
|
if (!XFS_FORCED_SHUTDOWN(ip->i_mount))
|
||||||
BMAPI_UNWRITTEN, NULL, NULL);
|
xfs_iomap_write_unwritten(ip, offset, size);
|
||||||
xfs_setfilesize(ioend);
|
xfs_setfilesize(ioend);
|
||||||
}
|
}
|
||||||
xfs_destroy_ioend(ioend);
|
xfs_destroy_ioend(ioend);
|
||||||
|
|
|
@ -191,9 +191,7 @@ xfs_iomap(
|
||||||
if (XFS_FORCED_SHUTDOWN(mp))
|
if (XFS_FORCED_SHUTDOWN(mp))
|
||||||
return XFS_ERROR(EIO);
|
return XFS_ERROR(EIO);
|
||||||
|
|
||||||
switch (flags &
|
switch (flags & (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE)) {
|
||||||
(BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE |
|
|
||||||
BMAPI_UNWRITTEN)) {
|
|
||||||
case BMAPI_READ:
|
case BMAPI_READ:
|
||||||
xfs_iomap_enter_trace(XFS_IOMAP_READ_ENTER, io, offset, count);
|
xfs_iomap_enter_trace(XFS_IOMAP_READ_ENTER, io, offset, count);
|
||||||
lockmode = XFS_LCK_MAP_SHARED(mp, io);
|
lockmode = XFS_LCK_MAP_SHARED(mp, io);
|
||||||
|
@ -218,8 +216,6 @@ xfs_iomap(
|
||||||
XFS_ILOCK(mp, io, lockmode);
|
XFS_ILOCK(mp, io, lockmode);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BMAPI_UNWRITTEN:
|
|
||||||
goto phase2;
|
|
||||||
default:
|
default:
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
@ -238,8 +234,7 @@ xfs_iomap(
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
phase2:
|
switch (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)) {
|
||||||
switch (flags & (BMAPI_WRITE|BMAPI_ALLOCATE|BMAPI_UNWRITTEN)) {
|
|
||||||
case BMAPI_WRITE:
|
case BMAPI_WRITE:
|
||||||
/* If we found an extent, return it */
|
/* If we found an extent, return it */
|
||||||
if (nimaps &&
|
if (nimaps &&
|
||||||
|
@ -277,11 +272,6 @@ xfs_iomap(
|
||||||
error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count,
|
error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count,
|
||||||
&imap, &nimaps);
|
&imap, &nimaps);
|
||||||
break;
|
break;
|
||||||
case BMAPI_UNWRITTEN:
|
|
||||||
lockmode = 0;
|
|
||||||
error = XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count);
|
|
||||||
nimaps = 0;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nimaps) {
|
if (nimaps) {
|
||||||
|
|
|
@ -36,7 +36,6 @@ typedef enum {
|
||||||
BMAPI_READ = (1 << 0), /* read extents */
|
BMAPI_READ = (1 << 0), /* read extents */
|
||||||
BMAPI_WRITE = (1 << 1), /* create extents */
|
BMAPI_WRITE = (1 << 1), /* create extents */
|
||||||
BMAPI_ALLOCATE = (1 << 2), /* delayed allocate to real extents */
|
BMAPI_ALLOCATE = (1 << 2), /* delayed allocate to real extents */
|
||||||
BMAPI_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */
|
|
||||||
/* modifiers */
|
/* modifiers */
|
||||||
BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
|
BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
|
||||||
BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */
|
BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */
|
||||||
|
|
Loading…
Reference in a new issue