aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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
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')
-rw-r--r--fs/xfs/Makefile-linux-2.61
-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
-rw-r--r--fs/xfs/xfs_attr.c40
-rw-r--r--fs/xfs/xfs_attr.h4
-rw-r--r--fs/xfs/xfs_bmap.c6
-rw-r--r--fs/xfs/xfs_bmap.h2
-rw-r--r--fs/xfs/xfs_dir2.c6
-rw-r--r--fs/xfs/xfs_dir2.h2
-rw-r--r--fs/xfs/xfs_rename.c18
-rw-r--r--fs/xfs/xfs_rw.h8
-rw-r--r--fs/xfs/xfs_utils.c9
-rw-r--r--fs/xfs/xfs_utils.h4
-rw-r--r--fs/xfs/xfs_vnodeops.c427
-rw-r--r--fs/xfs/xfs_vnodeops.h86
-rw-r--r--fs/xfs/xfs_vnodeops_bhv.c438
20 files changed, 765 insertions, 466 deletions
diff --git a/fs/xfs/Makefile-linux-2.6 b/fs/xfs/Makefile-linux-2.6
index 6d48a5ed38f3..8ed1f0475778 100644
--- a/fs/xfs/Makefile-linux-2.6
+++ b/fs/xfs/Makefile-linux-2.6
@@ -89,6 +89,7 @@ xfs-y += xfs_alloc.o \
89 xfs_utils.o \ 89 xfs_utils.o \
90 xfs_vfsops.o \ 90 xfs_vfsops.o \
91 xfs_vnodeops.o \ 91 xfs_vnodeops.o \
92 xfs_vnodeops_bhv.o \
92 xfs_rw.o \ 93 xfs_rw.o \
93 xfs_dmops.o \ 94 xfs_dmops.o \
94 xfs_qmops.o 95 xfs_qmops.o
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__ */
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index 7ce44a7b88a2..1a10bffc7755 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -156,10 +156,14 @@ xfs_attr_fetch(xfs_inode_t *ip, const char *name, int namelen,
156} 156}
157 157
158int 158int
159xfs_attr_get(bhv_desc_t *bdp, const char *name, char *value, int *valuelenp, 159xfs_attr_get(
160 int flags, struct cred *cred) 160 xfs_inode_t *ip,
161 const char *name,
162 char *value,
163 int *valuelenp,
164 int flags,
165 cred_t *cred)
161{ 166{
162 xfs_inode_t *ip = XFS_BHVTOI(bdp);
163 int error, namelen; 167 int error, namelen;
164 168
165 XFS_STATS_INC(xs_attr_get); 169 XFS_STATS_INC(xs_attr_get);
@@ -417,10 +421,13 @@ out:
417} 421}
418 422
419int 423int
420xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int flags, 424xfs_attr_set(
421 struct cred *cred) 425 xfs_inode_t *dp,
426 const char *name,
427 char *value,
428 int valuelen,
429 int flags)
422{ 430{
423 xfs_inode_t *dp;
424 int namelen; 431 int namelen;
425 432
426 namelen = strlen(name); 433 namelen = strlen(name);
@@ -429,7 +436,6 @@ xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int f
429 436
430 XFS_STATS_INC(xs_attr_set); 437 XFS_STATS_INC(xs_attr_set);
431 438
432 dp = XFS_BHVTOI(bdp);
433 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 439 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
434 return (EIO); 440 return (EIO);
435 441
@@ -563,10 +569,12 @@ out:
563} 569}
564 570
565int 571int
566xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) 572xfs_attr_remove(
573 xfs_inode_t *dp,
574 const char *name,
575 int flags)
567{ 576{
568 xfs_inode_t *dp; 577 int namelen;
569 int namelen;
570 578
571 namelen = strlen(name); 579 namelen = strlen(name);
572 if (namelen >= MAXNAMELEN) 580 if (namelen >= MAXNAMELEN)
@@ -574,7 +582,6 @@ xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred)
574 582
575 XFS_STATS_INC(xs_attr_remove); 583 XFS_STATS_INC(xs_attr_remove);
576 584
577 dp = XFS_BHVTOI(bdp);
578 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 585 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
579 return (EIO); 586 return (EIO);
580 587
@@ -702,11 +709,14 @@ xfs_attr_kern_list_sizes(xfs_attr_list_context_t *context, attrnames_t *namesp,
702 * success. 709 * success.
703 */ 710 */
704int 711int
705xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags, 712xfs_attr_list(
706 attrlist_cursor_kern_t *cursor, struct cred *cred) 713 xfs_inode_t *dp,
714 char *buffer,
715 int bufsize,
716 int flags,
717 attrlist_cursor_kern_t *cursor)
707{ 718{
708 xfs_attr_list_context_t context; 719 xfs_attr_list_context_t context;
709 xfs_inode_t *dp;
710 int error; 720 int error;
711 721
712 XFS_STATS_INC(xs_attr_list); 722 XFS_STATS_INC(xs_attr_list);
@@ -731,7 +741,7 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags,
731 /* 741 /*
732 * Initialize the output buffer. 742 * Initialize the output buffer.
733 */ 743 */
734 context.dp = dp = XFS_BHVTOI(bdp); 744 context.dp = dp;
735 context.cursor = cursor; 745 context.cursor = cursor;
736 context.count = 0; 746 context.count = 0;
737 context.dupcnt = 0; 747 context.dupcnt = 0;
diff --git a/fs/xfs/xfs_attr.h b/fs/xfs/xfs_attr.h
index 783977d3ea71..47c9ab1eae0b 100644
--- a/fs/xfs/xfs_attr.h
+++ b/fs/xfs/xfs_attr.h
@@ -159,12 +159,8 @@ struct xfs_da_args;
159/* 159/*
160 * Overall external interface routines. 160 * Overall external interface routines.
161 */ 161 */
162int xfs_attr_get(bhv_desc_t *, const char *, char *, int *, int, struct cred *);
163int xfs_attr_set(bhv_desc_t *, const char *, char *, int, int, struct cred *);
164int xfs_attr_set_int(struct xfs_inode *, const char *, int, char *, int, int); 162int xfs_attr_set_int(struct xfs_inode *, const char *, int, char *, int, int);
165int xfs_attr_remove(bhv_desc_t *, const char *, int, struct cred *);
166int xfs_attr_remove_int(struct xfs_inode *, const char *, int, int); 163int xfs_attr_remove_int(struct xfs_inode *, const char *, int, int);
167int xfs_attr_list(bhv_desc_t *, char *, int, int, struct attrlist_cursor_kern *, struct cred *);
168int xfs_attr_list_int(struct xfs_attr_list_context *); 164int xfs_attr_list_int(struct xfs_attr_list_context *);
169int xfs_attr_inactive(struct xfs_inode *dp); 165int xfs_attr_inactive(struct xfs_inode *dp);
170 166
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index ea4eab14a603..16b97db4f8aa 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -5764,7 +5764,7 @@ xfs_getbmapx_fix_eof_hole(
5764 */ 5764 */
5765int /* error code */ 5765int /* error code */
5766xfs_getbmap( 5766xfs_getbmap(
5767 bhv_desc_t *bdp, /* XFS behavior descriptor*/ 5767 xfs_inode_t *ip,
5768 struct getbmap *bmv, /* user bmap structure */ 5768 struct getbmap *bmv, /* user bmap structure */
5769 void __user *ap, /* pointer to user's array */ 5769 void __user *ap, /* pointer to user's array */
5770 int interface) /* interface flags */ 5770 int interface) /* interface flags */
@@ -5773,7 +5773,6 @@ xfs_getbmap(
5773 int error; /* return value */ 5773 int error; /* return value */
5774 __int64_t fixlen; /* length for -1 case */ 5774 __int64_t fixlen; /* length for -1 case */
5775 int i; /* extent number */ 5775 int i; /* extent number */
5776 xfs_inode_t *ip; /* xfs incore inode pointer */
5777 bhv_vnode_t *vp; /* corresponding vnode */ 5776 bhv_vnode_t *vp; /* corresponding vnode */
5778 int lock; /* lock state */ 5777 int lock; /* lock state */
5779 xfs_bmbt_irec_t *map; /* buffer for user's data */ 5778 xfs_bmbt_irec_t *map; /* buffer for user's data */
@@ -5791,8 +5790,7 @@ xfs_getbmap(
5791 int bmapi_flags; /* flags for xfs_bmapi */ 5790 int bmapi_flags; /* flags for xfs_bmapi */
5792 __int32_t oflags; /* getbmapx bmv_oflags field */ 5791 __int32_t oflags; /* getbmapx bmv_oflags field */
5793 5792
5794 vp = BHV_TO_VNODE(bdp); 5793 vp = XFS_ITOV(ip);
5795 ip = XFS_BHVTOI(bdp);
5796 mp = ip->i_mount; 5794 mp = ip->i_mount;
5797 5795
5798 whichfork = interface & BMV_IF_ATTRFORK ? XFS_ATTR_FORK : XFS_DATA_FORK; 5796 whichfork = interface & BMV_IF_ATTRFORK ? XFS_ATTR_FORK : XFS_DATA_FORK;
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
index a69ef30809fb..68267d75ff19 100644
--- a/fs/xfs/xfs_bmap.h
+++ b/fs/xfs/xfs_bmap.h
@@ -335,7 +335,7 @@ xfs_bunmapi(
335 */ 335 */
336int /* error code */ 336int /* error code */
337xfs_getbmap( 337xfs_getbmap(
338 bhv_desc_t *bdp, /* XFS behavior descriptor*/ 338 xfs_inode_t *ip,
339 struct getbmap *bmv, /* user bmap structure */ 339 struct getbmap *bmv, /* user bmap structure */
340 void __user *ap, /* pointer to user's array */ 340 void __user *ap, /* pointer to user's array */
341 int iflags); /* interface flags */ 341 int iflags); /* interface flags */
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
index c2d2bef26cbd..12001bf0d0cb 100644
--- a/fs/xfs/xfs_dir2.c
+++ b/fs/xfs/xfs_dir2.c
@@ -292,18 +292,16 @@ xfs_dir_removename(
292 */ 292 */
293int 293int
294xfs_readdir( 294xfs_readdir(
295 bhv_desc_t *dir_bdp, 295 xfs_inode_t *dp,
296 void *dirent, 296 void *dirent,
297 size_t bufsize, 297 size_t bufsize,
298 xfs_off_t *offset, 298 xfs_off_t *offset,
299 filldir_t filldir) 299 filldir_t filldir)
300{ 300{
301 xfs_inode_t *dp = XFS_BHVTOI(dir_bdp);
302 int rval; /* return value */ 301 int rval; /* return value */
303 int v; /* type-checking value */ 302 int v; /* type-checking value */
304 303
305 vn_trace_entry(BHV_TO_VNODE(dir_bdp), __FUNCTION__, 304 vn_trace_entry(XFS_ITOV(dp), __FUNCTION__, (inst_t *)__return_address);
306 (inst_t *)__return_address);
307 305
308 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 306 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
309 return XFS_ERROR(EIO); 307 return XFS_ERROR(EIO);
diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h
index fa5a533a3427..b265197e74cf 100644
--- a/fs/xfs/xfs_dir2.h
+++ b/fs/xfs/xfs_dir2.h
@@ -84,8 +84,6 @@ extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
84extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp, 84extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,
85 char *name, int namelen); 85 char *name, int namelen);
86extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino); 86extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
87extern int xfs_readdir(bhv_desc_t *dir_bdp, void *dirent, size_t bufsize,
88 xfs_off_t *offset, filldir_t filldir);
89 87
90/* 88/*
91 * Utility routines for v2 directories. 89 * Utility routines for v2 directories.
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c
index 187318e8d259..b62b8771afcf 100644
--- a/fs/xfs/xfs_rename.c
+++ b/fs/xfs/xfs_rename.c
@@ -129,8 +129,7 @@ xfs_lock_for_rename(
129 lock_mode = xfs_ilock_map_shared(dp2); 129 lock_mode = xfs_ilock_map_shared(dp2);
130 } 130 }
131 131
132 error = xfs_dir_lookup_int(XFS_ITOBHV(dp2), lock_mode, 132 error = xfs_dir_lookup_int(dp2, lock_mode, vname2, &inum2, &ip2);
133 vname2, &inum2, &ip2);
134 if (error == ENOENT) { /* target does not need to exist. */ 133 if (error == ENOENT) { /* target does not need to exist. */
135 inum2 = 0; 134 inum2 = 0;
136 } else if (error) { 135 } else if (error) {
@@ -222,15 +221,15 @@ xfs_lock_for_rename(
222 */ 221 */
223int 222int
224xfs_rename( 223xfs_rename(
225 bhv_desc_t *src_dir_bdp, 224 xfs_inode_t *src_dp,
226 bhv_vname_t *src_vname, 225 bhv_vname_t *src_vname,
227 bhv_vnode_t *target_dir_vp, 226 bhv_vnode_t *target_dir_vp,
228 bhv_vname_t *target_vname, 227 bhv_vname_t *target_vname)
229 cred_t *credp)
230{ 228{
229 bhv_vnode_t *src_dir_vp = XFS_ITOV(src_dp);
231 xfs_trans_t *tp; 230 xfs_trans_t *tp;
232 xfs_inode_t *src_dp, *target_dp, *src_ip, *target_ip; 231 xfs_inode_t *target_dp, *src_ip, *target_ip;
233 xfs_mount_t *mp; 232 xfs_mount_t *mp = src_dp->i_mount;
234 int new_parent; /* moving to a new dir */ 233 int new_parent; /* moving to a new dir */
235 int src_is_directory; /* src_name is a directory */ 234 int src_is_directory; /* src_name is a directory */
236 int error; 235 int error;
@@ -240,7 +239,6 @@ xfs_rename(
240 int committed; 239 int committed;
241 xfs_inode_t *inodes[4]; 240 xfs_inode_t *inodes[4];
242 int target_ip_dropped = 0; /* dropped target_ip link? */ 241 int target_ip_dropped = 0; /* dropped target_ip link? */
243 bhv_vnode_t *src_dir_vp;
244 int spaceres; 242 int spaceres;
245 int target_link_zero = 0; 243 int target_link_zero = 0;
246 int num_inodes; 244 int num_inodes;
@@ -249,7 +247,6 @@ xfs_rename(
249 int src_namelen = VNAMELEN(src_vname); 247 int src_namelen = VNAMELEN(src_vname);
250 int target_namelen = VNAMELEN(target_vname); 248 int target_namelen = VNAMELEN(target_vname);
251 249
252 src_dir_vp = BHV_TO_VNODE(src_dir_bdp);
253 vn_trace_entry(src_dir_vp, "xfs_rename", (inst_t *)__return_address); 250 vn_trace_entry(src_dir_vp, "xfs_rename", (inst_t *)__return_address);
254 vn_trace_entry(target_dir_vp, "xfs_rename", (inst_t *)__return_address); 251 vn_trace_entry(target_dir_vp, "xfs_rename", (inst_t *)__return_address);
255 252
@@ -262,9 +259,6 @@ xfs_rename(
262 return XFS_ERROR(EXDEV); 259 return XFS_ERROR(EXDEV);
263 } 260 }
264 261
265 src_dp = XFS_BHVTOI(src_dir_bdp);
266 mp = src_dp->i_mount;
267
268 if (DM_EVENT_ENABLED(src_dp, DM_EVENT_RENAME) || 262 if (DM_EVENT_ENABLED(src_dp, DM_EVENT_RENAME) ||
269 DM_EVENT_ENABLED(target_dp, DM_EVENT_RENAME)) { 263 DM_EVENT_ENABLED(target_dp, DM_EVENT_RENAME)) {
270 error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME, 264 error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME,
diff --git a/fs/xfs/xfs_rw.h b/fs/xfs/xfs_rw.h
index 943bddde83c6..49875e1d129f 100644
--- a/fs/xfs/xfs_rw.h
+++ b/fs/xfs/xfs_rw.h
@@ -90,14 +90,6 @@ extern void xfs_ioerror_alert(char *func, struct xfs_mount *mp,
90/* 90/*
91 * Prototypes for functions in xfs_vnodeops.c. 91 * Prototypes for functions in xfs_vnodeops.c.
92 */ 92 */
93extern int xfs_rwlock(bhv_desc_t *bdp, bhv_vrwlock_t write_lock);
94extern void xfs_rwunlock(bhv_desc_t *bdp, bhv_vrwlock_t write_lock);
95extern int xfs_setattr(bhv_desc_t *, bhv_vattr_t *vap, int flags,
96 cred_t *credp);
97extern int xfs_change_file_space(bhv_desc_t *bdp, int cmd, xfs_flock64_t *bf,
98 xfs_off_t offset, cred_t *credp, int flags);
99extern int xfs_set_dmattrs(bhv_desc_t *bdp, u_int evmask, u_int16_t state,
100 cred_t *credp);
101extern int xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip, 93extern int xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip,
102 int flags); 94 int flags);
103 95
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c
index 20ffec308e1e..4a7208ef7faa 100644
--- a/fs/xfs/xfs_utils.c
+++ b/fs/xfs/xfs_utils.c
@@ -65,20 +65,15 @@ xfs_get_dir_entry(
65 65
66int 66int
67xfs_dir_lookup_int( 67xfs_dir_lookup_int(
68 bhv_desc_t *dir_bdp, 68 xfs_inode_t *dp,
69 uint lock_mode, 69 uint lock_mode,
70 bhv_vname_t *dentry, 70 bhv_vname_t *dentry,
71 xfs_ino_t *inum, 71 xfs_ino_t *inum,
72 xfs_inode_t **ipp) 72 xfs_inode_t **ipp)
73{ 73{
74 bhv_vnode_t *dir_vp;
75 xfs_inode_t *dp;
76 int error; 74 int error;
77 75
78 dir_vp = BHV_TO_VNODE(dir_bdp); 76 vn_trace_entry(XFS_ITOV(dp), __FUNCTION__, (inst_t *)__return_address);
79 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
80
81 dp = XFS_BHVTOI(dir_bdp);
82 77
83 error = xfs_dir_lookup(NULL, dp, VNAME(dentry), VNAMELEN(dentry), inum); 78 error = xfs_dir_lookup(NULL, dp, VNAME(dentry), VNAMELEN(dentry), inum);
84 if (!error) { 79 if (!error) {
diff --git a/fs/xfs/xfs_utils.h b/fs/xfs/xfs_utils.h
index fe953e98afa7..35c7a99f50ac 100644
--- a/fs/xfs/xfs_utils.h
+++ b/fs/xfs/xfs_utils.h
@@ -23,10 +23,8 @@
23#define ITRACE(ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \ 23#define ITRACE(ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \
24 (inst_t *)__return_address) 24 (inst_t *)__return_address)
25 25
26extern int xfs_rename (bhv_desc_t *, bhv_vname_t *, bhv_vnode_t *,
27 bhv_vname_t *, cred_t *);
28extern int xfs_get_dir_entry (bhv_vname_t *, xfs_inode_t **); 26extern int xfs_get_dir_entry (bhv_vname_t *, xfs_inode_t **);
29extern int xfs_dir_lookup_int (bhv_desc_t *, uint, bhv_vname_t *, xfs_ino_t *, 27extern int xfs_dir_lookup_int (xfs_inode_t *, uint, bhv_vname_t *, xfs_ino_t *,
30 xfs_inode_t **); 28 xfs_inode_t **);
31extern int xfs_truncate_file (xfs_mount_t *, xfs_inode_t *); 29extern int xfs_truncate_file (xfs_mount_t *, xfs_inode_t *);
32extern int xfs_dir_ialloc (xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t, 30extern int xfs_dir_ialloc (xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t,
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 15bc01b2d6a0..2b30fa690b4a 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -52,15 +52,13 @@
52#include "xfs_trans_space.h" 52#include "xfs_trans_space.h"
53#include "xfs_log_priv.h" 53#include "xfs_log_priv.h"
54#include "xfs_filestream.h" 54#include "xfs_filestream.h"
55#include "xfs_vnodeops.h"
55 56
56STATIC int 57int
57xfs_open( 58xfs_open(
58 bhv_desc_t *bdp, 59 xfs_inode_t *ip)
59 cred_t *credp)
60{ 60{
61 int mode; 61 int mode;
62 bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
63 xfs_inode_t *ip = XFS_BHVTOI(bdp);
64 62
65 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) 63 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
66 return XFS_ERROR(EIO); 64 return XFS_ERROR(EIO);
@@ -69,7 +67,7 @@ xfs_open(
69 * If it's a directory with any blocks, read-ahead block 0 67 * If it's a directory with any blocks, read-ahead block 0
70 * as we're almost certain to have the next operation be a read there. 68 * as we're almost certain to have the next operation be a read there.
71 */ 69 */
72 if (VN_ISDIR(vp) && ip->i_d.di_nextents > 0) { 70 if (S_ISDIR(ip->i_d.di_mode) && ip->i_d.di_nextents > 0) {
73 mode = xfs_ilock_map_shared(ip); 71 mode = xfs_ilock_map_shared(ip);
74 if (ip->i_d.di_nextents > 0) 72 if (ip->i_d.di_nextents > 0)
75 (void)xfs_da_reada_buf(NULL, ip, 0, XFS_DATA_FORK); 73 (void)xfs_da_reada_buf(NULL, ip, 0, XFS_DATA_FORK);
@@ -81,23 +79,17 @@ xfs_open(
81/* 79/*
82 * xfs_getattr 80 * xfs_getattr
83 */ 81 */
84STATIC int 82int
85xfs_getattr( 83xfs_getattr(
86 bhv_desc_t *bdp, 84 xfs_inode_t *ip,
87 bhv_vattr_t *vap, 85 bhv_vattr_t *vap,
88 int flags, 86 int flags)
89 cred_t *credp)
90{ 87{
91 xfs_inode_t *ip; 88 bhv_vnode_t *vp = XFS_ITOV(ip);
92 xfs_mount_t *mp; 89 xfs_mount_t *mp = ip->i_mount;
93 bhv_vnode_t *vp;
94 90
95 vp = BHV_TO_VNODE(bdp);
96 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 91 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
97 92
98 ip = XFS_BHVTOI(bdp);
99 mp = ip->i_mount;
100
101 if (XFS_FORCED_SHUTDOWN(mp)) 93 if (XFS_FORCED_SHUTDOWN(mp))
102 return XFS_ERROR(EIO); 94 return XFS_ERROR(EIO);
103 95
@@ -215,14 +207,14 @@ xfs_getattr(
215 */ 207 */
216int 208int
217xfs_setattr( 209xfs_setattr(
218 bhv_desc_t *bdp, 210 xfs_inode_t *ip,
219 bhv_vattr_t *vap, 211 bhv_vattr_t *vap,
220 int flags, 212 int flags,
221 cred_t *credp) 213 cred_t *credp)
222{ 214{
223 xfs_inode_t *ip; 215 bhv_vnode_t *vp = XFS_ITOV(ip);
216 xfs_mount_t *mp = ip->i_mount;
224 xfs_trans_t *tp; 217 xfs_trans_t *tp;
225 xfs_mount_t *mp;
226 int mask; 218 int mask;
227 int code; 219 int code;
228 uint lock_flags; 220 uint lock_flags;
@@ -230,14 +222,12 @@ xfs_setattr(
230 uid_t uid=0, iuid=0; 222 uid_t uid=0, iuid=0;
231 gid_t gid=0, igid=0; 223 gid_t gid=0, igid=0;
232 int timeflags = 0; 224 int timeflags = 0;
233 bhv_vnode_t *vp;
234 xfs_prid_t projid=0, iprojid=0; 225 xfs_prid_t projid=0, iprojid=0;
235 int mandlock_before, mandlock_after; 226 int mandlock_before, mandlock_after;
236 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; 227 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
237 int file_owner; 228 int file_owner;
238 int need_iolock = 1; 229 int need_iolock = 1;
239 230
240 vp = BHV_TO_VNODE(bdp);
241 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 231 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
242 232
243 if (vp->v_vfsp->vfs_flag & VFS_RDONLY) 233 if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
@@ -251,9 +241,6 @@ xfs_setattr(
251 return XFS_ERROR(EINVAL); 241 return XFS_ERROR(EINVAL);
252 } 242 }
253 243
254 ip = XFS_BHVTOI(bdp);
255 mp = ip->i_mount;
256
257 if (XFS_FORCED_SHUTDOWN(mp)) 244 if (XFS_FORCED_SHUTDOWN(mp))
258 return XFS_ERROR(EIO); 245 return XFS_ERROR(EIO);
259 246
@@ -924,19 +911,16 @@ xfs_setattr(
924 * xfs_access 911 * xfs_access
925 * Null conversion from vnode mode bits to inode mode bits, as in efs. 912 * Null conversion from vnode mode bits to inode mode bits, as in efs.
926 */ 913 */
927STATIC int 914int
928xfs_access( 915xfs_access(
929 bhv_desc_t *bdp, 916 xfs_inode_t *ip,
930 int mode, 917 int mode,
931 cred_t *credp) 918 cred_t *credp)
932{ 919{
933 xfs_inode_t *ip;
934 int error; 920 int error;
935 921
936 vn_trace_entry(BHV_TO_VNODE(bdp), __FUNCTION__, 922 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
937 (inst_t *)__return_address);
938 923
939 ip = XFS_BHVTOI(bdp);
940 xfs_ilock(ip, XFS_ILOCK_SHARED); 924 xfs_ilock(ip, XFS_ILOCK_SHARED);
941 error = xfs_iaccess(ip, mode, credp); 925 error = xfs_iaccess(ip, mode, credp);
942 xfs_iunlock(ip, XFS_ILOCK_SHARED); 926 xfs_iunlock(ip, XFS_ILOCK_SHARED);
@@ -998,16 +982,11 @@ xfs_readlink_bmap(
998 return error; 982 return error;
999} 983}
1000 984
1001/* 985int
1002 * xfs_readlink
1003 *
1004 */
1005STATIC int
1006xfs_readlink( 986xfs_readlink(
1007 bhv_desc_t *bdp, 987 xfs_inode_t *ip,
1008 char *link) 988 char *link)
1009{ 989{
1010 xfs_inode_t *ip = XFS_BHVTOI(bdp);
1011 xfs_mount_t *mp = ip->i_mount; 990 xfs_mount_t *mp = ip->i_mount;
1012 int pathlen; 991 int pathlen;
1013 int error = 0; 992 int error = 0;
@@ -1047,23 +1026,18 @@ xfs_readlink(
1047 * be held while flushing the data, so acquire after we're done 1026 * be held while flushing the data, so acquire after we're done
1048 * with that. 1027 * with that.
1049 */ 1028 */
1050STATIC int 1029int
1051xfs_fsync( 1030xfs_fsync(
1052 bhv_desc_t *bdp, 1031 xfs_inode_t *ip,
1053 int flag, 1032 int flag,
1054 cred_t *credp,
1055 xfs_off_t start, 1033 xfs_off_t start,
1056 xfs_off_t stop) 1034 xfs_off_t stop)
1057{ 1035{
1058 xfs_inode_t *ip;
1059 xfs_trans_t *tp; 1036 xfs_trans_t *tp;
1060 int error; 1037 int error;
1061 int log_flushed = 0, changed = 1; 1038 int log_flushed = 0, changed = 1;
1062 1039
1063 vn_trace_entry(BHV_TO_VNODE(bdp), 1040 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
1064 __FUNCTION__, (inst_t *)__return_address);
1065
1066 ip = XFS_BHVTOI(bdp);
1067 1041
1068 ASSERT(start >= 0 && stop >= -1); 1042 ASSERT(start >= 0 && stop >= -1);
1069 1043
@@ -1533,19 +1507,14 @@ xfs_inactive_attrs(
1533 return 0; 1507 return 0;
1534} 1508}
1535 1509
1536STATIC int 1510int
1537xfs_release( 1511xfs_release(
1538 bhv_desc_t *bdp) 1512 xfs_inode_t *ip)
1539{ 1513{
1540 xfs_inode_t *ip; 1514 bhv_vnode_t *vp = XFS_ITOV(ip);
1541 bhv_vnode_t *vp; 1515 xfs_mount_t *mp = ip->i_mount;
1542 xfs_mount_t *mp;
1543 int error; 1516 int error;
1544 1517
1545 vp = BHV_TO_VNODE(bdp);
1546 ip = XFS_BHVTOI(bdp);
1547 mp = ip->i_mount;
1548
1549 if (!VN_ISREG(vp) || (ip->i_d.di_mode == 0)) 1518 if (!VN_ISREG(vp) || (ip->i_d.di_mode == 0))
1550 return 0; 1519 return 0;
1551 1520
@@ -1611,13 +1580,11 @@ xfs_release(
1611 * now be truncated. Also, we clear all of the read-ahead state 1580 * now be truncated. Also, we clear all of the read-ahead state
1612 * kept for the inode here since the file is now closed. 1581 * kept for the inode here since the file is now closed.
1613 */ 1582 */
1614STATIC int 1583int
1615xfs_inactive( 1584xfs_inactive(
1616 bhv_desc_t *bdp, 1585 xfs_inode_t *ip)
1617 cred_t *credp)
1618{ 1586{
1619 xfs_inode_t *ip; 1587 bhv_vnode_t *vp = XFS_ITOV(ip);
1620 bhv_vnode_t *vp;
1621 xfs_bmap_free_t free_list; 1588 xfs_bmap_free_t free_list;
1622 xfs_fsblock_t first_block; 1589 xfs_fsblock_t first_block;
1623 int committed; 1590 int committed;
@@ -1626,11 +1593,8 @@ xfs_inactive(
1626 int error; 1593 int error;
1627 int truncate; 1594 int truncate;
1628 1595
1629 vp = BHV_TO_VNODE(bdp);
1630 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 1596 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
1631 1597
1632 ip = XFS_BHVTOI(bdp);
1633
1634 /* 1598 /*
1635 * If the inode is already free, then there can be nothing 1599 * If the inode is already free, then there can be nothing
1636 * to clean up here. 1600 * to clean up here.
@@ -1831,34 +1795,24 @@ xfs_inactive(
1831} 1795}
1832 1796
1833 1797
1834/* 1798int
1835 * xfs_lookup
1836 */
1837STATIC int
1838xfs_lookup( 1799xfs_lookup(
1839 bhv_desc_t *dir_bdp, 1800 xfs_inode_t *dp,
1840 bhv_vname_t *dentry, 1801 bhv_vname_t *dentry,
1841 bhv_vnode_t **vpp, 1802 bhv_vnode_t **vpp)
1842 int flags,
1843 bhv_vnode_t *rdir,
1844 cred_t *credp)
1845{ 1803{
1846 xfs_inode_t *dp, *ip; 1804 xfs_inode_t *ip;
1847 xfs_ino_t e_inum; 1805 xfs_ino_t e_inum;
1848 int error; 1806 int error;
1849 uint lock_mode; 1807 uint lock_mode;
1850 bhv_vnode_t *dir_vp;
1851
1852 dir_vp = BHV_TO_VNODE(dir_bdp);
1853 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
1854 1808
1855 dp = XFS_BHVTOI(dir_bdp); 1809 vn_trace_entry(XFS_ITOV(dp), __FUNCTION__, (inst_t *)__return_address);
1856 1810
1857 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 1811 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
1858 return XFS_ERROR(EIO); 1812 return XFS_ERROR(EIO);
1859 1813
1860 lock_mode = xfs_ilock_map_shared(dp); 1814 lock_mode = xfs_ilock_map_shared(dp);
1861 error = xfs_dir_lookup_int(dir_bdp, lock_mode, dentry, &e_inum, &ip); 1815 error = xfs_dir_lookup_int(dp, lock_mode, dentry, &e_inum, &ip);
1862 if (!error) { 1816 if (!error) {
1863 *vpp = XFS_ITOV(ip); 1817 *vpp = XFS_ITOV(ip);
1864 ITRACE(ip); 1818 ITRACE(ip);
@@ -1867,29 +1821,25 @@ xfs_lookup(
1867 return error; 1821 return error;
1868} 1822}
1869 1823
1870 1824int
1871/*
1872 * xfs_create (create a new file).
1873 */
1874STATIC int
1875xfs_create( 1825xfs_create(
1876 bhv_desc_t *dir_bdp, 1826 xfs_inode_t *dp,
1877 bhv_vname_t *dentry, 1827 bhv_vname_t *dentry,
1878 bhv_vattr_t *vap, 1828 bhv_vattr_t *vap,
1879 bhv_vnode_t **vpp, 1829 bhv_vnode_t **vpp,
1880 cred_t *credp) 1830 cred_t *credp)
1881{ 1831{
1882 char *name = VNAME(dentry); 1832 char *name = VNAME(dentry);
1883 bhv_vnode_t *dir_vp; 1833 xfs_mount_t *mp = dp->i_mount;
1884 xfs_inode_t *dp, *ip; 1834 bhv_vnode_t *dir_vp = XFS_ITOV(dp);
1835 xfs_inode_t *ip;
1885 bhv_vnode_t *vp = NULL; 1836 bhv_vnode_t *vp = NULL;
1886 xfs_trans_t *tp; 1837 xfs_trans_t *tp;
1887 xfs_mount_t *mp;
1888 xfs_dev_t rdev; 1838 xfs_dev_t rdev;
1889 int error; 1839 int error;
1890 xfs_bmap_free_t free_list; 1840 xfs_bmap_free_t free_list;
1891 xfs_fsblock_t first_block; 1841 xfs_fsblock_t first_block;
1892 boolean_t dp_joined_to_trans; 1842 boolean_t unlock_dp_on_error = B_FALSE;
1893 int dm_event_sent = 0; 1843 int dm_event_sent = 0;
1894 uint cancel_flags; 1844 uint cancel_flags;
1895 int committed; 1845 int committed;
@@ -1900,12 +1850,8 @@ xfs_create(
1900 int namelen; 1850 int namelen;
1901 1851
1902 ASSERT(!*vpp); 1852 ASSERT(!*vpp);
1903 dir_vp = BHV_TO_VNODE(dir_bdp);
1904 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address); 1853 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
1905 1854
1906 dp = XFS_BHVTOI(dir_bdp);
1907 mp = dp->i_mount;
1908
1909 dm_di_mode = vap->va_mode; 1855 dm_di_mode = vap->va_mode;
1910 namelen = VNAMELEN(dentry); 1856 namelen = VNAMELEN(dentry);
1911 1857
@@ -1943,7 +1889,6 @@ xfs_create(
1943 goto std_return; 1889 goto std_return;
1944 1890
1945 ip = NULL; 1891 ip = NULL;
1946 dp_joined_to_trans = B_FALSE;
1947 1892
1948 tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE); 1893 tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE);
1949 cancel_flags = XFS_TRANS_RELEASE_LOG_RES; 1894 cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
@@ -1963,11 +1908,11 @@ xfs_create(
1963 } 1908 }
1964 if (error) { 1909 if (error) {
1965 cancel_flags = 0; 1910 cancel_flags = 0;
1966 dp = NULL;
1967 goto error_return; 1911 goto error_return;
1968 } 1912 }
1969 1913
1970 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); 1914 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
1915 unlock_dp_on_error = B_TRUE;
1971 1916
1972 XFS_BMAP_INIT(&free_list, &first_block); 1917 XFS_BMAP_INIT(&free_list, &first_block);
1973 1918
@@ -2001,15 +1946,15 @@ xfs_create(
2001 ASSERT(ismrlocked (&ip->i_lock, MR_UPDATE)); 1946 ASSERT(ismrlocked (&ip->i_lock, MR_UPDATE));
2002 1947
2003 /* 1948 /*
2004 * Now we join the directory inode to the transaction. 1949 * Now we join the directory inode to the transaction. We do not do it
2005 * We do not do it earlier because xfs_dir_ialloc 1950 * earlier because xfs_dir_ialloc might commit the previous transaction
2006 * might commit the previous transaction (and release 1951 * (and release all the locks). An error from here on will result in
2007 * all the locks). 1952 * the transaction cancel unlocking dp so don't do it explicitly in the
1953 * error path.
2008 */ 1954 */
2009
2010 VN_HOLD(dir_vp); 1955 VN_HOLD(dir_vp);
2011 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); 1956 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
2012 dp_joined_to_trans = B_TRUE; 1957 unlock_dp_on_error = B_FALSE;
2013 1958
2014 error = xfs_dir_createname(tp, dp, name, namelen, ip->i_ino, 1959 error = xfs_dir_createname(tp, dp, name, namelen, ip->i_ino,
2015 &first_block, &free_list, resblks ? 1960 &first_block, &free_list, resblks ?
@@ -2075,7 +2020,7 @@ xfs_create(
2075 2020
2076std_return: 2021std_return:
2077 if ((*vpp || (error != 0 && dm_event_sent != 0)) && 2022 if ((*vpp || (error != 0 && dm_event_sent != 0)) &&
2078 DM_EVENT_ENABLED(XFS_BHVTOI(dir_bdp), DM_EVENT_POSTCREATE)) { 2023 DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) {
2079 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, 2024 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
2080 dir_vp, DM_RIGHT_NULL, 2025 dir_vp, DM_RIGHT_NULL,
2081 *vpp ? vp:NULL, 2026 *vpp ? vp:NULL,
@@ -2092,11 +2037,12 @@ std_return:
2092 if (tp != NULL) 2037 if (tp != NULL)
2093 xfs_trans_cancel(tp, cancel_flags); 2038 xfs_trans_cancel(tp, cancel_flags);
2094 2039
2095 if (!dp_joined_to_trans && (dp != NULL))
2096 xfs_iunlock(dp, XFS_ILOCK_EXCL);
2097 XFS_QM_DQRELE(mp, udqp); 2040 XFS_QM_DQRELE(mp, udqp);
2098 XFS_QM_DQRELE(mp, gdqp); 2041 XFS_QM_DQRELE(mp, gdqp);
2099 2042
2043 if (unlock_dp_on_error)
2044 xfs_iunlock(dp, XFS_ILOCK_EXCL);
2045
2100 goto std_return; 2046 goto std_return;
2101 2047
2102 abort_rele: 2048 abort_rele:
@@ -2367,22 +2313,16 @@ int remove_which_error_return = 0;
2367#define REMOVE_DEBUG_TRACE(x) 2313#define REMOVE_DEBUG_TRACE(x)
2368#endif /* ! DEBUG */ 2314#endif /* ! DEBUG */
2369 2315
2370 2316int
2371/*
2372 * xfs_remove
2373 *
2374 */
2375STATIC int
2376xfs_remove( 2317xfs_remove(
2377 bhv_desc_t *dir_bdp, 2318 xfs_inode_t *dp,
2378 bhv_vname_t *dentry, 2319 bhv_vname_t *dentry)
2379 cred_t *credp)
2380{ 2320{
2381 bhv_vnode_t *dir_vp; 2321 bhv_vnode_t *dir_vp = XFS_ITOV(dp);
2382 char *name = VNAME(dentry); 2322 char *name = VNAME(dentry);
2383 xfs_inode_t *dp, *ip; 2323 xfs_mount_t *mp = dp->i_mount;
2324 xfs_inode_t *ip;
2384 xfs_trans_t *tp = NULL; 2325 xfs_trans_t *tp = NULL;
2385 xfs_mount_t *mp;
2386 int error = 0; 2326 int error = 0;
2387 xfs_bmap_free_t free_list; 2327 xfs_bmap_free_t free_list;
2388 xfs_fsblock_t first_block; 2328 xfs_fsblock_t first_block;
@@ -2393,12 +2333,8 @@ xfs_remove(
2393 uint resblks; 2333 uint resblks;
2394 int namelen; 2334 int namelen;
2395 2335
2396 dir_vp = BHV_TO_VNODE(dir_bdp);
2397 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address); 2336 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
2398 2337
2399 dp = XFS_BHVTOI(dir_bdp);
2400 mp = dp->i_mount;
2401
2402 if (XFS_FORCED_SHUTDOWN(mp)) 2338 if (XFS_FORCED_SHUTDOWN(mp))
2403 return XFS_ERROR(EIO); 2339 return XFS_ERROR(EIO);
2404 2340
@@ -2623,42 +2559,32 @@ xfs_remove(
2623 goto std_return; 2559 goto std_return;
2624} 2560}
2625 2561
2626 2562int
2627/*
2628 * xfs_link
2629 *
2630 */
2631STATIC int
2632xfs_link( 2563xfs_link(
2633 bhv_desc_t *target_dir_bdp, 2564 xfs_inode_t *tdp,
2634 bhv_vnode_t *src_vp, 2565 bhv_vnode_t *src_vp,
2635 bhv_vname_t *dentry, 2566 bhv_vname_t *dentry)
2636 cred_t *credp)
2637{ 2567{
2638 xfs_inode_t *tdp, *sip; 2568 bhv_vnode_t *target_dir_vp = XFS_ITOV(tdp);
2569 xfs_mount_t *mp = tdp->i_mount;
2570 xfs_inode_t *sip = xfs_vtoi(src_vp);
2639 xfs_trans_t *tp; 2571 xfs_trans_t *tp;
2640 xfs_mount_t *mp;
2641 xfs_inode_t *ips[2]; 2572 xfs_inode_t *ips[2];
2642 int error; 2573 int error;
2643 xfs_bmap_free_t free_list; 2574 xfs_bmap_free_t free_list;
2644 xfs_fsblock_t first_block; 2575 xfs_fsblock_t first_block;
2645 int cancel_flags; 2576 int cancel_flags;
2646 int committed; 2577 int committed;
2647 bhv_vnode_t *target_dir_vp;
2648 int resblks; 2578 int resblks;
2649 char *target_name = VNAME(dentry); 2579 char *target_name = VNAME(dentry);
2650 int target_namelen; 2580 int target_namelen;
2651 2581
2652 target_dir_vp = BHV_TO_VNODE(target_dir_bdp);
2653 vn_trace_entry(target_dir_vp, __FUNCTION__, (inst_t *)__return_address); 2582 vn_trace_entry(target_dir_vp, __FUNCTION__, (inst_t *)__return_address);
2654 vn_trace_entry(src_vp, __FUNCTION__, (inst_t *)__return_address); 2583 vn_trace_entry(src_vp, __FUNCTION__, (inst_t *)__return_address);
2655 2584
2656 target_namelen = VNAMELEN(dentry); 2585 target_namelen = VNAMELEN(dentry);
2657 ASSERT(!VN_ISDIR(src_vp)); 2586 ASSERT(!VN_ISDIR(src_vp));
2658 2587
2659 sip = xfs_vtoi(src_vp);
2660 tdp = XFS_BHVTOI(target_dir_bdp);
2661 mp = tdp->i_mount;
2662 if (XFS_FORCED_SHUTDOWN(mp)) 2588 if (XFS_FORCED_SHUTDOWN(mp))
2663 return XFS_ERROR(EIO); 2589 return XFS_ERROR(EIO);
2664 2590
@@ -2791,50 +2717,38 @@ std_return:
2791} 2717}
2792 2718
2793 2719
2794/* 2720int
2795 * xfs_mkdir
2796 *
2797 */
2798STATIC int
2799xfs_mkdir( 2721xfs_mkdir(
2800 bhv_desc_t *dir_bdp, 2722 xfs_inode_t *dp,
2801 bhv_vname_t *dentry, 2723 bhv_vname_t *dentry,
2802 bhv_vattr_t *vap, 2724 bhv_vattr_t *vap,
2803 bhv_vnode_t **vpp, 2725 bhv_vnode_t **vpp,
2804 cred_t *credp) 2726 cred_t *credp)
2805{ 2727{
2728 bhv_vnode_t *dir_vp = XFS_ITOV(dp);
2806 char *dir_name = VNAME(dentry); 2729 char *dir_name = VNAME(dentry);
2807 xfs_inode_t *dp; 2730 int dir_namelen = VNAMELEN(dentry);
2731 xfs_mount_t *mp = dp->i_mount;
2808 xfs_inode_t *cdp; /* inode of created dir */ 2732 xfs_inode_t *cdp; /* inode of created dir */
2809 bhv_vnode_t *cvp; /* vnode of created dir */ 2733 bhv_vnode_t *cvp; /* vnode of created dir */
2810 xfs_trans_t *tp; 2734 xfs_trans_t *tp;
2811 xfs_mount_t *mp;
2812 int cancel_flags; 2735 int cancel_flags;
2813 int error; 2736 int error;
2814 int committed; 2737 int committed;
2815 xfs_bmap_free_t free_list; 2738 xfs_bmap_free_t free_list;
2816 xfs_fsblock_t first_block; 2739 xfs_fsblock_t first_block;
2817 bhv_vnode_t *dir_vp; 2740 boolean_t unlock_dp_on_error = B_FALSE;
2818 boolean_t dp_joined_to_trans;
2819 boolean_t created = B_FALSE; 2741 boolean_t created = B_FALSE;
2820 int dm_event_sent = 0; 2742 int dm_event_sent = 0;
2821 xfs_prid_t prid; 2743 xfs_prid_t prid;
2822 struct xfs_dquot *udqp, *gdqp; 2744 struct xfs_dquot *udqp, *gdqp;
2823 uint resblks; 2745 uint resblks;
2824 int dm_di_mode; 2746 int dm_di_mode;
2825 int dir_namelen;
2826
2827 dir_vp = BHV_TO_VNODE(dir_bdp);
2828 dp = XFS_BHVTOI(dir_bdp);
2829 mp = dp->i_mount;
2830 2747
2831 if (XFS_FORCED_SHUTDOWN(mp)) 2748 if (XFS_FORCED_SHUTDOWN(mp))
2832 return XFS_ERROR(EIO); 2749 return XFS_ERROR(EIO);
2833 2750
2834 dir_namelen = VNAMELEN(dentry);
2835
2836 tp = NULL; 2751 tp = NULL;
2837 dp_joined_to_trans = B_FALSE;
2838 dm_di_mode = vap->va_mode; 2752 dm_di_mode = vap->va_mode;
2839 2753
2840 if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { 2754 if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
@@ -2882,11 +2796,11 @@ xfs_mkdir(
2882 } 2796 }
2883 if (error) { 2797 if (error) {
2884 cancel_flags = 0; 2798 cancel_flags = 0;
2885 dp = NULL;
2886 goto error_return; 2799 goto error_return;
2887 } 2800 }
2888 2801
2889 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); 2802 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
2803 unlock_dp_on_error = B_TRUE;
2890 2804
2891 /* 2805 /*
2892 * Check for directory link count overflow. 2806 * Check for directory link count overflow.
@@ -2923,11 +2837,13 @@ xfs_mkdir(
2923 * Now we add the directory inode to the transaction. 2837 * Now we add the directory inode to the transaction.
2924 * We waited until now since xfs_dir_ialloc might start 2838 * We waited until now since xfs_dir_ialloc might start
2925 * a new transaction. Had we joined the transaction 2839 * a new transaction. Had we joined the transaction
2926 * earlier, the locks might have gotten released. 2840 * earlier, the locks might have gotten released. An error
2841 * from here on will result in the transaction cancel
2842 * unlocking dp so don't do it explicitly in the error path.
2927 */ 2843 */
2928 VN_HOLD(dir_vp); 2844 VN_HOLD(dir_vp);
2929 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); 2845 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
2930 dp_joined_to_trans = B_TRUE; 2846 unlock_dp_on_error = B_FALSE;
2931 2847
2932 XFS_BMAP_INIT(&free_list, &first_block); 2848 XFS_BMAP_INIT(&free_list, &first_block);
2933 2849
@@ -2995,7 +2911,7 @@ xfs_mkdir(
2995 2911
2996std_return: 2912std_return:
2997 if ((created || (error != 0 && dm_event_sent != 0)) && 2913 if ((created || (error != 0 && dm_event_sent != 0)) &&
2998 DM_EVENT_ENABLED(XFS_BHVTOI(dir_bdp), DM_EVENT_POSTCREATE)) { 2914 DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) {
2999 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, 2915 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
3000 dir_vp, DM_RIGHT_NULL, 2916 dir_vp, DM_RIGHT_NULL,
3001 created ? XFS_ITOV(cdp):NULL, 2917 created ? XFS_ITOV(cdp):NULL,
@@ -3015,49 +2931,36 @@ std_return:
3015 XFS_QM_DQRELE(mp, udqp); 2931 XFS_QM_DQRELE(mp, udqp);
3016 XFS_QM_DQRELE(mp, gdqp); 2932 XFS_QM_DQRELE(mp, gdqp);
3017 2933
3018 if (!dp_joined_to_trans && (dp != NULL)) { 2934 if (unlock_dp_on_error)
3019 xfs_iunlock(dp, XFS_ILOCK_EXCL); 2935 xfs_iunlock(dp, XFS_ILOCK_EXCL);
3020 }
3021 2936
3022 goto std_return; 2937 goto std_return;
3023} 2938}
3024 2939
3025 2940int
3026/*
3027 * xfs_rmdir
3028 *
3029 */
3030STATIC int
3031xfs_rmdir( 2941xfs_rmdir(
3032 bhv_desc_t *dir_bdp, 2942 xfs_inode_t *dp,
3033 bhv_vname_t *dentry, 2943 bhv_vname_t *dentry)
3034 cred_t *credp)
3035{ 2944{
2945 bhv_vnode_t *dir_vp = XFS_ITOV(dp);
3036 char *name = VNAME(dentry); 2946 char *name = VNAME(dentry);
3037 xfs_inode_t *dp; 2947 int namelen = VNAMELEN(dentry);
3038 xfs_inode_t *cdp; /* child directory */ 2948 xfs_mount_t *mp = dp->i_mount;
2949 xfs_inode_t *cdp; /* child directory */
3039 xfs_trans_t *tp; 2950 xfs_trans_t *tp;
3040 xfs_mount_t *mp;
3041 int error; 2951 int error;
3042 xfs_bmap_free_t free_list; 2952 xfs_bmap_free_t free_list;
3043 xfs_fsblock_t first_block; 2953 xfs_fsblock_t first_block;
3044 int cancel_flags; 2954 int cancel_flags;
3045 int committed; 2955 int committed;
3046 bhv_vnode_t *dir_vp;
3047 int dm_di_mode = S_IFDIR; 2956 int dm_di_mode = S_IFDIR;
3048 int last_cdp_link; 2957 int last_cdp_link;
3049 int namelen;
3050 uint resblks; 2958 uint resblks;
3051 2959
3052 dir_vp = BHV_TO_VNODE(dir_bdp);
3053 dp = XFS_BHVTOI(dir_bdp);
3054 mp = dp->i_mount;
3055
3056 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address); 2960 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
3057 2961
3058 if (XFS_FORCED_SHUTDOWN(XFS_BHVTOI(dir_bdp)->i_mount)) 2962 if (XFS_FORCED_SHUTDOWN(mp))
3059 return XFS_ERROR(EIO); 2963 return XFS_ERROR(EIO);
3060 namelen = VNAMELEN(dentry);
3061 2964
3062 if (!xfs_get_dir_entry(dentry, &cdp)) { 2965 if (!xfs_get_dir_entry(dentry, &cdp)) {
3063 dm_di_mode = cdp->i_d.di_mode; 2966 dm_di_mode = cdp->i_d.di_mode;
@@ -3272,25 +3175,24 @@ xfs_rmdir(
3272 goto std_return; 3175 goto std_return;
3273} 3176}
3274 3177
3275STATIC int 3178int
3276xfs_symlink( 3179xfs_symlink(
3277 bhv_desc_t *dir_bdp, 3180 xfs_inode_t *dp,
3278 bhv_vname_t *dentry, 3181 bhv_vname_t *dentry,
3279 bhv_vattr_t *vap, 3182 bhv_vattr_t *vap,
3280 char *target_path, 3183 char *target_path,
3281 bhv_vnode_t **vpp, 3184 bhv_vnode_t **vpp,
3282 cred_t *credp) 3185 cred_t *credp)
3283{ 3186{
3187 bhv_vnode_t *dir_vp = XFS_ITOV(dp);
3188 xfs_mount_t *mp = dp->i_mount;
3284 xfs_trans_t *tp; 3189 xfs_trans_t *tp;
3285 xfs_mount_t *mp;
3286 xfs_inode_t *dp;
3287 xfs_inode_t *ip; 3190 xfs_inode_t *ip;
3288 int error; 3191 int error;
3289 int pathlen; 3192 int pathlen;
3290 xfs_bmap_free_t free_list; 3193 xfs_bmap_free_t free_list;
3291 xfs_fsblock_t first_block; 3194 xfs_fsblock_t first_block;
3292 boolean_t dp_joined_to_trans; 3195 boolean_t unlock_dp_on_error = B_FALSE;
3293 bhv_vnode_t *dir_vp;
3294 uint cancel_flags; 3196 uint cancel_flags;
3295 int committed; 3197 int committed;
3296 xfs_fileoff_t first_fsb; 3198 xfs_fileoff_t first_fsb;
@@ -3309,16 +3211,12 @@ xfs_symlink(
3309 int link_namelen; 3211 int link_namelen;
3310 3212
3311 *vpp = NULL; 3213 *vpp = NULL;
3312 dir_vp = BHV_TO_VNODE(dir_bdp);
3313 dp = XFS_BHVTOI(dir_bdp);
3314 dp_joined_to_trans = B_FALSE;
3315 error = 0; 3214 error = 0;
3316 ip = NULL; 3215 ip = NULL;
3317 tp = NULL; 3216 tp = NULL;
3318 3217
3319 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address); 3218 vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
3320 3219
3321 mp = dp->i_mount;
3322 3220
3323 if (XFS_FORCED_SHUTDOWN(mp)) 3221 if (XFS_FORCED_SHUTDOWN(mp))
3324 return XFS_ERROR(EIO); 3222 return XFS_ERROR(EIO);
@@ -3404,11 +3302,11 @@ xfs_symlink(
3404 } 3302 }
3405 if (error) { 3303 if (error) {
3406 cancel_flags = 0; 3304 cancel_flags = 0;
3407 dp = NULL;
3408 goto error_return; 3305 goto error_return;
3409 } 3306 }
3410 3307
3411 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); 3308 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
3309 unlock_dp_on_error = B_TRUE;
3412 3310
3413 /* 3311 /*
3414 * Check whether the directory allows new symlinks or not. 3312 * Check whether the directory allows new symlinks or not.
@@ -3449,9 +3347,14 @@ xfs_symlink(
3449 } 3347 }
3450 ITRACE(ip); 3348 ITRACE(ip);
3451 3349
3350 /*
3351 * An error after we've joined dp to the transaction will result in the
3352 * transaction cancel unlocking dp so don't do it explicitly in the
3353 * error path.
3354 */
3452 VN_HOLD(dir_vp); 3355 VN_HOLD(dir_vp);
3453 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); 3356 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
3454 dp_joined_to_trans = B_TRUE; 3357 unlock_dp_on_error = B_FALSE;
3455 3358
3456 /* 3359 /*
3457 * Also attach the dquot(s) to it, if applicable. 3360 * Also attach the dquot(s) to it, if applicable.
@@ -3557,7 +3460,7 @@ xfs_symlink(
3557 /* Fall through to std_return with error = 0 or errno from 3460 /* Fall through to std_return with error = 0 or errno from
3558 * xfs_trans_commit */ 3461 * xfs_trans_commit */
3559std_return: 3462std_return:
3560 if (DM_EVENT_ENABLED(XFS_BHVTOI(dir_bdp), DM_EVENT_POSTSYMLINK)) { 3463 if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTSYMLINK)) {
3561 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK, 3464 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK,
3562 dir_vp, DM_RIGHT_NULL, 3465 dir_vp, DM_RIGHT_NULL,
3563 error ? NULL : XFS_ITOV(ip), 3466 error ? NULL : XFS_ITOV(ip),
@@ -3584,9 +3487,8 @@ std_return:
3584 XFS_QM_DQRELE(mp, udqp); 3487 XFS_QM_DQRELE(mp, udqp);
3585 XFS_QM_DQRELE(mp, gdqp); 3488 XFS_QM_DQRELE(mp, gdqp);
3586 3489
3587 if (!dp_joined_to_trans && (dp != NULL)) { 3490 if (unlock_dp_on_error)
3588 xfs_iunlock(dp, XFS_ILOCK_EXCL); 3491 xfs_iunlock(dp, XFS_ILOCK_EXCL);
3589 }
3590 3492
3591 goto std_return; 3493 goto std_return;
3592} 3494}
@@ -3598,20 +3500,16 @@ std_return:
3598 * A fid routine that takes a pointer to a previously allocated 3500 * A fid routine that takes a pointer to a previously allocated
3599 * fid structure (like xfs_fast_fid) but uses a 64 bit inode number. 3501 * fid structure (like xfs_fast_fid) but uses a 64 bit inode number.
3600 */ 3502 */
3601STATIC int 3503int
3602xfs_fid2( 3504xfs_fid2(
3603 bhv_desc_t *bdp, 3505 xfs_inode_t *ip,
3604 fid_t *fidp) 3506 fid_t *fidp)
3605{ 3507{
3606 xfs_inode_t *ip; 3508 xfs_fid2_t *xfid = (xfs_fid2_t *)fidp;
3607 xfs_fid2_t *xfid;
3608 3509
3609 vn_trace_entry(BHV_TO_VNODE(bdp), __FUNCTION__, 3510 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
3610 (inst_t *)__return_address);
3611 ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t)); 3511 ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t));
3612 3512
3613 xfid = (xfs_fid2_t *)fidp;
3614 ip = XFS_BHVTOI(bdp);
3615 xfid->fid_len = sizeof(xfs_fid2_t) - sizeof(xfid->fid_len); 3513 xfid->fid_len = sizeof(xfs_fid2_t) - sizeof(xfid->fid_len);
3616 xfid->fid_pad = 0; 3514 xfid->fid_pad = 0;
3617 /* 3515 /*
@@ -3625,21 +3523,13 @@ xfs_fid2(
3625} 3523}
3626 3524
3627 3525
3628/*
3629 * xfs_rwlock
3630 */
3631int 3526int
3632xfs_rwlock( 3527xfs_rwlock(
3633 bhv_desc_t *bdp, 3528 xfs_inode_t *ip,
3634 bhv_vrwlock_t locktype) 3529 bhv_vrwlock_t locktype)
3635{ 3530{
3636 xfs_inode_t *ip; 3531 if (S_ISDIR(ip->i_d.di_mode))
3637 bhv_vnode_t *vp;
3638
3639 vp = BHV_TO_VNODE(bdp);
3640 if (VN_ISDIR(vp))
3641 return 1; 3532 return 1;
3642 ip = XFS_BHVTOI(bdp);
3643 if (locktype == VRWLOCK_WRITE) { 3533 if (locktype == VRWLOCK_WRITE) {
3644 xfs_ilock(ip, XFS_IOLOCK_EXCL); 3534 xfs_ilock(ip, XFS_IOLOCK_EXCL);
3645 } else if (locktype == VRWLOCK_TRY_READ) { 3535 } else if (locktype == VRWLOCK_TRY_READ) {
@@ -3656,21 +3546,13 @@ xfs_rwlock(
3656} 3546}
3657 3547
3658 3548
3659/*
3660 * xfs_rwunlock
3661 */
3662void 3549void
3663xfs_rwunlock( 3550xfs_rwunlock(
3664 bhv_desc_t *bdp, 3551 xfs_inode_t *ip,
3665 bhv_vrwlock_t locktype) 3552 bhv_vrwlock_t locktype)
3666{ 3553{
3667 xfs_inode_t *ip; 3554 if (S_ISDIR(ip->i_d.di_mode))
3668 bhv_vnode_t *vp; 3555 return;
3669
3670 vp = BHV_TO_VNODE(bdp);
3671 if (VN_ISDIR(vp))
3672 return;
3673 ip = XFS_BHVTOI(bdp);
3674 if (locktype == VRWLOCK_WRITE) { 3556 if (locktype == VRWLOCK_WRITE) {
3675 /* 3557 /*
3676 * In the write case, we may have added a new entry to 3558 * In the write case, we may have added a new entry to
@@ -3688,20 +3570,16 @@ xfs_rwunlock(
3688 return; 3570 return;
3689} 3571}
3690 3572
3691STATIC int 3573
3574int
3692xfs_inode_flush( 3575xfs_inode_flush(
3693 bhv_desc_t *bdp, 3576 xfs_inode_t *ip,
3694 int flags) 3577 int flags)
3695{ 3578{
3696 xfs_inode_t *ip; 3579 xfs_mount_t *mp = ip->i_mount;
3697 xfs_mount_t *mp; 3580 xfs_inode_log_item_t *iip = ip->i_itemp;
3698 xfs_inode_log_item_t *iip;
3699 int error = 0; 3581 int error = 0;
3700 3582
3701 ip = XFS_BHVTOI(bdp);
3702 mp = ip->i_mount;
3703 iip = ip->i_itemp;
3704
3705 if (XFS_FORCED_SHUTDOWN(mp)) 3583 if (XFS_FORCED_SHUTDOWN(mp))
3706 return XFS_ERROR(EIO); 3584 return XFS_ERROR(EIO);
3707 3585
@@ -3770,24 +3648,20 @@ xfs_inode_flush(
3770 return error; 3648 return error;
3771} 3649}
3772 3650
3651
3773int 3652int
3774xfs_set_dmattrs ( 3653xfs_set_dmattrs(
3775 bhv_desc_t *bdp, 3654 xfs_inode_t *ip,
3776 u_int evmask, 3655 u_int evmask,
3777 u_int16_t state, 3656 u_int16_t state)
3778 cred_t *credp)
3779{ 3657{
3780 xfs_inode_t *ip; 3658 xfs_mount_t *mp = ip->i_mount;
3781 xfs_trans_t *tp; 3659 xfs_trans_t *tp;
3782 xfs_mount_t *mp;
3783 int error; 3660 int error;
3784 3661
3785 if (!capable(CAP_SYS_ADMIN)) 3662 if (!capable(CAP_SYS_ADMIN))
3786 return XFS_ERROR(EPERM); 3663 return XFS_ERROR(EPERM);
3787 3664
3788 ip = XFS_BHVTOI(bdp);
3789 mp = ip->i_mount;
3790
3791 if (XFS_FORCED_SHUTDOWN(mp)) 3665 if (XFS_FORCED_SHUTDOWN(mp))
3792 return XFS_ERROR(EIO); 3666 return XFS_ERROR(EIO);
3793 3667
@@ -3810,15 +3684,11 @@ xfs_set_dmattrs (
3810 return error; 3684 return error;
3811} 3685}
3812 3686
3813STATIC int 3687int
3814xfs_reclaim( 3688xfs_reclaim(
3815 bhv_desc_t *bdp) 3689 xfs_inode_t *ip)
3816{ 3690{
3817 xfs_inode_t *ip; 3691 bhv_vnode_t *vp = XFS_ITOV(ip);
3818 bhv_vnode_t *vp;
3819
3820 vp = BHV_TO_VNODE(bdp);
3821 ip = XFS_BHVTOI(bdp);
3822 3692
3823 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 3693 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
3824 3694
@@ -4495,35 +4365,29 @@ xfs_free_file_space(
4495 */ 4365 */
4496int 4366int
4497xfs_change_file_space( 4367xfs_change_file_space(
4498 bhv_desc_t *bdp, 4368 xfs_inode_t *ip,
4499 int cmd, 4369 int cmd,
4500 xfs_flock64_t *bf, 4370 xfs_flock64_t *bf,
4501 xfs_off_t offset, 4371 xfs_off_t offset,
4502 cred_t *credp, 4372 cred_t *credp,
4503 int attr_flags) 4373 int attr_flags)
4504{ 4374{
4375 xfs_mount_t *mp = ip->i_mount;
4505 int clrprealloc; 4376 int clrprealloc;
4506 int error; 4377 int error;
4507 xfs_fsize_t fsize; 4378 xfs_fsize_t fsize;
4508 xfs_inode_t *ip;
4509 xfs_mount_t *mp;
4510 int setprealloc; 4379 int setprealloc;
4511 xfs_off_t startoffset; 4380 xfs_off_t startoffset;
4512 xfs_off_t llen; 4381 xfs_off_t llen;
4513 xfs_trans_t *tp; 4382 xfs_trans_t *tp;
4514 bhv_vattr_t va; 4383 bhv_vattr_t va;
4515 bhv_vnode_t *vp;
4516
4517 vp = BHV_TO_VNODE(bdp);
4518 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
4519 4384
4520 ip = XFS_BHVTOI(bdp); 4385 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
4521 mp = ip->i_mount;
4522 4386
4523 /* 4387 /*
4524 * must be a regular file and have write permission 4388 * must be a regular file and have write permission
4525 */ 4389 */
4526 if (!VN_ISREG(vp)) 4390 if (!S_ISREG(ip->i_d.di_mode))
4527 return XFS_ERROR(EINVAL); 4391 return XFS_ERROR(EINVAL);
4528 4392
4529 xfs_ilock(ip, XFS_ILOCK_SHARED); 4393 xfs_ilock(ip, XFS_ILOCK_SHARED);
@@ -4605,7 +4469,7 @@ xfs_change_file_space(
4605 va.va_mask = XFS_AT_SIZE; 4469 va.va_mask = XFS_AT_SIZE;
4606 va.va_size = startoffset; 4470 va.va_size = startoffset;
4607 4471
4608 error = xfs_setattr(bdp, &va, attr_flags, credp); 4472 error = xfs_setattr(ip, &va, attr_flags, credp);
4609 4473
4610 if (error) 4474 if (error)
4611 return error; 4475 return error;
@@ -4664,46 +4528,3 @@ xfs_change_file_space(
4664 4528
4665 return error; 4529 return error;
4666} 4530}
4667
4668bhv_vnodeops_t xfs_vnodeops = {
4669 BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS),
4670 .vop_open = xfs_open,
4671 .vop_read = xfs_read,
4672#ifdef HAVE_SPLICE
4673 .vop_splice_read = xfs_splice_read,
4674 .vop_splice_write = xfs_splice_write,
4675#endif
4676 .vop_write = xfs_write,
4677 .vop_ioctl = xfs_ioctl,
4678 .vop_getattr = xfs_getattr,
4679 .vop_setattr = xfs_setattr,
4680 .vop_access = xfs_access,
4681 .vop_lookup = xfs_lookup,
4682 .vop_create = xfs_create,
4683 .vop_remove = xfs_remove,
4684 .vop_link = xfs_link,
4685 .vop_rename = xfs_rename,
4686 .vop_mkdir = xfs_mkdir,
4687 .vop_rmdir = xfs_rmdir,
4688 .vop_readdir = xfs_readdir,
4689 .vop_symlink = xfs_symlink,
4690 .vop_readlink = xfs_readlink,
4691 .vop_fsync = xfs_fsync,
4692 .vop_inactive = xfs_inactive,
4693 .vop_fid2 = xfs_fid2,
4694 .vop_rwlock = xfs_rwlock,
4695 .vop_rwunlock = xfs_rwunlock,
4696 .vop_bmap = xfs_bmap,
4697 .vop_reclaim = xfs_reclaim,
4698 .vop_attr_get = xfs_attr_get,
4699 .vop_attr_set = xfs_attr_set,
4700 .vop_attr_remove = xfs_attr_remove,
4701 .vop_attr_list = xfs_attr_list,
4702 .vop_link_removed = (vop_link_removed_t)fs_noval,
4703 .vop_vnode_change = (vop_vnode_change_t)fs_noval,
4704 .vop_tosspages = fs_tosspages,
4705 .vop_flushinval_pages = fs_flushinval_pages,
4706 .vop_flush_pages = fs_flush_pages,
4707 .vop_release = xfs_release,
4708 .vop_iflush = xfs_inode_flush,
4709};
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
new file mode 100644
index 000000000000..78c8841fbf94
--- /dev/null
+++ b/fs/xfs/xfs_vnodeops.h
@@ -0,0 +1,86 @@
1#ifndef _XFS_VNODEOPS_H
2#define _XFS_VNODEOPS_H 1
3
4struct attrlist_cursor_kern;
5struct bhv_vattr;
6struct cred;
7struct file;
8struct inode;
9struct iovec;
10struct kiocb;
11struct pipe_inode_info;
12struct uio;
13struct xfs_inode;
14struct xfs_iomap;
15
16
17int xfs_open(struct xfs_inode *ip);
18int xfs_getattr(struct xfs_inode *ip, struct bhv_vattr *vap, int flags);
19int xfs_setattr(struct xfs_inode *ip, struct bhv_vattr *vap, int flags,
20 struct cred *credp);
21int xfs_access(struct xfs_inode *ip, int mode, struct cred *credp);
22int xfs_readlink(struct xfs_inode *ip, char *link);
23int xfs_fsync(struct xfs_inode *ip, int flag, xfs_off_t start,
24 xfs_off_t stop);
25int xfs_release(struct xfs_inode *ip);
26int xfs_inactive(struct xfs_inode *ip);
27int xfs_lookup(struct xfs_inode *dp, bhv_vname_t *dentry,
28 bhv_vnode_t **vpp);
29int xfs_create(struct xfs_inode *dp, bhv_vname_t *dentry,
30 struct bhv_vattr *vap, bhv_vnode_t **vpp, struct cred *credp);
31int xfs_remove(struct xfs_inode *dp, bhv_vname_t *dentry);
32int xfs_link(struct xfs_inode *tdp, bhv_vnode_t *src_vp,
33 bhv_vname_t *dentry);
34int xfs_mkdir(struct xfs_inode *dp, bhv_vname_t *dentry,
35 struct bhv_vattr *vap, bhv_vnode_t **vpp, struct cred *credp);
36int xfs_rmdir(struct xfs_inode *dp, bhv_vname_t *dentry);
37int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize,
38 xfs_off_t *offset, filldir_t filldir);
39int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry,
40 struct bhv_vattr *vap, char *target_path,
41 bhv_vnode_t **vpp, struct cred *credp);
42int xfs_fid2(struct xfs_inode *ip, fid_t *fidp);
43int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype);
44void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype);
45int xfs_inode_flush(struct xfs_inode *ip, int flags);
46int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state);
47int xfs_reclaim(struct xfs_inode *ip);
48int xfs_change_file_space(struct xfs_inode *ip, int cmd,
49 xfs_flock64_t *bf, xfs_off_t offset,
50 struct cred *credp, int attr_flags);
51int xfs_rename(struct xfs_inode *src_dp, bhv_vname_t *src_vname,
52 bhv_vnode_t *target_dir_vp, bhv_vname_t *target_vname);
53int xfs_attr_get(struct xfs_inode *ip, const char *name, char *value,
54 int *valuelenp, int flags, cred_t *cred);
55int xfs_attr_set(struct xfs_inode *dp, const char *name, char *value,
56 int valuelen, int flags);
57int xfs_attr_remove(struct xfs_inode *dp, const char *name, int flags);
58int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize,
59 int flags, struct attrlist_cursor_kern *cursor);
60int xfs_ioctl(struct xfs_inode *ip, struct file *filp,
61 int ioflags, unsigned int cmd, void __user *arg);
62ssize_t xfs_read(struct xfs_inode *ip, struct kiocb *iocb,
63 const struct iovec *iovp, unsigned int segs,
64 loff_t *offset, int ioflags);
65ssize_t xfs_sendfile(struct xfs_inode *ip, struct file *filp,
66 loff_t *offset, int ioflags, size_t count,
67 read_actor_t actor, void *target);
68ssize_t xfs_splice_read(struct xfs_inode *ip, struct file *infilp,
69 loff_t *ppos, struct pipe_inode_info *pipe, size_t count,
70 int flags, int ioflags);
71ssize_t xfs_splice_write(struct xfs_inode *ip,
72 struct pipe_inode_info *pipe, struct file *outfilp,
73 loff_t *ppos, size_t count, int flags, int ioflags);
74ssize_t xfs_write(struct xfs_inode *xip, struct kiocb *iocb,
75 const struct iovec *iovp, unsigned int nsegs,
76 loff_t *offset, int ioflags);
77int xfs_bmap(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
78 int flags, struct xfs_iomap *iomapp, int *niomaps);
79void xfs_tosspages(struct xfs_inode *inode, xfs_off_t first,
80 xfs_off_t last, int fiopt);
81int xfs_flushinval_pages(struct xfs_inode *ip, xfs_off_t first,
82 xfs_off_t last, int fiopt);
83int xfs_flush_pages(struct xfs_inode *ip, xfs_off_t first,
84 xfs_off_t last, uint64_t flags, int fiopt);
85
86#endif /* _XFS_VNODEOPS_H */
diff --git a/fs/xfs/xfs_vnodeops_bhv.c b/fs/xfs/xfs_vnodeops_bhv.c
new file mode 100644
index 000000000000..c61653aed054
--- /dev/null
+++ b/fs/xfs/xfs_vnodeops_bhv.c
@@ -0,0 +1,438 @@
1
2#include "xfs_linux.h"
3#include "xfs_vnodeops.h"
4
5#include "xfs_bmap_btree.h"
6#include "xfs_inode.h"
7
8STATIC int
9xfs_bhv_open(
10 bhv_desc_t *bdp,
11 cred_t *credp)
12{
13 return xfs_open(XFS_BHVTOI(bdp));
14}
15
16STATIC int
17xfs_bhv_getattr(
18 bhv_desc_t *bdp,
19 bhv_vattr_t *vap,
20 int flags,
21 cred_t *credp)
22{
23 return xfs_getattr(XFS_BHVTOI(bdp), vap, flags);
24}
25
26int
27xfs_bhv_setattr(
28 bhv_desc_t *bdp,
29 bhv_vattr_t *vap,
30 int flags,
31 cred_t *credp)
32{
33 return xfs_setattr(XFS_BHVTOI(bdp), vap, flags, credp);
34}
35
36STATIC int
37xfs_bhv_access(
38 bhv_desc_t *bdp,
39 int mode,
40 cred_t *credp)
41{
42 return xfs_access(XFS_BHVTOI(bdp), mode, credp);
43}
44
45STATIC int
46xfs_bhv_readlink(
47 bhv_desc_t *bdp,
48 char *link)
49{
50 return xfs_readlink(XFS_BHVTOI(bdp), link);
51}
52
53STATIC int
54xfs_bhv_fsync(
55 bhv_desc_t *bdp,
56 int flag,
57 cred_t *credp,
58 xfs_off_t start,
59 xfs_off_t stop)
60{
61 return xfs_fsync(XFS_BHVTOI(bdp), flag, start, stop);
62}
63
64STATIC int
65xfs_bhv_release(
66 bhv_desc_t *bdp)
67{
68 return xfs_release(XFS_BHVTOI(bdp));
69}
70
71STATIC int
72xfs_bhv_inactive(
73 bhv_desc_t *bdp,
74 cred_t *credp)
75{
76 return xfs_inactive(XFS_BHVTOI(bdp));
77}
78
79STATIC int
80xfs_bhv_lookup(
81 bhv_desc_t *dir_bdp,
82 bhv_vname_t *dentry,
83 bhv_vnode_t **vpp,
84 int flags,
85 bhv_vnode_t *rdir,
86 cred_t *credp)
87{
88 return xfs_lookup(XFS_BHVTOI(dir_bdp), dentry, vpp);
89}
90
91STATIC int
92xfs_bhv_create(
93 bhv_desc_t *dir_bdp,
94 bhv_vname_t *dentry,
95 bhv_vattr_t *vap,
96 bhv_vnode_t **vpp,
97 cred_t *credp)
98{
99 return xfs_create(XFS_BHVTOI(dir_bdp), dentry, vap, vpp, credp);
100}
101
102STATIC int
103xfs_bhv_remove(
104 bhv_desc_t *dir_bdp,
105 bhv_vname_t *dentry,
106 cred_t *credp)
107{
108 return xfs_remove(XFS_BHVTOI(dir_bdp), dentry);
109}
110
111STATIC int
112xfs_bhv_link(
113 bhv_desc_t *target_dir_bdp,
114 bhv_vnode_t *src_vp,
115 bhv_vname_t *dentry,
116 cred_t *credp)
117{
118 return xfs_link(XFS_BHVTOI(target_dir_bdp), src_vp, dentry);
119}
120
121STATIC int
122xfs_bhv_mkdir(
123 bhv_desc_t *dir_bdp,
124 bhv_vname_t *dentry,
125 bhv_vattr_t *vap,
126 bhv_vnode_t **vpp,
127 cred_t *credp)
128{
129 return xfs_mkdir(XFS_BHVTOI(dir_bdp), dentry, vap, vpp, credp);
130}
131
132STATIC int
133xfs_bhv_rmdir(
134 bhv_desc_t *dir_bdp,
135 bhv_vname_t *dentry,
136 cred_t *credp)
137{
138 return xfs_rmdir(XFS_BHVTOI(dir_bdp), dentry);
139}
140
141STATIC int
142xfs_bhv_readdir(
143 bhv_desc_t *dir_bdp,
144 void *dirent,
145 size_t bufsize,
146 xfs_off_t *offset,
147 filldir_t filldir)
148{
149 return xfs_readdir(XFS_BHVTOI(dir_bdp), dirent, bufsize, offset, filldir);
150}
151
152STATIC int
153xfs_bhv_symlink(
154 bhv_desc_t *dir_bdp,
155 bhv_vname_t *dentry,
156 bhv_vattr_t *vap,
157 char *target_path,
158 bhv_vnode_t **vpp,
159 cred_t *credp)
160{
161 return xfs_symlink(XFS_BHVTOI(dir_bdp), dentry, vap, target_path, vpp, credp);
162}
163
164STATIC int
165xfs_bhv_fid2(
166 bhv_desc_t *bdp,
167 fid_t *fidp)
168{
169 return xfs_fid2(XFS_BHVTOI(bdp), fidp);
170}
171
172STATIC int
173xfs_bhv_rwlock(
174 bhv_desc_t *bdp,
175 bhv_vrwlock_t locktype)
176{
177 return xfs_rwlock(XFS_BHVTOI(bdp), locktype);
178}
179
180STATIC void
181xfs_bhv_rwunlock(
182 bhv_desc_t *bdp,
183 bhv_vrwlock_t locktype)
184{
185 xfs_rwunlock(XFS_BHVTOI(bdp), locktype);
186}
187
188STATIC int
189xfs_bhv_inode_flush(
190 bhv_desc_t *bdp,
191 int flags)
192{
193 return xfs_inode_flush(XFS_BHVTOI(bdp), flags);
194}
195
196STATIC int
197xfs_bhv_reclaim(
198 bhv_desc_t *bdp)
199{
200 return xfs_reclaim(XFS_BHVTOI(bdp));
201}
202
203STATIC int
204xfs_bhv_rename(
205 bhv_desc_t *src_dir_bdp,
206 bhv_vname_t *src_vname,
207 bhv_vnode_t *target_dir_vp,
208 bhv_vname_t *target_vname,
209 cred_t *credp)
210{
211 return xfs_rename(XFS_BHVTOI(src_dir_bdp), src_vname,
212 target_dir_vp, target_vname);
213}
214
215STATIC int
216xfs_bhv_attr_get(
217 bhv_desc_t *bdp,
218 const char *name,
219 char *value,
220 int *valuelenp,
221 int flags,
222 cred_t *cred)
223{
224 return xfs_attr_get(XFS_BHVTOI(bdp), name, value, valuelenp,
225 flags, cred);
226}
227
228STATIC int
229xfs_bhv_attr_set(
230 bhv_desc_t *bdp,
231 const char *name,
232 char *value,
233 int valuelen,
234 int flags,
235 cred_t *cred)
236{
237 return xfs_attr_set(XFS_BHVTOI(bdp), name, value, valuelen,
238 flags);
239}
240
241STATIC int
242xfs_bhv_attr_remove(
243 bhv_desc_t *bdp,
244 const char *name,
245 int flags,
246 cred_t *cred)
247{
248 return xfs_attr_remove(XFS_BHVTOI(bdp), name, flags);
249}
250
251STATIC int
252xfs_bhv_attr_list(
253 bhv_desc_t *bdp,
254 char *buffer,
255 int bufsize,
256 int flags,
257 struct attrlist_cursor_kern *cursor,
258 cred_t *cred)
259{
260 return xfs_attr_list(XFS_BHVTOI(bdp), buffer, bufsize, flags,
261 cursor);
262}
263
264STATIC int
265xfs_bhv_ioctl(
266 bhv_desc_t *bdp,
267 struct inode *inode,
268 struct file *filp,
269 int ioflags,
270 unsigned int cmd,
271 void __user *arg)
272{
273 return xfs_ioctl(XFS_BHVTOI(bdp), filp, ioflags, cmd, arg);
274}
275
276STATIC ssize_t
277xfs_bhv_read(
278 bhv_desc_t *bdp,
279 struct kiocb *iocb,
280 const struct iovec *iovp,
281 unsigned int segs,
282 loff_t *offset,
283 int ioflags,
284 cred_t *credp)
285{
286 return xfs_read(XFS_BHVTOI(bdp), iocb, iovp, segs,
287 offset, ioflags);
288}
289
290STATIC ssize_t
291xfs_bhv_sendfile(
292 bhv_desc_t *bdp,
293 struct file *filp,
294 loff_t *offset,
295 int ioflags,
296 size_t count,
297 read_actor_t actor,
298 void *target,
299 cred_t *credp)
300{
301 return xfs_sendfile(XFS_BHVTOI(bdp), filp, offset, ioflags,
302 count, actor, target);
303}
304
305STATIC ssize_t
306xfs_bhv_splice_read(
307 bhv_desc_t *bdp,
308 struct file *infilp,
309 loff_t *ppos,
310 struct pipe_inode_info *pipe,
311 size_t count,
312 int flags,
313 int ioflags,
314 cred_t *credp)
315{
316 return xfs_splice_read(XFS_BHVTOI(bdp), infilp, ppos, pipe,
317 count, flags, ioflags);
318}
319
320STATIC ssize_t
321xfs_bhv_splice_write(
322 bhv_desc_t *bdp,
323 struct pipe_inode_info *pipe,
324 struct file *outfilp,
325 loff_t *ppos,
326 size_t count,
327 int flags,
328 int ioflags,
329 cred_t *credp)
330{
331 return xfs_splice_write(XFS_BHVTOI(bdp), pipe, outfilp, ppos,
332 count, flags, ioflags);
333}
334
335STATIC ssize_t
336xfs_bhv_write(
337 bhv_desc_t *bdp,
338 struct kiocb *iocb,
339 const struct iovec *iovp,
340 unsigned int nsegs,
341 loff_t *offset,
342 int ioflags,
343 cred_t *credp)
344{
345 return xfs_write(XFS_BHVTOI(bdp), iocb, iovp, nsegs, offset,
346 ioflags);
347}
348
349STATIC int
350xfs_bhv_bmap(bhv_desc_t *bdp,
351 xfs_off_t offset,
352 ssize_t count,
353 int flags,
354 struct xfs_iomap *iomapp,
355 int *niomaps)
356{
357 return xfs_bmap(XFS_BHVTOI(bdp), offset, count, flags,
358 iomapp, niomaps);
359}
360
361STATIC void
362fs_tosspages(
363 bhv_desc_t *bdp,
364 xfs_off_t first,
365 xfs_off_t last,
366 int fiopt)
367{
368 xfs_tosspages(XFS_BHVTOI(bdp), first, last, fiopt);
369}
370
371STATIC int
372fs_flushinval_pages(
373 bhv_desc_t *bdp,
374 xfs_off_t first,
375 xfs_off_t last,
376 int fiopt)
377{
378 return xfs_flushinval_pages(XFS_BHVTOI(bdp), first, last,
379 fiopt);
380}
381
382STATIC int
383fs_flush_pages(
384 bhv_desc_t *bdp,
385 xfs_off_t first,
386 xfs_off_t last,
387 uint64_t flags,
388 int fiopt)
389{
390 return xfs_flush_pages(XFS_BHVTOI(bdp), first, last, flags,
391 fiopt);
392}
393
394bhv_vnodeops_t xfs_vnodeops = {
395 BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS),
396 .vop_open = xfs_bhv_open,
397 .vop_read = xfs_bhv_read,
398#ifdef HAVE_SENDFILE
399 .vop_sendfile = xfs_bhv_sendfile,
400#endif
401#ifdef HAVE_SPLICE
402 .vop_splice_read = xfs_bhv_splice_read,
403 .vop_splice_write = xfs_bhv_splice_write,
404#endif
405 .vop_write = xfs_bhv_write,
406 .vop_ioctl = xfs_bhv_ioctl,
407 .vop_getattr = xfs_bhv_getattr,
408 .vop_setattr = xfs_bhv_setattr,
409 .vop_access = xfs_bhv_access,
410 .vop_lookup = xfs_bhv_lookup,
411 .vop_create = xfs_bhv_create,
412 .vop_remove = xfs_bhv_remove,
413 .vop_link = xfs_bhv_link,
414 .vop_rename = xfs_bhv_rename,
415 .vop_mkdir = xfs_bhv_mkdir,
416 .vop_rmdir = xfs_bhv_rmdir,
417 .vop_readdir = xfs_bhv_readdir,
418 .vop_symlink = xfs_bhv_symlink,
419 .vop_readlink = xfs_bhv_readlink,
420 .vop_fsync = xfs_bhv_fsync,
421 .vop_inactive = xfs_bhv_inactive,
422 .vop_fid2 = xfs_bhv_fid2,
423 .vop_rwlock = xfs_bhv_rwlock,
424 .vop_rwunlock = xfs_bhv_rwunlock,
425 .vop_bmap = xfs_bhv_bmap,
426 .vop_reclaim = xfs_bhv_reclaim,
427 .vop_attr_get = xfs_bhv_attr_get,
428 .vop_attr_set = xfs_bhv_attr_set,
429 .vop_attr_remove = xfs_bhv_attr_remove,
430 .vop_attr_list = xfs_bhv_attr_list,
431 .vop_link_removed = (vop_link_removed_t)fs_noval,
432 .vop_vnode_change = (vop_vnode_change_t)fs_noval,
433 .vop_tosspages = fs_tosspages,
434 .vop_flushinval_pages = fs_flushinval_pages,
435 .vop_flush_pages = fs_flush_pages,
436 .vop_release = xfs_bhv_release,
437 .vop_iflush = xfs_bhv_inode_flush,
438};