Commit a2d84232 authored by Nathan Scott's avatar Nathan Scott Committed by Christoph Hellwig

[XFS] Some cleanup, some more unwritten extent related changes.

SGI Modid: 2.5.x-xfs:slinx:135207a
parent 13c554e6
......@@ -29,14 +29,8 @@
*
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
/*
* fs/xfs/linux/xfs_iomap.c (Linux Read Write stuff)
*
*/
#include <xfs.h>
#include <linux/pagemap.h>
#define XFS_WRITEIO_ALIGN(mp,off) (((off) >> mp->m_writeio_log) \
<< mp->m_writeio_log)
......@@ -93,7 +87,8 @@ _xfs_imap_to_bmap(
}
int
xfs_iomap(xfs_iocore_t *io,
xfs_iomap(
xfs_iocore_t *io,
xfs_off_t offset,
ssize_t count,
int flags,
......@@ -111,7 +106,8 @@ xfs_iomap(xfs_iocore_t *io,
if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO);
switch (flags & (PBF_READ|PBF_WRITE|PBF_FILE_ALLOCATE)) {
switch (flags &
(PBF_READ|PBF_WRITE|PBF_FILE_ALLOCATE|PBF_FILE_UNWRITTEN)) {
case PBF_READ:
lockmode = XFS_LCK_MAP_SHARED(mp, io);
bmap_flags = XFS_BMAPI_ENTIRE;
......@@ -126,8 +122,13 @@ xfs_iomap(xfs_iocore_t *io,
bmap_flags = XFS_BMAPI_ENTIRE;
XFS_ILOCK(mp, io, lockmode);
break;
case PBF_FILE_UNWRITTEN:
lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR;
bmap_flags = XFS_BMAPI_ENTIRE|XFS_BMAPI_IGSTATE;
XFS_ILOCK(mp, io, lockmode);
break;
default:
ASSERT(flags & (PBF_READ|PBF_WRITE|PBF_FILE_ALLOCATE));
BUG();
}
offset_fsb = XFS_B_TO_FSBT(mp, offset);
......@@ -180,7 +181,7 @@ xfs_iomap(xfs_iocore_t *io,
return XFS_ERROR(error);
}
static int
STATIC int
xfs_flush_space(
xfs_inode_t *ip,
int *fsynced,
......@@ -500,7 +501,6 @@ xfs_iomap_write_delay(
return 0;
}
/*
* Pass in a delayed allocate extent, convert it to real extents;
* return to the caller the extent we create which maps on top of
......@@ -732,4 +732,3 @@ xfs_iomap_write_unwritten(
error0:
return XFS_ERROR(error);
}
......@@ -83,7 +83,7 @@ typedef enum { /* pbm_flags values */
PBMF_HOLE = 0x02, /* mapping covers a hole */
PBMF_DELAY = 0x04, /* mapping covers delalloc region */
PBMF_UNWRITTEN = 0x20 /* mapping covers allocated */
/* but uninitialized XFS data */
/* but uninitialized file data */
} bmap_flags_t;
typedef enum page_buf_flags_e { /* pb_flags values */
......@@ -106,15 +106,13 @@ typedef enum page_buf_flags_e { /* pb_flags values */
PBF_FILE_ALLOCATE = (1 << 15), /* allocate all file space */
PBF_DONT_BLOCK = (1 << 16), /* do not block in current thread */
PBF_DIRECT = (1 << 17), /* direct I/O desired */
PBF_FILE_UNWRITTEN = (1 << 18), /* convert unwritten extent space */
/* flags used only internally */
_PBF_LOCKABLE = (1 << 19), /* page_buf_t may be locked */
_PBF_ALL_PAGES_MAPPED = (1 << 21),
/* all pages in rage are mapped */
_PBF_ADDR_ALLOCATED = (1 << 22),
/* pb_addr space was allocated */
_PBF_MEM_ALLOCATED = (1 << 23),
/* pb_mem and underlying pages allocated */
_PBF_ALL_PAGES_MAPPED = (1 << 21), /* all pages in range mapped */
_PBF_ADDR_ALLOCATED = (1 << 22), /* pb_addr space was allocated */
_PBF_MEM_ALLOCATED = (1 << 23), /* pb_mem+underlying pages alloc'd */
PBF_FORCEIO = (1 << 24),
PBF_FLUSH = (1 << 25), /* flush disk write cache */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment