Commit f2bde9b8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder

xfs: small cleanups for xfs_iomap / __xfs_get_blocks

Remove the flags argument to  __xfs_get_blocks as we can easily derive
it from the direct argument, and remove the unused BMAPI_MMAP flag.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 3070451e
...@@ -1295,9 +1295,9 @@ __xfs_get_blocks( ...@@ -1295,9 +1295,9 @@ __xfs_get_blocks(
sector_t iblock, sector_t iblock,
struct buffer_head *bh_result, struct buffer_head *bh_result,
int create, int create,
int direct, int direct)
bmapi_flags_t flags)
{ {
int flags = create ? BMAPI_WRITE : BMAPI_READ;
struct xfs_bmbt_irec imap; struct xfs_bmbt_irec imap;
xfs_off_t offset; xfs_off_t offset;
ssize_t size; ssize_t size;
...@@ -1312,8 +1312,11 @@ __xfs_get_blocks( ...@@ -1312,8 +1312,11 @@ __xfs_get_blocks(
if (!create && direct && offset >= i_size_read(inode)) if (!create && direct && offset >= i_size_read(inode))
return 0; return 0;
error = xfs_iomap(XFS_I(inode), offset, size, if (direct && create)
create ? flags : BMAPI_READ, &imap, &nimap, &new); flags |= BMAPI_DIRECT;
error = xfs_iomap(XFS_I(inode), offset, size, flags, &imap, &nimap,
&new);
if (error) if (error)
return -error; return -error;
if (nimap == 0) if (nimap == 0)
...@@ -1393,8 +1396,7 @@ xfs_get_blocks( ...@@ -1393,8 +1396,7 @@ xfs_get_blocks(
struct buffer_head *bh_result, struct buffer_head *bh_result,
int create) int create)
{ {
return __xfs_get_blocks(inode, iblock, return __xfs_get_blocks(inode, iblock, bh_result, create, 0);
bh_result, create, 0, BMAPI_WRITE);
} }
STATIC int STATIC int
...@@ -1404,8 +1406,7 @@ xfs_get_blocks_direct( ...@@ -1404,8 +1406,7 @@ xfs_get_blocks_direct(
struct buffer_head *bh_result, struct buffer_head *bh_result,
int create) int create)
{ {
return __xfs_get_blocks(inode, iblock, return __xfs_get_blocks(inode, iblock, bh_result, create, 1);
bh_result, create, 1, BMAPI_WRITE|BMAPI_DIRECT);
} }
STATIC void STATIC void
......
...@@ -133,7 +133,7 @@ xfs_iomap( ...@@ -133,7 +133,7 @@ xfs_iomap(
break; break;
} }
if (flags & (BMAPI_DIRECT|BMAPI_MMAP)) { if (flags & BMAPI_DIRECT) {
error = xfs_iomap_write_direct(ip, offset, count, flags, error = xfs_iomap_write_direct(ip, offset, count, flags,
imap, nimaps); imap, nimaps);
} else { } else {
......
...@@ -26,7 +26,6 @@ typedef enum { ...@@ -26,7 +26,6 @@ typedef enum {
/* 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 */
BMAPI_MMAP = (1 << 6), /* allocate for mmap write */
BMAPI_TRYLOCK = (1 << 7), /* non-blocking request */ BMAPI_TRYLOCK = (1 << 7), /* non-blocking request */
} bmapi_flags_t; } bmapi_flags_t;
...@@ -36,7 +35,6 @@ typedef enum { ...@@ -36,7 +35,6 @@ typedef enum {
{ BMAPI_ALLOCATE, "ALLOCATE" }, \ { BMAPI_ALLOCATE, "ALLOCATE" }, \
{ BMAPI_IGNSTATE, "IGNSTATE" }, \ { BMAPI_IGNSTATE, "IGNSTATE" }, \
{ BMAPI_DIRECT, "DIRECT" }, \ { BMAPI_DIRECT, "DIRECT" }, \
{ BMAPI_MMAP, "MMAP" }, \
{ BMAPI_TRYLOCK, "TRYLOCK" } { BMAPI_TRYLOCK, "TRYLOCK" }
struct xfs_inode; struct xfs_inode;
......
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