aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-06-23 21:44:35 -0400
committerAlex Elder <aelder@sgi.com>2010-07-26 14:16:42 -0400
commitf2bde9b89b4d67c9bc3b963cb996f449ddcd27a4 (patch)
tree3f5ce631c4f0057776bdf38fcde1b34b359f3376 /fs/xfs
parent3070451eea1ed8e3bde0573183c7d8ac25fd5e97 (diff)
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c17
-rw-r--r--fs/xfs/xfs_iomap.c2
-rw-r--r--fs/xfs/xfs_iomap.h2
3 files changed, 10 insertions, 11 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 1776cdd944b5..88ce1c6efff0 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1295,9 +1295,9 @@ __xfs_get_blocks(
1295 sector_t iblock, 1295 sector_t iblock,
1296 struct buffer_head *bh_result, 1296 struct buffer_head *bh_result,
1297 int create, 1297 int create,
1298 int direct, 1298 int direct)
1299 bmapi_flags_t flags)
1300{ 1299{
1300 int flags = create ? BMAPI_WRITE : BMAPI_READ;
1301 struct xfs_bmbt_irec imap; 1301 struct xfs_bmbt_irec imap;
1302 xfs_off_t offset; 1302 xfs_off_t offset;
1303 ssize_t size; 1303 ssize_t size;
@@ -1312,8 +1312,11 @@ __xfs_get_blocks(
1312 if (!create && direct && offset >= i_size_read(inode)) 1312 if (!create && direct && offset >= i_size_read(inode))
1313 return 0; 1313 return 0;
1314 1314
1315 error = xfs_iomap(XFS_I(inode), offset, size, 1315 if (direct && create)
1316 create ? flags : BMAPI_READ, &imap, &nimap, &new); 1316 flags |= BMAPI_DIRECT;
1317
1318 error = xfs_iomap(XFS_I(inode), offset, size, flags, &imap, &nimap,
1319 &new);
1317 if (error) 1320 if (error)
1318 return -error; 1321 return -error;
1319 if (nimap == 0) 1322 if (nimap == 0)
@@ -1393,8 +1396,7 @@ xfs_get_blocks(
1393 struct buffer_head *bh_result, 1396 struct buffer_head *bh_result,
1394 int create) 1397 int create)
1395{ 1398{
1396 return __xfs_get_blocks(inode, iblock, 1399 return __xfs_get_blocks(inode, iblock, bh_result, create, 0);
1397 bh_result, create, 0, BMAPI_WRITE);
1398} 1400}
1399 1401
1400STATIC int 1402STATIC int
@@ -1404,8 +1406,7 @@ xfs_get_blocks_direct(
1404 struct buffer_head *bh_result, 1406 struct buffer_head *bh_result,
1405 int create) 1407 int create)
1406{ 1408{
1407 return __xfs_get_blocks(inode, iblock, 1409 return __xfs_get_blocks(inode, iblock, bh_result, create, 1);
1408 bh_result, create, 1, BMAPI_WRITE|BMAPI_DIRECT);
1409} 1410}
1410 1411
1411STATIC void 1412STATIC void
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index a0dbcaff911a..20576146369f 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -133,7 +133,7 @@ xfs_iomap(
133 break; 133 break;
134 } 134 }
135 135
136 if (flags & (BMAPI_DIRECT|BMAPI_MMAP)) { 136 if (flags & BMAPI_DIRECT) {
137 error = xfs_iomap_write_direct(ip, offset, count, flags, 137 error = xfs_iomap_write_direct(ip, offset, count, flags,
138 imap, nimaps); 138 imap, nimaps);
139 } else { 139 } else {
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
index 81ac4afd45b3..2cea2daf01ca 100644
--- a/fs/xfs/xfs_iomap.h
+++ b/fs/xfs/xfs_iomap.h
@@ -26,7 +26,6 @@ typedef enum {
26 /* modifiers */ 26 /* modifiers */
27 BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */ 27 BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
28 BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */ 28 BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */
29 BMAPI_MMAP = (1 << 6), /* allocate for mmap write */
30 BMAPI_TRYLOCK = (1 << 7), /* non-blocking request */ 29 BMAPI_TRYLOCK = (1 << 7), /* non-blocking request */
31} bmapi_flags_t; 30} bmapi_flags_t;
32 31
@@ -36,7 +35,6 @@ typedef enum {
36 { BMAPI_ALLOCATE, "ALLOCATE" }, \ 35 { BMAPI_ALLOCATE, "ALLOCATE" }, \
37 { BMAPI_IGNSTATE, "IGNSTATE" }, \ 36 { BMAPI_IGNSTATE, "IGNSTATE" }, \
38 { BMAPI_DIRECT, "DIRECT" }, \ 37 { BMAPI_DIRECT, "DIRECT" }, \
39 { BMAPI_MMAP, "MMAP" }, \
40 { BMAPI_TRYLOCK, "TRYLOCK" } 38 { BMAPI_TRYLOCK, "TRYLOCK" }
41 39
42struct xfs_inode; 40struct xfs_inode;