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 */
......@@ -105,19 +105,17 @@ typedef enum page_buf_flags_e { /* pb_flags values */
PBF_TRYLOCK = (1 << 14), /* lock requested, but do not wait */
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_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 */
PBF_FLUSH = (1 << 25), /* flush disk write cache */
PBF_READ_AHEAD = (1 << 26),
} page_buf_flags_t;
......
......@@ -104,8 +104,8 @@ int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur);
#define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */
#define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
#define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
#define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
#define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */
#define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
#define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */
#define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)
#define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)
......
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