aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-08-28 02:12:30 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-10-15 02:54:29 -0400
commit993386c19afa53fa54d00c7721e56ba820b3400d (patch)
tree1715fdeb9cc5ea99466e179b54e84b168fd5e127 /fs/xfs/linux-2.6
parentb93bd20cd59eb7ec172f95d08b100fea688d8bcf (diff)
[XFS] decontaminate vnode operations from behavior details
All vnode ops now take struct xfs_inode pointers and the behaviour related glue is split out into methods of it's own. This required fixing xfs_create/mkdir/symlink to not mess with the inode pointer but rather use a separate boolean for error handling. Thanks to Dave Chinner for that fix. SGI-PV: 969608 SGI-Modid: xfs-linux-melb:xfs-kern:29492a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r--fs/xfs/linux-2.6/xfs_fs_subr.c48
-rw-r--r--fs/xfs/linux-2.6/xfs_fs_subr.h4
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c48
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c64
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.h14
6 files changed, 77 insertions, 103 deletions
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/linux-2.6/xfs_fs_subr.c
index 2eb87cd082af..e2897912fec7 100644
--- a/fs/xfs/linux-2.6/xfs_fs_subr.c
+++ b/fs/xfs/linux-2.6/xfs_fs_subr.c
@@ -16,66 +16,80 @@
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_vnodeops.h"
20
21/*
22 * The following six includes are needed so that we can include
23 * xfs_inode.h. What a mess..
24 */
25#include "xfs_bmap_btree.h"
26#include "xfs_inum.h"
27#include "xfs_dir2.h"
28#include "xfs_dir2_sf.h"
29#include "xfs_attr_sf.h"
30#include "xfs_dinode.h"
31
32#include "xfs_inode.h"
19 33
20int fs_noerr(void) { return 0; } 34int fs_noerr(void) { return 0; }
21int fs_nosys(void) { return ENOSYS; } 35int fs_nosys(void) { return ENOSYS; }
22void fs_noval(void) { return; } 36void fs_noval(void) { return; }
23 37
24void 38void
25fs_tosspages( 39xfs_tosspages(
26 bhv_desc_t *bdp, 40 xfs_inode_t *ip,
27 xfs_off_t first, 41 xfs_off_t first,
28 xfs_off_t last, 42 xfs_off_t last,
29 int fiopt) 43 int fiopt)
30{ 44{
31 bhv_vnode_t *vp = BHV_TO_VNODE(bdp); 45 bhv_vnode_t *vp = XFS_ITOV(ip);
32 struct inode *ip = vn_to_inode(vp); 46 struct inode *inode = vn_to_inode(vp);
33 47
34 if (VN_CACHED(vp)) 48 if (VN_CACHED(vp))
35 truncate_inode_pages(ip->i_mapping, first); 49 truncate_inode_pages(inode->i_mapping, first);
36} 50}
37 51
38int 52int
39fs_flushinval_pages( 53xfs_flushinval_pages(
40 bhv_desc_t *bdp, 54 xfs_inode_t *ip,
41 xfs_off_t first, 55 xfs_off_t first,
42 xfs_off_t last, 56 xfs_off_t last,
43 int fiopt) 57 int fiopt)
44{ 58{
45 bhv_vnode_t *vp = BHV_TO_VNODE(bdp); 59 bhv_vnode_t *vp = XFS_ITOV(ip);
46 struct inode *ip = vn_to_inode(vp); 60 struct inode *inode = vn_to_inode(vp);
47 int ret = 0; 61 int ret = 0;
48 62
49 if (VN_CACHED(vp)) { 63 if (VN_CACHED(vp)) {
50 if (VN_TRUNC(vp)) 64 if (VN_TRUNC(vp))
51 VUNTRUNCATE(vp); 65 VUNTRUNCATE(vp);
52 ret = filemap_write_and_wait(ip->i_mapping); 66 ret = filemap_write_and_wait(inode->i_mapping);
53 if (!ret) 67 if (!ret)
54 truncate_inode_pages(ip->i_mapping, first); 68 truncate_inode_pages(inode->i_mapping, first);
55 } 69 }
56 return ret; 70 return ret;
57} 71}
58 72
59int 73int
60fs_flush_pages( 74xfs_flush_pages(
61 bhv_desc_t *bdp, 75 xfs_inode_t *ip,
62 xfs_off_t first, 76 xfs_off_t first,
63 xfs_off_t last, 77 xfs_off_t last,
64 uint64_t flags, 78 uint64_t flags,
65 int fiopt) 79 int fiopt)
66{ 80{
67 bhv_vnode_t *vp = BHV_TO_VNODE(bdp); 81 bhv_vnode_t *vp = XFS_ITOV(ip);
68 struct inode *ip = vn_to_inode(vp); 82 struct inode *inode = vn_to_inode(vp);
69 int ret = 0; 83 int ret = 0;
70 int ret2; 84 int ret2;
71 85
72 if (VN_DIRTY(vp)) { 86 if (VN_DIRTY(vp)) {
73 if (VN_TRUNC(vp)) 87 if (VN_TRUNC(vp))
74 VUNTRUNCATE(vp); 88 VUNTRUNCATE(vp);
75 ret = filemap_fdatawrite(ip->i_mapping); 89 ret = filemap_fdatawrite(inode->i_mapping);
76 if (flags & XFS_B_ASYNC) 90 if (flags & XFS_B_ASYNC)
77 return ret; 91 return ret;
78 ret2 = filemap_fdatawait(ip->i_mapping); 92 ret2 = filemap_fdatawait(inode->i_mapping);
79 if (!ret) 93 if (!ret)
80 ret = ret2; 94 ret = ret2;
81 } 95 }
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.h b/fs/xfs/linux-2.6/xfs_fs_subr.h
index c1b53118a303..82bb19b2599e 100644
--- a/fs/xfs/linux-2.6/xfs_fs_subr.h
+++ b/fs/xfs/linux-2.6/xfs_fs_subr.h
@@ -18,12 +18,8 @@
18#ifndef __XFS_FS_SUBR_H__ 18#ifndef __XFS_FS_SUBR_H__
19#define __XFS_FS_SUBR_H__ 19#define __XFS_FS_SUBR_H__
20 20
21struct cred;
22extern int fs_noerr(void); 21extern int fs_noerr(void);
23extern int fs_nosys(void); 22extern int fs_nosys(void);
24extern void fs_noval(void); 23extern void fs_noval(void);
25extern void fs_tosspages(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
26extern int fs_flushinval_pages(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
27extern int fs_flush_pages(bhv_desc_t *, xfs_off_t, xfs_off_t, uint64_t, int);
28 24
29#endif /* __XFS_FS_SUBR_H__ */ 25#endif /* __XFS_FS_SUBR_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 47cfde6cfae2..f36902fa714d 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -47,6 +47,7 @@
47#include "xfs_utils.h" 47#include "xfs_utils.h"
48#include "xfs_dfrag.h" 48#include "xfs_dfrag.h"
49#include "xfs_fsops.h" 49#include "xfs_fsops.h"
50#include "xfs_vnodeops.h"
50 51
51#include <linux/capability.h> 52#include <linux/capability.h>
52#include <linux/dcache.h> 53#include <linux/dcache.h>
@@ -436,7 +437,6 @@ xfs_fssetdm_by_handle(
436 struct fsdmidata fsd; 437 struct fsdmidata fsd;
437 xfs_fsop_setdm_handlereq_t dmhreq; 438 xfs_fsop_setdm_handlereq_t dmhreq;
438 struct inode *inode; 439 struct inode *inode;
439 bhv_desc_t *bdp;
440 bhv_vnode_t *vp; 440 bhv_vnode_t *vp;
441 441
442 if (!capable(CAP_MKNOD)) 442 if (!capable(CAP_MKNOD))
@@ -458,8 +458,8 @@ xfs_fssetdm_by_handle(
458 return -XFS_ERROR(EFAULT); 458 return -XFS_ERROR(EFAULT);
459 } 459 }
460 460
461 bdp = bhv_base_unlocked(VN_BHV_HEAD(vp)); 461 error = xfs_set_dmattrs(xfs_vtoi(vp),
462 error = xfs_set_dmattrs(bdp, fsd.fsd_dmevmask, fsd.fsd_dmstate, NULL); 462 fsd.fsd_dmevmask, fsd.fsd_dmstate);
463 463
464 VN_RELE(vp); 464 VN_RELE(vp);
465 if (error) 465 if (error)
@@ -676,7 +676,7 @@ xfs_attrmulti_by_handle(
676 676
677STATIC int 677STATIC int
678xfs_ioc_space( 678xfs_ioc_space(
679 bhv_desc_t *bdp, 679 struct xfs_inode *ip,
680 struct inode *inode, 680 struct inode *inode,
681 struct file *filp, 681 struct file *filp,
682 int flags, 682 int flags,
@@ -709,37 +709,31 @@ xfs_ioc_xattr(
709 709
710STATIC int 710STATIC int
711xfs_ioc_getbmap( 711xfs_ioc_getbmap(
712 bhv_desc_t *bdp, 712 struct xfs_inode *ip,
713 int flags, 713 int flags,
714 unsigned int cmd, 714 unsigned int cmd,
715 void __user *arg); 715 void __user *arg);
716 716
717STATIC int 717STATIC int
718xfs_ioc_getbmapx( 718xfs_ioc_getbmapx(
719 bhv_desc_t *bdp, 719 struct xfs_inode *ip,
720 void __user *arg); 720 void __user *arg);
721 721
722int 722int
723xfs_ioctl( 723xfs_ioctl(
724 bhv_desc_t *bdp, 724 xfs_inode_t *ip,
725 struct inode *inode,
726 struct file *filp, 725 struct file *filp,
727 int ioflags, 726 int ioflags,
728 unsigned int cmd, 727 unsigned int cmd,
729 void __user *arg) 728 void __user *arg)
730{ 729{
730 struct inode *inode = filp->f_path.dentry->d_inode;
731 bhv_vnode_t *vp = vn_from_inode(inode);
732 xfs_mount_t *mp = ip->i_mount;
731 int error; 733 int error;
732 bhv_vnode_t *vp;
733 xfs_inode_t *ip;
734 xfs_mount_t *mp;
735
736 vp = vn_from_inode(inode);
737 734
738 vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address); 735 vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address);
739 736
740 ip = XFS_BHVTOI(bdp);
741 mp = ip->i_mount;
742
743 switch (cmd) { 737 switch (cmd) {
744 738
745 case XFS_IOC_ALLOCSP: 739 case XFS_IOC_ALLOCSP:
@@ -758,7 +752,7 @@ xfs_ioctl(
758 !capable(CAP_SYS_ADMIN)) 752 !capable(CAP_SYS_ADMIN))
759 return -EPERM; 753 return -EPERM;
760 754
761 return xfs_ioc_space(bdp, inode, filp, ioflags, cmd, arg); 755 return xfs_ioc_space(ip, inode, filp, ioflags, cmd, arg);
762 756
763 case XFS_IOC_DIOINFO: { 757 case XFS_IOC_DIOINFO: {
764 struct dioattr da; 758 struct dioattr da;
@@ -801,17 +795,17 @@ xfs_ioctl(
801 if (copy_from_user(&dmi, arg, sizeof(dmi))) 795 if (copy_from_user(&dmi, arg, sizeof(dmi)))
802 return -XFS_ERROR(EFAULT); 796 return -XFS_ERROR(EFAULT);
803 797
804 error = xfs_set_dmattrs(bdp, dmi.fsd_dmevmask, dmi.fsd_dmstate, 798 error = xfs_set_dmattrs(ip, dmi.fsd_dmevmask,
805 NULL); 799 dmi.fsd_dmstate);
806 return -error; 800 return -error;
807 } 801 }
808 802
809 case XFS_IOC_GETBMAP: 803 case XFS_IOC_GETBMAP:
810 case XFS_IOC_GETBMAPA: 804 case XFS_IOC_GETBMAPA:
811 return xfs_ioc_getbmap(bdp, ioflags, cmd, arg); 805 return xfs_ioc_getbmap(ip, ioflags, cmd, arg);
812 806
813 case XFS_IOC_GETBMAPX: 807 case XFS_IOC_GETBMAPX:
814 return xfs_ioc_getbmapx(bdp, arg); 808 return xfs_ioc_getbmapx(ip, arg);
815 809
816 case XFS_IOC_FD_TO_HANDLE: 810 case XFS_IOC_FD_TO_HANDLE:
817 case XFS_IOC_PATH_TO_HANDLE: 811 case XFS_IOC_PATH_TO_HANDLE:
@@ -981,7 +975,7 @@ xfs_ioctl(
981 975
982STATIC int 976STATIC int
983xfs_ioc_space( 977xfs_ioc_space(
984 bhv_desc_t *bdp, 978 struct xfs_inode *ip,
985 struct inode *inode, 979 struct inode *inode,
986 struct file *filp, 980 struct file *filp,
987 int ioflags, 981 int ioflags,
@@ -1009,7 +1003,7 @@ xfs_ioc_space(
1009 if (ioflags & IO_INVIS) 1003 if (ioflags & IO_INVIS)
1010 attr_flags |= ATTR_DMI; 1004 attr_flags |= ATTR_DMI;
1011 1005
1012 error = xfs_change_file_space(bdp, cmd, &bf, filp->f_pos, 1006 error = xfs_change_file_space(ip, cmd, &bf, filp->f_pos,
1013 NULL, attr_flags); 1007 NULL, attr_flags);
1014 return -error; 1008 return -error;
1015} 1009}
@@ -1295,7 +1289,7 @@ xfs_ioc_xattr(
1295 1289
1296STATIC int 1290STATIC int
1297xfs_ioc_getbmap( 1291xfs_ioc_getbmap(
1298 bhv_desc_t *bdp, 1292 struct xfs_inode *ip,
1299 int ioflags, 1293 int ioflags,
1300 unsigned int cmd, 1294 unsigned int cmd,
1301 void __user *arg) 1295 void __user *arg)
@@ -1314,7 +1308,7 @@ xfs_ioc_getbmap(
1314 if (ioflags & IO_INVIS) 1308 if (ioflags & IO_INVIS)
1315 iflags |= BMV_IF_NO_DMAPI_READ; 1309 iflags |= BMV_IF_NO_DMAPI_READ;
1316 1310
1317 error = xfs_getbmap(bdp, &bm, (struct getbmap __user *)arg+1, iflags); 1311 error = xfs_getbmap(ip, &bm, (struct getbmap __user *)arg+1, iflags);
1318 if (error) 1312 if (error)
1319 return -error; 1313 return -error;
1320 1314
@@ -1325,7 +1319,7 @@ xfs_ioc_getbmap(
1325 1319
1326STATIC int 1320STATIC int
1327xfs_ioc_getbmapx( 1321xfs_ioc_getbmapx(
1328 bhv_desc_t *bdp, 1322 struct xfs_inode *ip,
1329 void __user *arg) 1323 void __user *arg)
1330{ 1324{
1331 struct getbmapx bmx; 1325 struct getbmapx bmx;
@@ -1352,7 +1346,7 @@ xfs_ioc_getbmapx(
1352 1346
1353 iflags |= BMV_IF_EXTENDED; 1347 iflags |= BMV_IF_EXTENDED;
1354 1348
1355 error = xfs_getbmap(bdp, &bm, (struct getbmapx __user *)arg+1, iflags); 1349 error = xfs_getbmap(ip, &bm, (struct getbmapx __user *)arg+1, iflags);
1356 if (error) 1350 if (error)
1357 return -error; 1351 return -error;
1358 1352
diff --git a/fs/xfs/linux-2.6/xfs_iops.h b/fs/xfs/linux-2.6/xfs_iops.h
index 95a69398fce0..ce9852e9be00 100644
--- a/fs/xfs/linux-2.6/xfs_iops.h
+++ b/fs/xfs/linux-2.6/xfs_iops.h
@@ -26,8 +26,6 @@ extern const struct file_operations xfs_file_operations;
26extern const struct file_operations xfs_dir_file_operations; 26extern const struct file_operations xfs_dir_file_operations;
27extern const struct file_operations xfs_invis_file_operations; 27extern const struct file_operations xfs_invis_file_operations;
28 28
29extern int xfs_ioctl(struct bhv_desc *, struct inode *, struct file *,
30 int, unsigned int, void __user *);
31 29
32struct xfs_inode; 30struct xfs_inode;
33extern void xfs_ichgtime(struct xfs_inode *, int); 31extern void xfs_ichgtime(struct xfs_inode *, int);
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index 94941da6c4da..2dc979e3e969 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -48,6 +48,7 @@
48#include "xfs_buf_item.h" 48#include "xfs_buf_item.h"
49#include "xfs_utils.h" 49#include "xfs_utils.h"
50#include "xfs_iomap.h" 50#include "xfs_iomap.h"
51#include "xfs_vnodeops.h"
51 52
52#include <linux/capability.h> 53#include <linux/capability.h>
53#include <linux/writeback.h> 54#include <linux/writeback.h>
@@ -180,27 +181,22 @@ unlock:
180 181
181ssize_t /* bytes read, or (-) error */ 182ssize_t /* bytes read, or (-) error */
182xfs_read( 183xfs_read(
183 bhv_desc_t *bdp, 184 xfs_inode_t *ip,
184 struct kiocb *iocb, 185 struct kiocb *iocb,
185 const struct iovec *iovp, 186 const struct iovec *iovp,
186 unsigned int segs, 187 unsigned int segs,
187 loff_t *offset, 188 loff_t *offset,
188 int ioflags, 189 int ioflags)
189 cred_t *credp)
190{ 190{
191 struct file *file = iocb->ki_filp; 191 struct file *file = iocb->ki_filp;
192 struct inode *inode = file->f_mapping->host; 192 struct inode *inode = file->f_mapping->host;
193 bhv_vnode_t *vp = XFS_ITOV(ip);
194 xfs_mount_t *mp = ip->i_mount;
193 size_t size = 0; 195 size_t size = 0;
194 ssize_t ret = 0; 196 ssize_t ret = 0;
195 xfs_fsize_t n; 197 xfs_fsize_t n;
196 xfs_inode_t *ip;
197 xfs_mount_t *mp;
198 bhv_vnode_t *vp;
199 unsigned long seg; 198 unsigned long seg;
200 199
201 ip = XFS_BHVTOI(bdp);
202 vp = BHV_TO_VNODE(bdp);
203 mp = ip->i_mount;
204 200
205 XFS_STATS_INC(xs_read_calls); 201 XFS_STATS_INC(xs_read_calls);
206 202
@@ -249,8 +245,7 @@ xfs_read(
249 bhv_vrwlock_t locktype = VRWLOCK_READ; 245 bhv_vrwlock_t locktype = VRWLOCK_READ;
250 int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags); 246 int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
251 247
252 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, 248 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *offset, size,
253 BHV_TO_VNODE(bdp), *offset, size,
254 dmflags, &locktype); 249 dmflags, &locktype);
255 if (ret) { 250 if (ret) {
256 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 251 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
@@ -287,16 +282,15 @@ xfs_read(
287 282
288ssize_t 283ssize_t
289xfs_splice_read( 284xfs_splice_read(
290 bhv_desc_t *bdp, 285 xfs_inode_t *ip,
291 struct file *infilp, 286 struct file *infilp,
292 loff_t *ppos, 287 loff_t *ppos,
293 struct pipe_inode_info *pipe, 288 struct pipe_inode_info *pipe,
294 size_t count, 289 size_t count,
295 int flags, 290 int flags,
296 int ioflags, 291 int ioflags)
297 cred_t *credp)
298{ 292{
299 xfs_inode_t *ip = XFS_BHVTOI(bdp); 293 bhv_vnode_t *vp = XFS_ITOV(ip);
300 xfs_mount_t *mp = ip->i_mount; 294 xfs_mount_t *mp = ip->i_mount;
301 ssize_t ret; 295 ssize_t ret;
302 296
@@ -310,8 +304,7 @@ xfs_splice_read(
310 bhv_vrwlock_t locktype = VRWLOCK_READ; 304 bhv_vrwlock_t locktype = VRWLOCK_READ;
311 int error; 305 int error;
312 306
313 error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), 307 error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *ppos, count,
314 *ppos, count,
315 FILP_DELAY_FLAG(infilp), &locktype); 308 FILP_DELAY_FLAG(infilp), &locktype);
316 if (error) { 309 if (error) {
317 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 310 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
@@ -330,16 +323,15 @@ xfs_splice_read(
330 323
331ssize_t 324ssize_t
332xfs_splice_write( 325xfs_splice_write(
333 bhv_desc_t *bdp, 326 xfs_inode_t *ip,
334 struct pipe_inode_info *pipe, 327 struct pipe_inode_info *pipe,
335 struct file *outfilp, 328 struct file *outfilp,
336 loff_t *ppos, 329 loff_t *ppos,
337 size_t count, 330 size_t count,
338 int flags, 331 int flags,
339 int ioflags, 332 int ioflags)
340 cred_t *credp)
341{ 333{
342 xfs_inode_t *ip = XFS_BHVTOI(bdp); 334 bhv_vnode_t *vp = XFS_ITOV(ip);
343 xfs_mount_t *mp = ip->i_mount; 335 xfs_mount_t *mp = ip->i_mount;
344 xfs_iocore_t *io = &ip->i_iocore; 336 xfs_iocore_t *io = &ip->i_iocore;
345 ssize_t ret; 337 ssize_t ret;
@@ -356,8 +348,7 @@ xfs_splice_write(
356 bhv_vrwlock_t locktype = VRWLOCK_WRITE; 348 bhv_vrwlock_t locktype = VRWLOCK_WRITE;
357 int error; 349 int error;
358 350
359 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, BHV_TO_VNODE(bdp), 351 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, *ppos, count,
360 *ppos, count,
361 FILP_DELAY_FLAG(outfilp), &locktype); 352 FILP_DELAY_FLAG(outfilp), &locktype);
362 if (error) { 353 if (error) {
363 xfs_iunlock(ip, XFS_IOLOCK_EXCL); 354 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
@@ -591,24 +582,22 @@ out_lock:
591 582
592ssize_t /* bytes written, or (-) error */ 583ssize_t /* bytes written, or (-) error */
593xfs_write( 584xfs_write(
594 bhv_desc_t *bdp, 585 struct xfs_inode *xip,
595 struct kiocb *iocb, 586 struct kiocb *iocb,
596 const struct iovec *iovp, 587 const struct iovec *iovp,
597 unsigned int nsegs, 588 unsigned int nsegs,
598 loff_t *offset, 589 loff_t *offset,
599 int ioflags, 590 int ioflags)
600 cred_t *credp)
601{ 591{
602 struct file *file = iocb->ki_filp; 592 struct file *file = iocb->ki_filp;
603 struct address_space *mapping = file->f_mapping; 593 struct address_space *mapping = file->f_mapping;
604 struct inode *inode = mapping->host; 594 struct inode *inode = mapping->host;
595 bhv_vnode_t *vp = XFS_ITOV(xip);
605 unsigned long segs = nsegs; 596 unsigned long segs = nsegs;
606 xfs_inode_t *xip;
607 xfs_mount_t *mp; 597 xfs_mount_t *mp;
608 ssize_t ret = 0, error = 0; 598 ssize_t ret = 0, error = 0;
609 xfs_fsize_t isize, new_size; 599 xfs_fsize_t isize, new_size;
610 xfs_iocore_t *io; 600 xfs_iocore_t *io;
611 bhv_vnode_t *vp;
612 int iolock; 601 int iolock;
613 int eventsent = 0; 602 int eventsent = 0;
614 bhv_vrwlock_t locktype; 603 bhv_vrwlock_t locktype;
@@ -618,9 +607,6 @@ xfs_write(
618 607
619 XFS_STATS_INC(xs_write_calls); 608 XFS_STATS_INC(xs_write_calls);
620 609
621 vp = BHV_TO_VNODE(bdp);
622 xip = XFS_BHVTOI(bdp);
623
624 error = generic_segment_checks(iovp, &segs, &ocount, VERIFY_READ); 610 error = generic_segment_checks(iovp, &segs, &ocount, VERIFY_READ);
625 if (error) 611 if (error)
626 return error; 612 return error;
@@ -730,7 +716,7 @@ start:
730 */ 716 */
731 717
732 if (pos > xip->i_size) { 718 if (pos > xip->i_size) {
733 error = xfs_zero_eof(BHV_TO_VNODE(bdp), io, pos, xip->i_size); 719 error = xfs_zero_eof(vp, io, pos, xip->i_size);
734 if (error) { 720 if (error) {
735 xfs_iunlock(xip, XFS_ILOCK_EXCL); 721 xfs_iunlock(xip, XFS_ILOCK_EXCL);
736 goto out_unlock_internal; 722 goto out_unlock_internal;
@@ -815,7 +801,7 @@ retry:
815 801
816 if (ret == -ENOSPC && 802 if (ret == -ENOSPC &&
817 DM_EVENT_ENABLED(xip, DM_EVENT_NOSPACE) && !(ioflags & IO_INVIS)) { 803 DM_EVENT_ENABLED(xip, DM_EVENT_NOSPACE) && !(ioflags & IO_INVIS)) {
818 xfs_rwunlock(bdp, locktype); 804 xfs_rwunlock(xip, locktype);
819 if (need_i_mutex) 805 if (need_i_mutex)
820 mutex_unlock(&inode->i_mutex); 806 mutex_unlock(&inode->i_mutex);
821 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, 807 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,
@@ -823,7 +809,7 @@ retry:
823 0, 0, 0); /* Delay flag intentionally unused */ 809 0, 0, 0); /* Delay flag intentionally unused */
824 if (need_i_mutex) 810 if (need_i_mutex)
825 mutex_lock(&inode->i_mutex); 811 mutex_lock(&inode->i_mutex);
826 xfs_rwlock(bdp, locktype); 812 xfs_rwlock(xip, locktype);
827 if (error) 813 if (error)
828 goto out_unlock_internal; 814 goto out_unlock_internal;
829 pos = xip->i_size; 815 pos = xip->i_size;
@@ -854,7 +840,7 @@ retry:
854 if (error) 840 if (error)
855 goto out_unlock_internal; 841 goto out_unlock_internal;
856 842
857 xfs_rwunlock(bdp, locktype); 843 xfs_rwunlock(xip, locktype);
858 if (need_i_mutex) 844 if (need_i_mutex)
859 mutex_unlock(&inode->i_mutex); 845 mutex_unlock(&inode->i_mutex);
860 846
@@ -863,7 +849,7 @@ retry:
863 error = -ret; 849 error = -ret;
864 if (need_i_mutex) 850 if (need_i_mutex)
865 mutex_lock(&inode->i_mutex); 851 mutex_lock(&inode->i_mutex);
866 xfs_rwlock(bdp, locktype); 852 xfs_rwlock(xip, locktype);
867 } 853 }
868 854
869 out_unlock_internal: 855 out_unlock_internal:
@@ -881,7 +867,7 @@ retry:
881 xip->i_d.di_size = xip->i_size; 867 xip->i_d.di_size = xip->i_size;
882 xfs_iunlock(xip, XFS_ILOCK_EXCL); 868 xfs_iunlock(xip, XFS_ILOCK_EXCL);
883 } 869 }
884 xfs_rwunlock(bdp, locktype); 870 xfs_rwunlock(xip, locktype);
885 out_unlock_mutex: 871 out_unlock_mutex:
886 if (need_i_mutex) 872 if (need_i_mutex)
887 mutex_unlock(&inode->i_mutex); 873 mutex_unlock(&inode->i_mutex);
@@ -920,14 +906,14 @@ xfs_bdstrat_cb(struct xfs_buf *bp)
920 906
921 907
922int 908int
923xfs_bmap(bhv_desc_t *bdp, 909xfs_bmap(
910 xfs_inode_t *ip,
924 xfs_off_t offset, 911 xfs_off_t offset,
925 ssize_t count, 912 ssize_t count,
926 int flags, 913 int flags,
927 xfs_iomap_t *iomapp, 914 xfs_iomap_t *iomapp,
928 int *niomaps) 915 int *niomaps)
929{ 916{
930 xfs_inode_t *ip = XFS_BHVTOI(bdp);
931 xfs_iocore_t *io = &ip->i_iocore; 917 xfs_iocore_t *io = &ip->i_iocore;
932 918
933 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); 919 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
index 1ad29bae5415..fa7cefa86a82 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.h
+++ b/fs/xfs/linux-2.6/xfs_lrw.h
@@ -71,25 +71,11 @@ extern void xfs_inval_cached_trace(struct xfs_iocore *,
71#define xfs_inval_cached_trace(io, offset, len, first, last) 71#define xfs_inval_cached_trace(io, offset, len, first, last)
72#endif 72#endif
73 73
74extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
75 struct xfs_iomap *, int *);
76extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *); 74extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
77extern int xfs_bdstrat_cb(struct xfs_buf *); 75extern int xfs_bdstrat_cb(struct xfs_buf *);
78extern int xfs_dev_is_read_only(struct xfs_mount *, char *); 76extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
79 77
80extern int xfs_zero_eof(struct bhv_vnode *, struct xfs_iocore *, xfs_off_t, 78extern int xfs_zero_eof(struct bhv_vnode *, struct xfs_iocore *, xfs_off_t,
81 xfs_fsize_t); 79 xfs_fsize_t);
82extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
83 const struct iovec *, unsigned int,
84 loff_t *, int, struct cred *);
85extern ssize_t xfs_write(struct bhv_desc *, struct kiocb *,
86 const struct iovec *, unsigned int,
87 loff_t *, int, struct cred *);
88extern ssize_t xfs_splice_read(struct bhv_desc *, struct file *, loff_t *,
89 struct pipe_inode_info *, size_t, int, int,
90 struct cred *);
91extern ssize_t xfs_splice_write(struct bhv_desc *, struct pipe_inode_info *,
92 struct file *, loff_t *, size_t, int, int,
93 struct cred *);
94 80
95#endif /* __XFS_LRW_H__ */ 81#endif /* __XFS_LRW_H__ */