aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorLachlan McIlroy <lachlan@sgi.com>2007-10-11 03:34:33 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-07 00:44:14 -0500
commit541d7d3c4b31e2b0ac846fe6d2eb5cdbe1353095 (patch)
treed8c9cf9cf75fd3d23ebc19e5f6b646a4d807b72c /fs/xfs
parent21a62542b6d7f726d6c1d2cfbfa084f721ba4a26 (diff)
[XFS] kill unnessecary ioops indirection
Currently there is an indirection called ioops in the XFS data I/O path. Various functions are called by functions pointers, but there is no coherence in what this is for, and of course for XFS itself it's entirely unused. This patch removes it instead and significantly reduces source and binary size of XFS while making maintaince easier. SGI-PV: 970841 SGI-Modid: xfs-linux-melb:xfs-kern:29737a Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c56
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.h3
-rw-r--r--fs/xfs/xfs_dfrag.c2
-rw-r--r--fs/xfs/xfs_inode.c8
-rw-r--r--fs/xfs/xfs_iocore.c40
-rw-r--r--fs/xfs/xfs_iomap.c94
-rw-r--r--fs/xfs/xfs_iomap.h3
-rw-r--r--fs/xfs/xfs_mount.c1
-rw-r--r--fs/xfs/xfs_mount.h101
-rw-r--r--fs/xfs/xfs_vfsops.c4
-rw-r--r--fs/xfs/xfs_vnodeops.c12
12 files changed, 79 insertions, 249 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index d23c561a6293..d20df3918650 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -317,7 +317,7 @@ xfs_map_blocks(
317 xfs_inode_t *ip = XFS_I(inode); 317 xfs_inode_t *ip = XFS_I(inode);
318 int error, nmaps = 1; 318 int error, nmaps = 1;
319 319
320 error = xfs_bmap(ip, offset, count, 320 error = xfs_iomap(ip, offset, count,
321 flags, mapp, &nmaps); 321 flags, mapp, &nmaps);
322 if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE))) 322 if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)))
323 xfs_iflags_set(ip, XFS_IMODIFIED); 323 xfs_iflags_set(ip, XFS_IMODIFIED);
@@ -1336,7 +1336,7 @@ __xfs_get_blocks(
1336 offset = (xfs_off_t)iblock << inode->i_blkbits; 1336 offset = (xfs_off_t)iblock << inode->i_blkbits;
1337 ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); 1337 ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
1338 size = bh_result->b_size; 1338 size = bh_result->b_size;
1339 error = xfs_bmap(XFS_I(inode), offset, size, 1339 error = xfs_iomap(XFS_I(inode), offset, size,
1340 create ? flags : BMAPI_READ, &iomap, &niomap); 1340 create ? flags : BMAPI_READ, &iomap, &niomap);
1341 if (error) 1341 if (error)
1342 return -error; 1342 return -error;
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index d6a8dddb2268..0abc7d0586c9 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -131,7 +131,7 @@ xfs_inval_cached_trace(
131 */ 131 */
132STATIC int 132STATIC int
133xfs_iozero( 133xfs_iozero(
134 struct inode *ip, /* inode */ 134 struct xfs_inode *ip, /* inode */
135 loff_t pos, /* offset in file */ 135 loff_t pos, /* offset in file */
136 size_t count) /* size of data to zero */ 136 size_t count) /* size of data to zero */
137{ 137{
@@ -139,7 +139,7 @@ xfs_iozero(
139 struct address_space *mapping; 139 struct address_space *mapping;
140 int status; 140 int status;
141 141
142 mapping = ip->i_mapping; 142 mapping = ip->i_vnode->i_mapping;
143 do { 143 do {
144 unsigned offset, bytes; 144 unsigned offset, bytes;
145 void *fsdata; 145 void *fsdata;
@@ -389,20 +389,19 @@ xfs_splice_write(
389 */ 389 */
390STATIC int /* error (positive) */ 390STATIC int /* error (positive) */
391xfs_zero_last_block( 391xfs_zero_last_block(
392 struct inode *ip, 392 xfs_inode_t *ip,
393 xfs_iocore_t *io,
394 xfs_fsize_t offset, 393 xfs_fsize_t offset,
395 xfs_fsize_t isize) 394 xfs_fsize_t isize)
396{ 395{
397 xfs_fileoff_t last_fsb; 396 xfs_fileoff_t last_fsb;
398 xfs_mount_t *mp = io->io_mount; 397 xfs_mount_t *mp = ip->i_mount;
399 int nimaps; 398 int nimaps;
400 int zero_offset; 399 int zero_offset;
401 int zero_len; 400 int zero_len;
402 int error = 0; 401 int error = 0;
403 xfs_bmbt_irec_t imap; 402 xfs_bmbt_irec_t imap;
404 403
405 ASSERT(ismrlocked(io->io_lock, MR_UPDATE) != 0); 404 ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE) != 0);
406 405
407 zero_offset = XFS_B_FSB_OFFSET(mp, isize); 406 zero_offset = XFS_B_FSB_OFFSET(mp, isize);
408 if (zero_offset == 0) { 407 if (zero_offset == 0) {
@@ -415,7 +414,7 @@ xfs_zero_last_block(
415 414
416 last_fsb = XFS_B_TO_FSBT(mp, isize); 415 last_fsb = XFS_B_TO_FSBT(mp, isize);
417 nimaps = 1; 416 nimaps = 1;
418 error = XFS_BMAPI(mp, NULL, io, last_fsb, 1, 0, NULL, 0, &imap, 417 error = xfs_bmapi(NULL, ip, last_fsb, 1, 0, NULL, 0, &imap,
419 &nimaps, NULL, NULL); 418 &nimaps, NULL, NULL);
420 if (error) { 419 if (error) {
421 return error; 420 return error;
@@ -433,14 +432,14 @@ xfs_zero_last_block(
433 * out sync. We need to drop the ilock while we do this so we 432 * out sync. We need to drop the ilock while we do this so we
434 * don't deadlock when the buffer cache calls back to us. 433 * don't deadlock when the buffer cache calls back to us.
435 */ 434 */
436 XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD); 435 xfs_iunlock(ip, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD);
437 436
438 zero_len = mp->m_sb.sb_blocksize - zero_offset; 437 zero_len = mp->m_sb.sb_blocksize - zero_offset;
439 if (isize + zero_len > offset) 438 if (isize + zero_len > offset)
440 zero_len = offset - isize; 439 zero_len = offset - isize;
441 error = xfs_iozero(ip, isize, zero_len); 440 error = xfs_iozero(ip, isize, zero_len);
442 441
443 XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); 442 xfs_ilock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
444 ASSERT(error >= 0); 443 ASSERT(error >= 0);
445 return error; 444 return error;
446} 445}
@@ -458,12 +457,11 @@ xfs_zero_last_block(
458 457
459int /* error (positive) */ 458int /* error (positive) */
460xfs_zero_eof( 459xfs_zero_eof(
461 bhv_vnode_t *vp, 460 xfs_inode_t *ip,
462 xfs_iocore_t *io,
463 xfs_off_t offset, /* starting I/O offset */ 461 xfs_off_t offset, /* starting I/O offset */
464 xfs_fsize_t isize) /* current inode size */ 462 xfs_fsize_t isize) /* current inode size */
465{ 463{
466 struct inode *ip = vn_to_inode(vp); 464 xfs_iocore_t *io = &ip->i_iocore;
467 xfs_fileoff_t start_zero_fsb; 465 xfs_fileoff_t start_zero_fsb;
468 xfs_fileoff_t end_zero_fsb; 466 xfs_fileoff_t end_zero_fsb;
469 xfs_fileoff_t zero_count_fsb; 467 xfs_fileoff_t zero_count_fsb;
@@ -483,7 +481,7 @@ xfs_zero_eof(
483 * First handle zeroing the block on which isize resides. 481 * First handle zeroing the block on which isize resides.
484 * We only zero a part of that block so it is handled specially. 482 * We only zero a part of that block so it is handled specially.
485 */ 483 */
486 error = xfs_zero_last_block(ip, io, offset, isize); 484 error = xfs_zero_last_block(ip, offset, isize);
487 if (error) { 485 if (error) {
488 ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); 486 ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
489 ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); 487 ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
@@ -514,7 +512,7 @@ xfs_zero_eof(
514 while (start_zero_fsb <= end_zero_fsb) { 512 while (start_zero_fsb <= end_zero_fsb) {
515 nimaps = 1; 513 nimaps = 1;
516 zero_count_fsb = end_zero_fsb - start_zero_fsb + 1; 514 zero_count_fsb = end_zero_fsb - start_zero_fsb + 1;
517 error = XFS_BMAPI(mp, NULL, io, start_zero_fsb, zero_count_fsb, 515 error = xfs_bmapi(NULL, ip, start_zero_fsb, zero_count_fsb,
518 0, NULL, 0, &imap, &nimaps, NULL, NULL); 516 0, NULL, 0, &imap, &nimaps, NULL, NULL);
519 if (error) { 517 if (error) {
520 ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); 518 ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
@@ -542,7 +540,7 @@ xfs_zero_eof(
542 * Drop the inode lock while we're doing the I/O. 540 * Drop the inode lock while we're doing the I/O.
543 * We'll still have the iolock to protect us. 541 * We'll still have the iolock to protect us.
544 */ 542 */
545 XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); 543 xfs_iunlock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
546 544
547 zero_off = XFS_FSB_TO_B(mp, start_zero_fsb); 545 zero_off = XFS_FSB_TO_B(mp, start_zero_fsb);
548 zero_len = XFS_FSB_TO_B(mp, imap.br_blockcount); 546 zero_len = XFS_FSB_TO_B(mp, imap.br_blockcount);
@@ -558,14 +556,13 @@ xfs_zero_eof(
558 start_zero_fsb = imap.br_startoff + imap.br_blockcount; 556 start_zero_fsb = imap.br_startoff + imap.br_blockcount;
559 ASSERT(start_zero_fsb <= (end_zero_fsb + 1)); 557 ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
560 558
561 XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); 559 xfs_ilock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
562 } 560 }
563 561
564 return 0; 562 return 0;
565 563
566out_lock: 564out_lock:
567 565 xfs_ilock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
568 XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
569 ASSERT(error >= 0); 566 ASSERT(error >= 0);
570 return error; 567 return error;
571} 568}
@@ -706,7 +703,7 @@ start:
706 */ 703 */
707 704
708 if (pos > xip->i_size) { 705 if (pos > xip->i_size) {
709 error = xfs_zero_eof(vp, io, pos, xip->i_size); 706 error = xfs_zero_eof(xip, pos, xip->i_size);
710 if (error) { 707 if (error) {
711 xfs_iunlock(xip, XFS_ILOCK_EXCL); 708 xfs_iunlock(xip, XFS_ILOCK_EXCL);
712 goto out_unlock_internal; 709 goto out_unlock_internal;
@@ -751,7 +748,7 @@ retry:
751 748
752 if (need_i_mutex) { 749 if (need_i_mutex) {
753 /* demote the lock now the cached pages are gone */ 750 /* demote the lock now the cached pages are gone */
754 XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL); 751 xfs_ilock_demote(xip, XFS_IOLOCK_EXCL);
755 mutex_unlock(&inode->i_mutex); 752 mutex_unlock(&inode->i_mutex);
756 753
757 iolock = XFS_IOLOCK_SHARED; 754 iolock = XFS_IOLOCK_SHARED;
@@ -894,25 +891,6 @@ xfs_bdstrat_cb(struct xfs_buf *bp)
894 } 891 }
895} 892}
896 893
897
898int
899xfs_bmap(
900 xfs_inode_t *ip,
901 xfs_off_t offset,
902 ssize_t count,
903 int flags,
904 xfs_iomap_t *iomapp,
905 int *niomaps)
906{
907 xfs_iocore_t *io = &ip->i_iocore;
908
909 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
910 ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) ==
911 ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0));
912
913 return xfs_iomap(io, offset, count, flags, iomapp, niomaps);
914}
915
916/* 894/*
917 * Wrapper around bdstrat so that we can stop data 895 * Wrapper around bdstrat so that we can stop data
918 * from going to disk in case we are shutting down the filesystem. 896 * from going to disk in case we are shutting down the filesystem.
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
index 4b7747a828d9..a982fbc6a7cf 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.h
+++ b/fs/xfs/linux-2.6/xfs_lrw.h
@@ -73,7 +73,6 @@ extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
73extern int xfs_bdstrat_cb(struct xfs_buf *); 73extern int xfs_bdstrat_cb(struct xfs_buf *);
74extern int xfs_dev_is_read_only(struct xfs_mount *, char *); 74extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
75 75
76extern int xfs_zero_eof(struct inode *, struct xfs_iocore *, xfs_off_t, 76extern int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t);
77 xfs_fsize_t);
78 77
79#endif /* __XFS_LRW_H__ */ 78#endif /* __XFS_LRW_H__ */
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 584f1ae85cd9..39c4480bbb9f 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -111,7 +111,7 @@ xfs_swapext(
111 goto error0; 111 goto error0;
112 } 112 }
113 113
114 error = XFS_SWAP_EXTENTS(mp, &ip->i_iocore, &tip->i_iocore, sxp); 114 error = xfs_swap_extents(ip, tip, sxp);
115 115
116 error0: 116 error0:
117 if (fp != NULL) 117 if (fp != NULL)
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index fc2055e64279..a6d35aee93b2 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1711,7 +1711,7 @@ xfs_itruncate_finish(
1711 * runs. 1711 * runs.
1712 */ 1712 */
1713 XFS_BMAP_INIT(&free_list, &first_block); 1713 XFS_BMAP_INIT(&free_list, &first_block);
1714 error = XFS_BUNMAPI(mp, ntp, &ip->i_iocore, 1714 error = xfs_bunmapi(ntp, ip,
1715 first_unmap_block, unmap_len, 1715 first_unmap_block, unmap_len,
1716 XFS_BMAPI_AFLAG(fork) | 1716 XFS_BMAPI_AFLAG(fork) |
1717 (sync ? 0 : XFS_BMAPI_ASYNC), 1717 (sync ? 0 : XFS_BMAPI_ASYNC),
@@ -1844,8 +1844,6 @@ xfs_igrow_start(
1844 xfs_fsize_t new_size, 1844 xfs_fsize_t new_size,
1845 cred_t *credp) 1845 cred_t *credp)
1846{ 1846{
1847 int error;
1848
1849 ASSERT(ismrlocked(&(ip->i_lock), MR_UPDATE) != 0); 1847 ASSERT(ismrlocked(&(ip->i_lock), MR_UPDATE) != 0);
1850 ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE) != 0); 1848 ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE) != 0);
1851 ASSERT(new_size > ip->i_size); 1849 ASSERT(new_size > ip->i_size);
@@ -1855,9 +1853,7 @@ xfs_igrow_start(
1855 * xfs_write_file() beyond the end of the file 1853 * xfs_write_file() beyond the end of the file
1856 * and any blocks between the old and new file sizes. 1854 * and any blocks between the old and new file sizes.
1857 */ 1855 */
1858 error = xfs_zero_eof(XFS_ITOV(ip), &ip->i_iocore, new_size, 1856 return xfs_zero_eof(ip, new_size, ip->i_size);
1859 ip->i_size);
1860 return error;
1861} 1857}
1862 1858
1863/* 1859/*
diff --git a/fs/xfs/xfs_iocore.c b/fs/xfs/xfs_iocore.c
index b27b5d5be841..336e27b39e13 100644
--- a/fs/xfs/xfs_iocore.c
+++ b/fs/xfs/xfs_iocore.c
@@ -47,46 +47,6 @@
47#include "xfs_trans_space.h" 47#include "xfs_trans_space.h"
48#include "xfs_iomap.h" 48#include "xfs_iomap.h"
49 49
50
51STATIC xfs_fsize_t
52xfs_size_fn(
53 xfs_inode_t *ip)
54{
55 return XFS_ISIZE(ip);
56}
57
58STATIC int
59xfs_ioinit(
60 struct xfs_mount *mp,
61 struct xfs_mount_args *mntargs,
62 int flags)
63{
64 return xfs_mountfs(mp, flags);
65}
66
67xfs_ioops_t xfs_iocore_xfs = {
68 .xfs_ioinit = (xfs_ioinit_t) xfs_ioinit,
69 .xfs_bmapi_func = (xfs_bmapi_t) xfs_bmapi,
70 .xfs_bunmapi_func = (xfs_bunmapi_t) xfs_bunmapi,
71 .xfs_bmap_eof_func = (xfs_bmap_eof_t) xfs_bmap_eof,
72 .xfs_iomap_write_direct =
73 (xfs_iomap_write_direct_t) xfs_iomap_write_direct,
74 .xfs_iomap_write_delay =
75 (xfs_iomap_write_delay_t) xfs_iomap_write_delay,
76 .xfs_iomap_write_allocate =
77 (xfs_iomap_write_allocate_t) xfs_iomap_write_allocate,
78 .xfs_iomap_write_unwritten =
79 (xfs_iomap_write_unwritten_t) xfs_iomap_write_unwritten,
80 .xfs_ilock = (xfs_lock_t) xfs_ilock,
81 .xfs_lck_map_shared = (xfs_lck_map_shared_t) xfs_ilock_map_shared,
82 .xfs_ilock_demote = (xfs_lock_demote_t) xfs_ilock_demote,
83 .xfs_ilock_nowait = (xfs_lock_nowait_t) xfs_ilock_nowait,
84 .xfs_unlock = (xfs_unlk_t) xfs_iunlock,
85 .xfs_size_func = (xfs_size_t) xfs_size_fn,
86 .xfs_iodone = (xfs_iodone_t) fs_noerr,
87 .xfs_swap_extents_func = (xfs_swap_extents_t) xfs_swap_extents,
88};
89
90void 50void
91xfs_iocore_inode_reinit( 51xfs_iocore_inode_reinit(
92 xfs_inode_t *ip) 52 xfs_inode_t *ip)
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 21ca62880514..4821b8563c41 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -53,11 +53,11 @@
53void 53void
54xfs_iomap_enter_trace( 54xfs_iomap_enter_trace(
55 int tag, 55 int tag,
56 xfs_iocore_t *io, 56 xfs_inode_t *ip,
57 xfs_off_t offset, 57 xfs_off_t offset,
58 ssize_t count) 58 ssize_t count)
59{ 59{
60 xfs_inode_t *ip = XFS_IO_INODE(io); 60 xfs_iocore_t *io = &ip->i_iocore;
61 61
62 if (!ip->i_rwtrace) 62 if (!ip->i_rwtrace)
63 return; 63 return;
@@ -84,15 +84,13 @@ xfs_iomap_enter_trace(
84void 84void
85xfs_iomap_map_trace( 85xfs_iomap_map_trace(
86 int tag, 86 int tag,
87 xfs_iocore_t *io, 87 xfs_inode_t *ip,
88 xfs_off_t offset, 88 xfs_off_t offset,
89 ssize_t count, 89 ssize_t count,
90 xfs_iomap_t *iomapp, 90 xfs_iomap_t *iomapp,
91 xfs_bmbt_irec_t *imapp, 91 xfs_bmbt_irec_t *imapp,
92 int flags) 92 int flags)
93{ 93{
94 xfs_inode_t *ip = XFS_IO_INODE(io);
95
96 if (!ip->i_rwtrace) 94 if (!ip->i_rwtrace)
97 return; 95 return;
98 96
@@ -126,7 +124,7 @@ xfs_iomap_map_trace(
126 124
127STATIC int 125STATIC int
128xfs_imap_to_bmap( 126xfs_imap_to_bmap(
129 xfs_iocore_t *io, 127 xfs_inode_t *ip,
130 xfs_off_t offset, 128 xfs_off_t offset,
131 xfs_bmbt_irec_t *imap, 129 xfs_bmbt_irec_t *imap,
132 xfs_iomap_t *iomapp, 130 xfs_iomap_t *iomapp,
@@ -134,11 +132,10 @@ xfs_imap_to_bmap(
134 int iomaps, /* Number of iomap entries */ 132 int iomaps, /* Number of iomap entries */
135 int flags) 133 int flags)
136{ 134{
137 xfs_mount_t *mp; 135 xfs_mount_t *mp = ip->i_mount;
138 int pbm; 136 int pbm;
139 xfs_fsblock_t start_block; 137 xfs_fsblock_t start_block;
140 138
141 mp = io->io_mount;
142 139
143 for (pbm = 0; imaps && pbm < iomaps; imaps--, iomapp++, imap++, pbm++) { 140 for (pbm = 0; imaps && pbm < iomaps; imaps--, iomapp++, imap++, pbm++) {
144 iomapp->iomap_offset = XFS_FSB_TO_B(mp, imap->br_startoff); 141 iomapp->iomap_offset = XFS_FSB_TO_B(mp, imap->br_startoff);
@@ -146,7 +143,7 @@ xfs_imap_to_bmap(
146 iomapp->iomap_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount); 143 iomapp->iomap_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount);
147 iomapp->iomap_flags = flags; 144 iomapp->iomap_flags = flags;
148 145
149 if (io->io_flags & XFS_IOCORE_RT) { 146 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) {
150 iomapp->iomap_flags |= IOMAP_REALTIME; 147 iomapp->iomap_flags |= IOMAP_REALTIME;
151 iomapp->iomap_target = mp->m_rtdev_targp; 148 iomapp->iomap_target = mp->m_rtdev_targp;
152 } else { 149 } else {
@@ -160,7 +157,7 @@ xfs_imap_to_bmap(
160 iomapp->iomap_bn = IOMAP_DADDR_NULL; 157 iomapp->iomap_bn = IOMAP_DADDR_NULL;
161 iomapp->iomap_flags |= IOMAP_DELAY; 158 iomapp->iomap_flags |= IOMAP_DELAY;
162 } else { 159 } else {
163 iomapp->iomap_bn = XFS_FSB_TO_DB_IO(io, start_block); 160 iomapp->iomap_bn = XFS_FSB_TO_DB(ip, start_block);
164 if (ISUNWRITTEN(imap)) 161 if (ISUNWRITTEN(imap))
165 iomapp->iomap_flags |= IOMAP_UNWRITTEN; 162 iomapp->iomap_flags |= IOMAP_UNWRITTEN;
166 } 163 }
@@ -172,14 +169,14 @@ xfs_imap_to_bmap(
172 169
173int 170int
174xfs_iomap( 171xfs_iomap(
175 xfs_iocore_t *io, 172 xfs_inode_t *ip,
176 xfs_off_t offset, 173 xfs_off_t offset,
177 ssize_t count, 174 ssize_t count,
178 int flags, 175 int flags,
179 xfs_iomap_t *iomapp, 176 xfs_iomap_t *iomapp,
180 int *niomaps) 177 int *niomaps)
181{ 178{
182 xfs_mount_t *mp = io->io_mount; 179 xfs_mount_t *mp = ip->i_mount;
183 xfs_fileoff_t offset_fsb, end_fsb; 180 xfs_fileoff_t offset_fsb, end_fsb;
184 int error = 0; 181 int error = 0;
185 int lockmode = 0; 182 int lockmode = 0;
@@ -188,32 +185,37 @@ xfs_iomap(
188 int bmapi_flags = 0; 185 int bmapi_flags = 0;
189 int iomap_flags = 0; 186 int iomap_flags = 0;
190 187
188 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
189 ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) ==
190 ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0));
191
191 if (XFS_FORCED_SHUTDOWN(mp)) 192 if (XFS_FORCED_SHUTDOWN(mp))
192 return XFS_ERROR(EIO); 193 return XFS_ERROR(EIO);
193 194
194 switch (flags & (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE)) { 195 switch (flags & (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE)) {
195 case BMAPI_READ: 196 case BMAPI_READ:
196 xfs_iomap_enter_trace(XFS_IOMAP_READ_ENTER, io, offset, count); 197 xfs_iomap_enter_trace(XFS_IOMAP_READ_ENTER, ip, offset, count);
197 lockmode = XFS_LCK_MAP_SHARED(mp, io); 198 lockmode = xfs_ilock_map_shared(ip);
198 bmapi_flags = XFS_BMAPI_ENTIRE; 199 bmapi_flags = XFS_BMAPI_ENTIRE;
199 break; 200 break;
200 case BMAPI_WRITE: 201 case BMAPI_WRITE:
201 xfs_iomap_enter_trace(XFS_IOMAP_WRITE_ENTER, io, offset, count); 202 xfs_iomap_enter_trace(XFS_IOMAP_WRITE_ENTER, ip, offset, count);
202 lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR; 203 lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR;
203 if (flags & BMAPI_IGNSTATE) 204 if (flags & BMAPI_IGNSTATE)
204 bmapi_flags |= XFS_BMAPI_IGSTATE|XFS_BMAPI_ENTIRE; 205 bmapi_flags |= XFS_BMAPI_IGSTATE|XFS_BMAPI_ENTIRE;
205 XFS_ILOCK(mp, io, lockmode); 206 xfs_ilock(ip, lockmode);
206 break; 207 break;
207 case BMAPI_ALLOCATE: 208 case BMAPI_ALLOCATE:
208 xfs_iomap_enter_trace(XFS_IOMAP_ALLOC_ENTER, io, offset, count); 209 xfs_iomap_enter_trace(XFS_IOMAP_ALLOC_ENTER, ip, offset, count);
209 lockmode = XFS_ILOCK_SHARED|XFS_EXTSIZE_RD; 210 lockmode = XFS_ILOCK_SHARED|XFS_EXTSIZE_RD;
210 bmapi_flags = XFS_BMAPI_ENTIRE; 211 bmapi_flags = XFS_BMAPI_ENTIRE;
212
211 /* Attempt non-blocking lock */ 213 /* Attempt non-blocking lock */
212 if (flags & BMAPI_TRYLOCK) { 214 if (flags & BMAPI_TRYLOCK) {
213 if (!XFS_ILOCK_NOWAIT(mp, io, lockmode)) 215 if (!xfs_ilock_nowait(ip, lockmode))
214 return XFS_ERROR(EAGAIN); 216 return XFS_ERROR(EAGAIN);
215 } else { 217 } else {
216 XFS_ILOCK(mp, io, lockmode); 218 xfs_ilock(ip, lockmode);
217 } 219 }
218 break; 220 break;
219 default: 221 default:
@@ -226,7 +228,7 @@ xfs_iomap(
226 end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count); 228 end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count);
227 offset_fsb = XFS_B_TO_FSBT(mp, offset); 229 offset_fsb = XFS_B_TO_FSBT(mp, offset);
228 230
229 error = XFS_BMAPI(mp, NULL, io, offset_fsb, 231 error = xfs_bmapi(NULL, ip, offset_fsb,
230 (xfs_filblks_t)(end_fsb - offset_fsb), 232 (xfs_filblks_t)(end_fsb - offset_fsb),
231 bmapi_flags, NULL, 0, &imap, 233 bmapi_flags, NULL, 0, &imap,
232 &nimaps, NULL, NULL); 234 &nimaps, NULL, NULL);
@@ -240,42 +242,42 @@ xfs_iomap(
240 if (nimaps && 242 if (nimaps &&
241 (imap.br_startblock != HOLESTARTBLOCK) && 243 (imap.br_startblock != HOLESTARTBLOCK) &&
242 (imap.br_startblock != DELAYSTARTBLOCK)) { 244 (imap.br_startblock != DELAYSTARTBLOCK)) {
243 xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, io, 245 xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, ip,
244 offset, count, iomapp, &imap, flags); 246 offset, count, iomapp, &imap, flags);
245 break; 247 break;
246 } 248 }
247 249
248 if (flags & (BMAPI_DIRECT|BMAPI_MMAP)) { 250 if (flags & (BMAPI_DIRECT|BMAPI_MMAP)) {
249 error = XFS_IOMAP_WRITE_DIRECT(mp, io, offset, 251 error = xfs_iomap_write_direct(ip, offset, count, flags,
250 count, flags, &imap, &nimaps, nimaps); 252 &imap, &nimaps, nimaps);
251 } else { 253 } else {
252 error = XFS_IOMAP_WRITE_DELAY(mp, io, offset, count, 254 error = xfs_iomap_write_delay(ip, offset, count, flags,
253 flags, &imap, &nimaps); 255 &imap, &nimaps);
254 } 256 }
255 if (!error) { 257 if (!error) {
256 xfs_iomap_map_trace(XFS_IOMAP_ALLOC_MAP, io, 258 xfs_iomap_map_trace(XFS_IOMAP_ALLOC_MAP, ip,
257 offset, count, iomapp, &imap, flags); 259 offset, count, iomapp, &imap, flags);
258 } 260 }
259 iomap_flags = IOMAP_NEW; 261 iomap_flags = IOMAP_NEW;
260 break; 262 break;
261 case BMAPI_ALLOCATE: 263 case BMAPI_ALLOCATE:
262 /* If we found an extent, return it */ 264 /* If we found an extent, return it */
263 XFS_IUNLOCK(mp, io, lockmode); 265 xfs_iunlock(ip, lockmode);
264 lockmode = 0; 266 lockmode = 0;
265 267
266 if (nimaps && !ISNULLSTARTBLOCK(imap.br_startblock)) { 268 if (nimaps && !ISNULLSTARTBLOCK(imap.br_startblock)) {
267 xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, io, 269 xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, ip,
268 offset, count, iomapp, &imap, flags); 270 offset, count, iomapp, &imap, flags);
269 break; 271 break;
270 } 272 }
271 273
272 error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count, 274 error = xfs_iomap_write_allocate(ip, offset, count,
273 &imap, &nimaps); 275 &imap, &nimaps);
274 break; 276 break;
275 } 277 }
276 278
277 if (nimaps) { 279 if (nimaps) {
278 *niomaps = xfs_imap_to_bmap(io, offset, &imap, 280 *niomaps = xfs_imap_to_bmap(ip, offset, &imap,
279 iomapp, nimaps, *niomaps, iomap_flags); 281 iomapp, nimaps, *niomaps, iomap_flags);
280 } else if (niomaps) { 282 } else if (niomaps) {
281 *niomaps = 0; 283 *niomaps = 0;
@@ -283,14 +285,15 @@ xfs_iomap(
283 285
284out: 286out:
285 if (lockmode) 287 if (lockmode)
286 XFS_IUNLOCK(mp, io, lockmode); 288 xfs_iunlock(ip, lockmode);
287 return XFS_ERROR(error); 289 return XFS_ERROR(error);
288} 290}
289 291
292
290STATIC int 293STATIC int
291xfs_iomap_eof_align_last_fsb( 294xfs_iomap_eof_align_last_fsb(
292 xfs_mount_t *mp, 295 xfs_mount_t *mp,
293 xfs_iocore_t *io, 296 xfs_inode_t *ip,
294 xfs_fsize_t isize, 297 xfs_fsize_t isize,
295 xfs_extlen_t extsize, 298 xfs_extlen_t extsize,
296 xfs_fileoff_t *last_fsb) 299 xfs_fileoff_t *last_fsb)
@@ -299,7 +302,7 @@ xfs_iomap_eof_align_last_fsb(
299 xfs_extlen_t align; 302 xfs_extlen_t align;
300 int eof, error; 303 int eof, error;
301 304
302 if (io->io_flags & XFS_IOCORE_RT) 305 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
303 ; 306 ;
304 /* 307 /*
305 * If mounted with the "-o swalloc" option, roundup the allocation 308 * If mounted with the "-o swalloc" option, roundup the allocation
@@ -330,7 +333,7 @@ xfs_iomap_eof_align_last_fsb(
330 } 333 }
331 334
332 if (new_last_fsb) { 335 if (new_last_fsb) {
333 error = XFS_BMAP_EOF(mp, io, new_last_fsb, XFS_DATA_FORK, &eof); 336 error = xfs_bmap_eof(ip, new_last_fsb, XFS_DATA_FORK, &eof);
334 if (error) 337 if (error)
335 return error; 338 return error;
336 if (eof) 339 if (eof)
@@ -435,7 +438,7 @@ xfs_iomap_write_direct(
435 offset_fsb = XFS_B_TO_FSBT(mp, offset); 438 offset_fsb = XFS_B_TO_FSBT(mp, offset);
436 last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count))); 439 last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count)));
437 if ((offset + count) > isize) { 440 if ((offset + count) > isize) {
438 error = xfs_iomap_eof_align_last_fsb(mp, io, isize, extsz, 441 error = xfs_iomap_eof_align_last_fsb(mp, ip, isize, extsz,
439 &last_fsb); 442 &last_fsb);
440 if (error) 443 if (error)
441 goto error_out; 444 goto error_out;
@@ -502,7 +505,7 @@ xfs_iomap_write_direct(
502 */ 505 */
503 XFS_BMAP_INIT(&free_list, &firstfsb); 506 XFS_BMAP_INIT(&free_list, &firstfsb);
504 nimaps = 1; 507 nimaps = 1;
505 error = XFS_BMAPI(mp, tp, io, offset_fsb, count_fsb, bmapi_flag, 508 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, bmapi_flag,
506 &firstfsb, 0, &imap, &nimaps, &free_list, NULL); 509 &firstfsb, 0, &imap, &nimaps, &free_list, NULL);
507 if (error) 510 if (error)
508 goto error0; 511 goto error0;
@@ -560,7 +563,7 @@ error_out:
560STATIC int 563STATIC int
561xfs_iomap_eof_want_preallocate( 564xfs_iomap_eof_want_preallocate(
562 xfs_mount_t *mp, 565 xfs_mount_t *mp,
563 xfs_iocore_t *io, 566 xfs_inode_t *ip,
564 xfs_fsize_t isize, 567 xfs_fsize_t isize,
565 xfs_off_t offset, 568 xfs_off_t offset,
566 size_t count, 569 size_t count,
@@ -587,7 +590,7 @@ xfs_iomap_eof_want_preallocate(
587 while (count_fsb > 0) { 590 while (count_fsb > 0) {
588 imaps = nimaps; 591 imaps = nimaps;
589 firstblock = NULLFSBLOCK; 592 firstblock = NULLFSBLOCK;
590 error = XFS_BMAPI(mp, NULL, io, start_fsb, count_fsb, 0, 593 error = xfs_bmapi(NULL, ip, start_fsb, count_fsb, 0,
591 &firstblock, 0, imap, &imaps, NULL, NULL); 594 &firstblock, 0, imap, &imaps, NULL, NULL);
592 if (error) 595 if (error)
593 return error; 596 return error;
@@ -644,7 +647,7 @@ retry:
644 if (io->io_new_size > isize) 647 if (io->io_new_size > isize)
645 isize = io->io_new_size; 648 isize = io->io_new_size;
646 649
647 error = xfs_iomap_eof_want_preallocate(mp, io, isize, offset, count, 650 error = xfs_iomap_eof_want_preallocate(mp, ip, isize, offset, count,
648 ioflag, imap, XFS_WRITE_IMAPS, &prealloc); 651 ioflag, imap, XFS_WRITE_IMAPS, &prealloc);
649 if (error) 652 if (error)
650 return error; 653 return error;
@@ -658,7 +661,7 @@ retry:
658 } 661 }
659 662
660 if (prealloc || extsz) { 663 if (prealloc || extsz) {
661 error = xfs_iomap_eof_align_last_fsb(mp, io, isize, extsz, 664 error = xfs_iomap_eof_align_last_fsb(mp, ip, isize, extsz,
662 &last_fsb); 665 &last_fsb);
663 if (error) 666 if (error)
664 return error; 667 return error;
@@ -666,7 +669,7 @@ retry:
666 669
667 nimaps = XFS_WRITE_IMAPS; 670 nimaps = XFS_WRITE_IMAPS;
668 firstblock = NULLFSBLOCK; 671 firstblock = NULLFSBLOCK;
669 error = XFS_BMAPI(mp, NULL, io, offset_fsb, 672 error = xfs_bmapi(NULL, ip, offset_fsb,
670 (xfs_filblks_t)(last_fsb - offset_fsb), 673 (xfs_filblks_t)(last_fsb - offset_fsb),
671 XFS_BMAPI_DELAY | XFS_BMAPI_WRITE | 674 XFS_BMAPI_DELAY | XFS_BMAPI_WRITE |
672 XFS_BMAPI_ENTIRE, &firstblock, 1, imap, 675 XFS_BMAPI_ENTIRE, &firstblock, 1, imap,
@@ -680,7 +683,7 @@ retry:
680 */ 683 */
681 if (nimaps == 0) { 684 if (nimaps == 0) {
682 xfs_iomap_enter_trace(XFS_IOMAP_WRITE_NOSPACE, 685 xfs_iomap_enter_trace(XFS_IOMAP_WRITE_NOSPACE,
683 io, offset, count); 686 ip, offset, count);
684 if (xfs_flush_space(ip, &fsynced, &ioflag)) 687 if (xfs_flush_space(ip, &fsynced, &ioflag))
685 return XFS_ERROR(ENOSPC); 688 return XFS_ERROR(ENOSPC);
686 689
@@ -788,7 +791,7 @@ xfs_iomap_write_allocate(
788 } 791 }
789 792
790 /* Go get the actual blocks */ 793 /* Go get the actual blocks */
791 error = XFS_BMAPI(mp, tp, io, map_start_fsb, count_fsb, 794 error = xfs_bmapi(tp, ip, map_start_fsb, count_fsb,
792 XFS_BMAPI_WRITE, &first_block, 1, 795 XFS_BMAPI_WRITE, &first_block, 1,
793 imap, &nimaps, &free_list, NULL); 796 imap, &nimaps, &free_list, NULL);
794 if (error) 797 if (error)
@@ -860,8 +863,7 @@ xfs_iomap_write_unwritten(
860 int committed; 863 int committed;
861 int error; 864 int error;
862 865
863 xfs_iomap_enter_trace(XFS_IOMAP_UNWRITTEN, 866 xfs_iomap_enter_trace(XFS_IOMAP_UNWRITTEN, ip, offset, count);
864 &ip->i_iocore, offset, count);
865 867
866 offset_fsb = XFS_B_TO_FSBT(mp, offset); 868 offset_fsb = XFS_B_TO_FSBT(mp, offset);
867 count_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count); 869 count_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count);
@@ -895,7 +897,7 @@ xfs_iomap_write_unwritten(
895 */ 897 */
896 XFS_BMAP_INIT(&free_list, &firstfsb); 898 XFS_BMAP_INIT(&free_list, &firstfsb);
897 nimaps = 1; 899 nimaps = 1;
898 error = XFS_BMAPI(mp, tp, io, offset_fsb, count_fsb, 900 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb,
899 XFS_BMAPI_WRITE|XFS_BMAPI_CONVERT, &firstfsb, 901 XFS_BMAPI_WRITE|XFS_BMAPI_CONVERT, &firstfsb,
900 1, &imap, &nimaps, &free_list, NULL); 902 1, &imap, &nimaps, &free_list, NULL);
901 if (error) 903 if (error)
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
index c989e835bca5..ee1a0c134cc2 100644
--- a/fs/xfs/xfs_iomap.h
+++ b/fs/xfs/xfs_iomap.h
@@ -71,11 +71,10 @@ typedef struct xfs_iomap {
71 iomap_flags_t iomap_flags; 71 iomap_flags_t iomap_flags;
72} xfs_iomap_t; 72} xfs_iomap_t;
73 73
74struct xfs_iocore;
75struct xfs_inode; 74struct xfs_inode;
76struct xfs_bmbt_irec; 75struct xfs_bmbt_irec;
77 76
78extern int xfs_iomap(struct xfs_iocore *, xfs_off_t, ssize_t, int, 77extern int xfs_iomap(struct xfs_inode *, xfs_off_t, ssize_t, int,
79 struct xfs_iomap *, int *); 78 struct xfs_iomap *, int *);
80extern int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t, 79extern int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t,
81 int, struct xfs_bmbt_irec *, int *, int); 80 int, struct xfs_bmbt_irec *, int *, int);
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index ebdb76da527c..f395f594e20c 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1255,7 +1255,6 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr)
1255#if defined(DEBUG) || defined(INDUCE_IO_ERROR) 1255#if defined(DEBUG) || defined(INDUCE_IO_ERROR)
1256 xfs_errortag_clearall(mp, 0); 1256 xfs_errortag_clearall(mp, 0);
1257#endif 1257#endif
1258 XFS_IODONE(mp);
1259 xfs_mount_free(mp); 1258 xfs_mount_free(mp);
1260 return 0; 1259 return 0;
1261} 1260}
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index c618f7cb5f0e..f7b761f09ab4 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -196,105 +196,6 @@ typedef struct xfs_qmops {
196#define XFS_QM_QUOTACTL(mp, cmd, id, addr) \ 196#define XFS_QM_QUOTACTL(mp, cmd, id, addr) \
197 (*(mp)->m_qm_ops->xfs_quotactl)(mp, cmd, id, addr) 197 (*(mp)->m_qm_ops->xfs_quotactl)(mp, cmd, id, addr)
198 198
199
200/*
201 * Prototypes and functions for I/O core modularization.
202 */
203
204typedef int (*xfs_ioinit_t)(struct xfs_mount *,
205 struct xfs_mount_args *, int);
206typedef int (*xfs_bmapi_t)(struct xfs_trans *, void *,
207 xfs_fileoff_t, xfs_filblks_t, int,
208 xfs_fsblock_t *, xfs_extlen_t,
209 struct xfs_bmbt_irec *, int *,
210 struct xfs_bmap_free *, struct xfs_extdelta *);
211typedef int (*xfs_bunmapi_t)(struct xfs_trans *,
212 void *, xfs_fileoff_t,
213 xfs_filblks_t, int, xfs_extnum_t,
214 xfs_fsblock_t *, struct xfs_bmap_free *,
215 struct xfs_extdelta *, int *);
216typedef int (*xfs_bmap_eof_t)(void *, xfs_fileoff_t, int, int *);
217typedef int (*xfs_iomap_write_direct_t)(
218 void *, xfs_off_t, size_t, int,
219 struct xfs_bmbt_irec *, int *, int);
220typedef int (*xfs_iomap_write_delay_t)(
221 void *, xfs_off_t, size_t, int,
222 struct xfs_bmbt_irec *, int *);
223typedef int (*xfs_iomap_write_allocate_t)(
224 void *, xfs_off_t, size_t,
225 struct xfs_bmbt_irec *, int *);
226typedef int (*xfs_iomap_write_unwritten_t)(
227 void *, xfs_off_t, size_t);
228typedef uint (*xfs_lck_map_shared_t)(void *);
229typedef void (*xfs_lock_t)(void *, uint);
230typedef void (*xfs_lock_demote_t)(void *, uint);
231typedef int (*xfs_lock_nowait_t)(void *, uint);
232typedef void (*xfs_unlk_t)(void *, unsigned int);
233typedef xfs_fsize_t (*xfs_size_t)(void *);
234typedef xfs_fsize_t (*xfs_iodone_t)(struct xfs_mount *);
235typedef int (*xfs_swap_extents_t)(void *, void *,
236 struct xfs_swapext*);
237
238typedef struct xfs_ioops {
239 xfs_ioinit_t xfs_ioinit;
240 xfs_bmapi_t xfs_bmapi_func;
241 xfs_bunmapi_t xfs_bunmapi_func;
242 xfs_bmap_eof_t xfs_bmap_eof_func;
243 xfs_iomap_write_direct_t xfs_iomap_write_direct;
244 xfs_iomap_write_delay_t xfs_iomap_write_delay;
245 xfs_iomap_write_allocate_t xfs_iomap_write_allocate;
246 xfs_iomap_write_unwritten_t xfs_iomap_write_unwritten;
247 xfs_lock_t xfs_ilock;
248 xfs_lck_map_shared_t xfs_lck_map_shared;
249 xfs_lock_demote_t xfs_ilock_demote;
250 xfs_lock_nowait_t xfs_ilock_nowait;
251 xfs_unlk_t xfs_unlock;
252 xfs_size_t xfs_size_func;
253 xfs_iodone_t xfs_iodone;
254 xfs_swap_extents_t xfs_swap_extents_func;
255} xfs_ioops_t;
256
257#define XFS_IOINIT(mp, args, flags) \
258 (*(mp)->m_io_ops.xfs_ioinit)(mp, args, flags)
259#define XFS_BMAPI(mp, trans,io,bno,len,f,first,tot,mval,nmap,flist,delta) \
260 (*(mp)->m_io_ops.xfs_bmapi_func) \
261 (trans,(io)->io_obj,bno,len,f,first,tot,mval,nmap,flist,delta)
262#define XFS_BUNMAPI(mp, trans,io,bno,len,f,nexts,first,flist,delta,done) \
263 (*(mp)->m_io_ops.xfs_bunmapi_func) \
264 (trans,(io)->io_obj,bno,len,f,nexts,first,flist,delta,done)
265#define XFS_BMAP_EOF(mp, io, endoff, whichfork, eof) \
266 (*(mp)->m_io_ops.xfs_bmap_eof_func) \
267 ((io)->io_obj, endoff, whichfork, eof)
268#define XFS_IOMAP_WRITE_DIRECT(mp, io, offset, count, flags, mval, nmap, found)\
269 (*(mp)->m_io_ops.xfs_iomap_write_direct) \
270 ((io)->io_obj, offset, count, flags, mval, nmap, found)
271#define XFS_IOMAP_WRITE_DELAY(mp, io, offset, count, flags, mval, nmap) \
272 (*(mp)->m_io_ops.xfs_iomap_write_delay) \
273 ((io)->io_obj, offset, count, flags, mval, nmap)
274#define XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count, mval, nmap) \
275 (*(mp)->m_io_ops.xfs_iomap_write_allocate) \
276 ((io)->io_obj, offset, count, mval, nmap)
277#define XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count) \
278 (*(mp)->m_io_ops.xfs_iomap_write_unwritten) \
279 ((io)->io_obj, offset, count)
280#define XFS_LCK_MAP_SHARED(mp, io) \
281 (*(mp)->m_io_ops.xfs_lck_map_shared)((io)->io_obj)
282#define XFS_ILOCK(mp, io, mode) \
283 (*(mp)->m_io_ops.xfs_ilock)((io)->io_obj, mode)
284#define XFS_ILOCK_NOWAIT(mp, io, mode) \
285 (*(mp)->m_io_ops.xfs_ilock_nowait)((io)->io_obj, mode)
286#define XFS_IUNLOCK(mp, io, mode) \
287 (*(mp)->m_io_ops.xfs_unlock)((io)->io_obj, mode)
288#define XFS_ILOCK_DEMOTE(mp, io, mode) \
289 (*(mp)->m_io_ops.xfs_ilock_demote)((io)->io_obj, mode)
290#define XFS_SIZE(mp, io) \
291 (*(mp)->m_io_ops.xfs_size_func)((io)->io_obj)
292#define XFS_IODONE(mp) \
293 (*(mp)->m_io_ops.xfs_iodone)(mp)
294#define XFS_SWAP_EXTENTS(mp, io, tio, sxp) \
295 (*(mp)->m_io_ops.xfs_swap_extents_func) \
296 ((io)->io_obj, (tio)->io_obj, sxp)
297
298#ifdef HAVE_PERCPU_SB 199#ifdef HAVE_PERCPU_SB
299 200
300/* 201/*
@@ -423,7 +324,6 @@ typedef struct xfs_mount {
423 * hash table */ 324 * hash table */
424 struct xfs_dmops *m_dm_ops; /* vector of DMI ops */ 325 struct xfs_dmops *m_dm_ops; /* vector of DMI ops */
425 struct xfs_qmops *m_qm_ops; /* vector of XQM ops */ 326 struct xfs_qmops *m_qm_ops; /* vector of XQM ops */
426 struct xfs_ioops m_io_ops; /* vector of I/O ops */
427 atomic_t m_active_trans; /* number trans frozen */ 327 atomic_t m_active_trans; /* number trans frozen */
428#ifdef HAVE_PERCPU_SB 328#ifdef HAVE_PERCPU_SB
429 xfs_icsb_cnts_t *m_sb_cnts; /* per-cpu superblock counters */ 329 xfs_icsb_cnts_t *m_sb_cnts; /* per-cpu superblock counters */
@@ -646,7 +546,6 @@ extern int xfs_qmops_get(struct xfs_mount *, struct xfs_mount_args *);
646extern void xfs_qmops_put(struct xfs_mount *); 546extern void xfs_qmops_put(struct xfs_mount *);
647 547
648extern struct xfs_dmops xfs_dmcore_xfs; 548extern struct xfs_dmops xfs_dmcore_xfs;
649extern struct xfs_ioops xfs_iocore_xfs;
650 549
651extern int xfs_init(void); 550extern int xfs_init(void);
652extern void xfs_cleanup(void); 551extern void xfs_cleanup(void);
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index 0f237f9f0c3a..57be2f7b034c 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -449,8 +449,6 @@ xfs_mount(
449 if (error) 449 if (error)
450 return error; 450 return error;
451 451
452 mp->m_io_ops = xfs_iocore_xfs;
453
454 if (args->flags & XFSMNT_QUIET) 452 if (args->flags & XFSMNT_QUIET)
455 flags |= XFS_MFSI_QUIET; 453 flags |= XFS_MFSI_QUIET;
456 454
@@ -544,7 +542,7 @@ xfs_mount(
544 if ((error = xfs_filestream_mount(mp))) 542 if ((error = xfs_filestream_mount(mp)))
545 goto error2; 543 goto error2;
546 544
547 error = XFS_IOINIT(mp, args, flags); 545 error = xfs_mountfs(mp, flags);
548 if (error) 546 if (error)
549 goto error2; 547 goto error2;
550 548
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index daba528bcc33..a5cd2dc4c80a 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1187,7 +1187,7 @@ xfs_free_eofblocks(
1187 1187
1188 nimaps = 1; 1188 nimaps = 1;
1189 xfs_ilock(ip, XFS_ILOCK_SHARED); 1189 xfs_ilock(ip, XFS_ILOCK_SHARED);
1190 error = XFS_BMAPI(mp, NULL, &ip->i_iocore, end_fsb, map_len, 0, 1190 error = xfs_bmapi(NULL, ip, end_fsb, map_len, 0,
1191 NULL, 0, &imap, &nimaps, NULL, NULL); 1191 NULL, 0, &imap, &nimaps, NULL, NULL);
1192 xfs_iunlock(ip, XFS_ILOCK_SHARED); 1192 xfs_iunlock(ip, XFS_ILOCK_SHARED);
1193 1193
@@ -3972,7 +3972,7 @@ retry:
3972 * Issue the xfs_bmapi() call to allocate the blocks 3972 * Issue the xfs_bmapi() call to allocate the blocks
3973 */ 3973 */
3974 XFS_BMAP_INIT(&free_list, &firstfsb); 3974 XFS_BMAP_INIT(&free_list, &firstfsb);
3975 error = XFS_BMAPI(mp, tp, &ip->i_iocore, startoffset_fsb, 3975 error = xfs_bmapi(tp, ip, startoffset_fsb,
3976 allocatesize_fsb, bmapi_flag, 3976 allocatesize_fsb, bmapi_flag,
3977 &firstfsb, 0, imapp, &nimaps, 3977 &firstfsb, 0, imapp, &nimaps,
3978 &free_list, NULL); 3978 &free_list, NULL);
@@ -4054,7 +4054,7 @@ xfs_zero_remaining_bytes(
4054 for (offset = startoff; offset <= endoff; offset = lastoffset + 1) { 4054 for (offset = startoff; offset <= endoff; offset = lastoffset + 1) {
4055 offset_fsb = XFS_B_TO_FSBT(mp, offset); 4055 offset_fsb = XFS_B_TO_FSBT(mp, offset);
4056 nimap = 1; 4056 nimap = 1;
4057 error = XFS_BMAPI(mp, NULL, &ip->i_iocore, offset_fsb, 1, 0, 4057 error = xfs_bmapi(NULL, ip, offset_fsb, 1, 0,
4058 NULL, 0, &imap, &nimap, NULL, NULL); 4058 NULL, 0, &imap, &nimap, NULL, NULL);
4059 if (error || nimap < 1) 4059 if (error || nimap < 1)
4060 break; 4060 break;
@@ -4189,7 +4189,7 @@ xfs_free_file_space(
4189 */ 4189 */
4190 if (rt && !XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb)) { 4190 if (rt && !XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb)) {
4191 nimap = 1; 4191 nimap = 1;
4192 error = XFS_BMAPI(mp, NULL, &ip->i_iocore, startoffset_fsb, 4192 error = xfs_bmapi(NULL, ip, startoffset_fsb,
4193 1, 0, NULL, 0, &imap, &nimap, NULL, NULL); 4193 1, 0, NULL, 0, &imap, &nimap, NULL, NULL);
4194 if (error) 4194 if (error)
4195 goto out_unlock_iolock; 4195 goto out_unlock_iolock;
@@ -4204,7 +4204,7 @@ xfs_free_file_space(
4204 startoffset_fsb += mp->m_sb.sb_rextsize - mod; 4204 startoffset_fsb += mp->m_sb.sb_rextsize - mod;
4205 } 4205 }
4206 nimap = 1; 4206 nimap = 1;
4207 error = XFS_BMAPI(mp, NULL, &ip->i_iocore, endoffset_fsb - 1, 4207 error = xfs_bmapi(NULL, ip, endoffset_fsb - 1,
4208 1, 0, NULL, 0, &imap, &nimap, NULL, NULL); 4208 1, 0, NULL, 0, &imap, &nimap, NULL, NULL);
4209 if (error) 4209 if (error)
4210 goto out_unlock_iolock; 4210 goto out_unlock_iolock;
@@ -4280,7 +4280,7 @@ xfs_free_file_space(
4280 * issue the bunmapi() call to free the blocks 4280 * issue the bunmapi() call to free the blocks
4281 */ 4281 */
4282 XFS_BMAP_INIT(&free_list, &firstfsb); 4282 XFS_BMAP_INIT(&free_list, &firstfsb);
4283 error = XFS_BUNMAPI(mp, tp, &ip->i_iocore, startoffset_fsb, 4283 error = xfs_bunmapi(tp, ip, startoffset_fsb,
4284 endoffset_fsb - startoffset_fsb, 4284 endoffset_fsb - startoffset_fsb,
4285 0, 2, &firstfsb, &free_list, NULL, &done); 4285 0, 2, &firstfsb, &free_list, NULL, &done);
4286 if (error) { 4286 if (error) {