diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 295 |
1 files changed, 147 insertions, 148 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 7027ae68ee38..00a6b7dc24a0 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. | 2 | * Copyright (c) 2000-2006 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | 3 | * All Rights Reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -16,8 +16,6 @@ | |||
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 | 18 | ||
19 | #include <linux/capability.h> | ||
20 | |||
21 | #include "xfs.h" | 19 | #include "xfs.h" |
22 | #include "xfs_fs.h" | 20 | #include "xfs_fs.h" |
23 | #include "xfs_types.h" | 21 | #include "xfs_types.h" |
@@ -27,7 +25,6 @@ | |||
27 | #include "xfs_trans.h" | 25 | #include "xfs_trans.h" |
28 | #include "xfs_sb.h" | 26 | #include "xfs_sb.h" |
29 | #include "xfs_ag.h" | 27 | #include "xfs_ag.h" |
30 | #include "xfs_dir.h" | ||
31 | #include "xfs_dir2.h" | 28 | #include "xfs_dir2.h" |
32 | #include "xfs_dmapi.h" | 29 | #include "xfs_dmapi.h" |
33 | #include "xfs_mount.h" | 30 | #include "xfs_mount.h" |
@@ -35,13 +32,11 @@ | |||
35 | #include "xfs_bmap_btree.h" | 32 | #include "xfs_bmap_btree.h" |
36 | #include "xfs_alloc_btree.h" | 33 | #include "xfs_alloc_btree.h" |
37 | #include "xfs_ialloc_btree.h" | 34 | #include "xfs_ialloc_btree.h" |
38 | #include "xfs_dir_sf.h" | ||
39 | #include "xfs_dir2_sf.h" | 35 | #include "xfs_dir2_sf.h" |
40 | #include "xfs_attr_sf.h" | 36 | #include "xfs_attr_sf.h" |
41 | #include "xfs_dinode.h" | 37 | #include "xfs_dinode.h" |
42 | #include "xfs_inode.h" | 38 | #include "xfs_inode.h" |
43 | #include "xfs_inode_item.h" | 39 | #include "xfs_inode_item.h" |
44 | #include "xfs_dir_leaf.h" | ||
45 | #include "xfs_itable.h" | 40 | #include "xfs_itable.h" |
46 | #include "xfs_btree.h" | 41 | #include "xfs_btree.h" |
47 | #include "xfs_ialloc.h" | 42 | #include "xfs_ialloc.h" |
@@ -58,32 +53,14 @@ | |||
58 | #include "xfs_log_priv.h" | 53 | #include "xfs_log_priv.h" |
59 | #include "xfs_mac.h" | 54 | #include "xfs_mac.h" |
60 | 55 | ||
61 | |||
62 | /* | ||
63 | * The maximum pathlen is 1024 bytes. Since the minimum file system | ||
64 | * blocksize is 512 bytes, we can get a max of 2 extents back from | ||
65 | * bmapi. | ||
66 | */ | ||
67 | #define SYMLINK_MAPS 2 | ||
68 | |||
69 | /* | ||
70 | * For xfs, we check that the file isn't too big to be opened by this kernel. | ||
71 | * No other open action is required for regular files. Devices are handled | ||
72 | * through the specfs file system, pipes through fifofs. Device and | ||
73 | * fifo vnodes are "wrapped" by specfs and fifofs vnodes, respectively, | ||
74 | * when a new vnode is first looked up or created. | ||
75 | */ | ||
76 | STATIC int | 56 | STATIC int |
77 | xfs_open( | 57 | xfs_open( |
78 | bhv_desc_t *bdp, | 58 | bhv_desc_t *bdp, |
79 | cred_t *credp) | 59 | cred_t *credp) |
80 | { | 60 | { |
81 | int mode; | 61 | int mode; |
82 | vnode_t *vp; | 62 | bhv_vnode_t *vp = BHV_TO_VNODE(bdp); |
83 | xfs_inode_t *ip; | 63 | xfs_inode_t *ip = XFS_BHVTOI(bdp); |
84 | |||
85 | vp = BHV_TO_VNODE(bdp); | ||
86 | ip = XFS_BHVTOI(bdp); | ||
87 | 64 | ||
88 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) | 65 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) |
89 | return XFS_ERROR(EIO); | 66 | return XFS_ERROR(EIO); |
@@ -101,6 +78,35 @@ xfs_open( | |||
101 | return 0; | 78 | return 0; |
102 | } | 79 | } |
103 | 80 | ||
81 | STATIC int | ||
82 | xfs_close( | ||
83 | bhv_desc_t *bdp, | ||
84 | int flags, | ||
85 | lastclose_t lastclose, | ||
86 | cred_t *credp) | ||
87 | { | ||
88 | bhv_vnode_t *vp = BHV_TO_VNODE(bdp); | ||
89 | xfs_inode_t *ip = XFS_BHVTOI(bdp); | ||
90 | |||
91 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) | ||
92 | return XFS_ERROR(EIO); | ||
93 | |||
94 | if (lastclose != L_TRUE || !VN_ISREG(vp)) | ||
95 | return 0; | ||
96 | |||
97 | /* | ||
98 | * If we previously truncated this file and removed old data in | ||
99 | * the process, we want to initiate "early" writeout on the last | ||
100 | * close. This is an attempt to combat the notorious NULL files | ||
101 | * problem which is particularly noticable from a truncate down, | ||
102 | * buffered (re-)write (delalloc), followed by a crash. What we | ||
103 | * are effectively doing here is significantly reducing the time | ||
104 | * window where we'd otherwise be exposed to that problem. | ||
105 | */ | ||
106 | if (VUNTRUNCATE(vp) && VN_DIRTY(vp) && ip->i_delayed_blks > 0) | ||
107 | return bhv_vop_flush_pages(vp, 0, -1, XFS_B_ASYNC, FI_NONE); | ||
108 | return 0; | ||
109 | } | ||
104 | 110 | ||
105 | /* | 111 | /* |
106 | * xfs_getattr | 112 | * xfs_getattr |
@@ -108,13 +114,13 @@ xfs_open( | |||
108 | STATIC int | 114 | STATIC int |
109 | xfs_getattr( | 115 | xfs_getattr( |
110 | bhv_desc_t *bdp, | 116 | bhv_desc_t *bdp, |
111 | vattr_t *vap, | 117 | bhv_vattr_t *vap, |
112 | int flags, | 118 | int flags, |
113 | cred_t *credp) | 119 | cred_t *credp) |
114 | { | 120 | { |
115 | xfs_inode_t *ip; | 121 | xfs_inode_t *ip; |
116 | xfs_mount_t *mp; | 122 | xfs_mount_t *mp; |
117 | vnode_t *vp; | 123 | bhv_vnode_t *vp; |
118 | 124 | ||
119 | vp = BHV_TO_VNODE(bdp); | 125 | vp = BHV_TO_VNODE(bdp); |
120 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); | 126 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); |
@@ -241,7 +247,7 @@ xfs_getattr( | |||
241 | int | 247 | int |
242 | xfs_setattr( | 248 | xfs_setattr( |
243 | bhv_desc_t *bdp, | 249 | bhv_desc_t *bdp, |
244 | vattr_t *vap, | 250 | bhv_vattr_t *vap, |
245 | int flags, | 251 | int flags, |
246 | cred_t *credp) | 252 | cred_t *credp) |
247 | { | 253 | { |
@@ -255,7 +261,7 @@ xfs_setattr( | |||
255 | uid_t uid=0, iuid=0; | 261 | uid_t uid=0, iuid=0; |
256 | gid_t gid=0, igid=0; | 262 | gid_t gid=0, igid=0; |
257 | int timeflags = 0; | 263 | int timeflags = 0; |
258 | vnode_t *vp; | 264 | bhv_vnode_t *vp; |
259 | xfs_prid_t projid=0, iprojid=0; | 265 | xfs_prid_t projid=0, iprojid=0; |
260 | int mandlock_before, mandlock_after; | 266 | int mandlock_before, mandlock_after; |
261 | struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; | 267 | struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; |
@@ -347,7 +353,6 @@ xfs_setattr( | |||
347 | */ | 353 | */ |
348 | tp = NULL; | 354 | tp = NULL; |
349 | lock_flags = XFS_ILOCK_EXCL; | 355 | lock_flags = XFS_ILOCK_EXCL; |
350 | ASSERT(flags & ATTR_NOLOCK ? flags & ATTR_DMI : 1); | ||
351 | if (flags & ATTR_NOLOCK) | 356 | if (flags & ATTR_NOLOCK) |
352 | need_iolock = 0; | 357 | need_iolock = 0; |
353 | if (!(mask & XFS_AT_SIZE)) { | 358 | if (!(mask & XFS_AT_SIZE)) { |
@@ -666,9 +671,17 @@ xfs_setattr( | |||
666 | ((ip->i_d.di_nlink != 0 || | 671 | ((ip->i_d.di_nlink != 0 || |
667 | !(mp->m_flags & XFS_MOUNT_WSYNC)) | 672 | !(mp->m_flags & XFS_MOUNT_WSYNC)) |
668 | ? 1 : 0)); | 673 | ? 1 : 0)); |
669 | if (code) { | 674 | if (code) |
670 | goto abort_return; | 675 | goto abort_return; |
671 | } | 676 | /* |
677 | * Truncated "down", so we're removing references | ||
678 | * to old data here - if we now delay flushing for | ||
679 | * a long time, we expose ourselves unduly to the | ||
680 | * notorious NULL files problem. So, we mark this | ||
681 | * vnode and flush it when the file is closed, and | ||
682 | * do not wait the usual (long) time for writeout. | ||
683 | */ | ||
684 | VTRUNCATE(vp); | ||
672 | } | 685 | } |
673 | /* | 686 | /* |
674 | * Have to do this even if the file's size doesn't change. | 687 | * Have to do this even if the file's size doesn't change. |
@@ -800,6 +813,8 @@ xfs_setattr( | |||
800 | di_flags |= XFS_DIFLAG_NODUMP; | 813 | di_flags |= XFS_DIFLAG_NODUMP; |
801 | if (vap->va_xflags & XFS_XFLAG_PROJINHERIT) | 814 | if (vap->va_xflags & XFS_XFLAG_PROJINHERIT) |
802 | di_flags |= XFS_DIFLAG_PROJINHERIT; | 815 | di_flags |= XFS_DIFLAG_PROJINHERIT; |
816 | if (vap->va_xflags & XFS_XFLAG_NODEFRAG) | ||
817 | di_flags |= XFS_DIFLAG_NODEFRAG; | ||
803 | if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { | 818 | if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { |
804 | if (vap->va_xflags & XFS_XFLAG_RTINHERIT) | 819 | if (vap->va_xflags & XFS_XFLAG_RTINHERIT) |
805 | di_flags |= XFS_DIFLAG_RTINHERIT; | 820 | di_flags |= XFS_DIFLAG_RTINHERIT; |
@@ -869,7 +884,7 @@ xfs_setattr( | |||
869 | */ | 884 | */ |
870 | mandlock_after = MANDLOCK(vp, ip->i_d.di_mode); | 885 | mandlock_after = MANDLOCK(vp, ip->i_d.di_mode); |
871 | if (mandlock_before != mandlock_after) { | 886 | if (mandlock_before != mandlock_after) { |
872 | VOP_VNODE_CHANGE(vp, VCHANGE_FLAGS_ENF_LOCKING, | 887 | bhv_vop_vnode_change(vp, VCHANGE_FLAGS_ENF_LOCKING, |
873 | mandlock_after); | 888 | mandlock_after); |
874 | } | 889 | } |
875 | 890 | ||
@@ -936,6 +951,13 @@ xfs_access( | |||
936 | 951 | ||
937 | 952 | ||
938 | /* | 953 | /* |
954 | * The maximum pathlen is 1024 bytes. Since the minimum file system | ||
955 | * blocksize is 512 bytes, we can get a max of 2 extents back from | ||
956 | * bmapi. | ||
957 | */ | ||
958 | #define SYMLINK_MAPS 2 | ||
959 | |||
960 | /* | ||
939 | * xfs_readlink | 961 | * xfs_readlink |
940 | * | 962 | * |
941 | */ | 963 | */ |
@@ -950,7 +972,7 @@ xfs_readlink( | |||
950 | int count; | 972 | int count; |
951 | xfs_off_t offset; | 973 | xfs_off_t offset; |
952 | int pathlen; | 974 | int pathlen; |
953 | vnode_t *vp; | 975 | bhv_vnode_t *vp; |
954 | int error = 0; | 976 | int error = 0; |
955 | xfs_mount_t *mp; | 977 | xfs_mount_t *mp; |
956 | int nmaps; | 978 | int nmaps; |
@@ -1000,7 +1022,7 @@ xfs_readlink( | |||
1000 | nmaps = SYMLINK_MAPS; | 1022 | nmaps = SYMLINK_MAPS; |
1001 | 1023 | ||
1002 | error = xfs_bmapi(NULL, ip, 0, XFS_B_TO_FSB(mp, pathlen), | 1024 | error = xfs_bmapi(NULL, ip, 0, XFS_B_TO_FSB(mp, pathlen), |
1003 | 0, NULL, 0, mval, &nmaps, NULL); | 1025 | 0, NULL, 0, mval, &nmaps, NULL, NULL); |
1004 | 1026 | ||
1005 | if (error) { | 1027 | if (error) { |
1006 | goto error_return; | 1028 | goto error_return; |
@@ -1208,8 +1230,8 @@ xfs_inactive_free_eofblocks( | |||
1208 | 1230 | ||
1209 | nimaps = 1; | 1231 | nimaps = 1; |
1210 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 1232 | xfs_ilock(ip, XFS_ILOCK_SHARED); |
1211 | error = xfs_bmapi(NULL, ip, end_fsb, map_len, 0, | 1233 | error = XFS_BMAPI(mp, NULL, &ip->i_iocore, end_fsb, map_len, 0, |
1212 | NULL, 0, &imap, &nimaps, NULL); | 1234 | NULL, 0, &imap, &nimaps, NULL, NULL); |
1213 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | 1235 | xfs_iunlock(ip, XFS_ILOCK_SHARED); |
1214 | 1236 | ||
1215 | if (!error && (nimaps != 0) && | 1237 | if (!error && (nimaps != 0) && |
@@ -1338,7 +1360,7 @@ xfs_inactive_symlink_rmt( | |||
1338 | nmaps = ARRAY_SIZE(mval); | 1360 | nmaps = ARRAY_SIZE(mval); |
1339 | if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size), | 1361 | if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size), |
1340 | XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps, | 1362 | XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps, |
1341 | &free_list))) | 1363 | &free_list, NULL))) |
1342 | goto error0; | 1364 | goto error0; |
1343 | /* | 1365 | /* |
1344 | * Invalidate the block(s). | 1366 | * Invalidate the block(s). |
@@ -1353,7 +1375,7 @@ xfs_inactive_symlink_rmt( | |||
1353 | * Unmap the dead block(s) to the free_list. | 1375 | * Unmap the dead block(s) to the free_list. |
1354 | */ | 1376 | */ |
1355 | if ((error = xfs_bunmapi(tp, ip, 0, size, XFS_BMAPI_METADATA, nmaps, | 1377 | if ((error = xfs_bunmapi(tp, ip, 0, size, XFS_BMAPI_METADATA, nmaps, |
1356 | &first_block, &free_list, &done))) | 1378 | &first_block, &free_list, NULL, &done))) |
1357 | goto error1; | 1379 | goto error1; |
1358 | ASSERT(done); | 1380 | ASSERT(done); |
1359 | /* | 1381 | /* |
@@ -1469,9 +1491,6 @@ xfs_inactive_symlink_local( | |||
1469 | return 0; | 1491 | return 0; |
1470 | } | 1492 | } |
1471 | 1493 | ||
1472 | /* | ||
1473 | * | ||
1474 | */ | ||
1475 | STATIC int | 1494 | STATIC int |
1476 | xfs_inactive_attrs( | 1495 | xfs_inactive_attrs( |
1477 | xfs_inode_t *ip, | 1496 | xfs_inode_t *ip, |
@@ -1524,16 +1543,16 @@ xfs_release( | |||
1524 | bhv_desc_t *bdp) | 1543 | bhv_desc_t *bdp) |
1525 | { | 1544 | { |
1526 | xfs_inode_t *ip; | 1545 | xfs_inode_t *ip; |
1527 | vnode_t *vp; | 1546 | bhv_vnode_t *vp; |
1528 | xfs_mount_t *mp; | 1547 | xfs_mount_t *mp; |
1529 | int error; | 1548 | int error; |
1530 | 1549 | ||
1531 | vp = BHV_TO_VNODE(bdp); | 1550 | vp = BHV_TO_VNODE(bdp); |
1532 | ip = XFS_BHVTOI(bdp); | 1551 | ip = XFS_BHVTOI(bdp); |
1552 | mp = ip->i_mount; | ||
1533 | 1553 | ||
1534 | if (!VN_ISREG(vp) || (ip->i_d.di_mode == 0)) { | 1554 | if (!VN_ISREG(vp) || (ip->i_d.di_mode == 0)) |
1535 | return 0; | 1555 | return 0; |
1536 | } | ||
1537 | 1556 | ||
1538 | /* If this is a read-only mount, don't do this (would generate I/O) */ | 1557 | /* If this is a read-only mount, don't do this (would generate I/O) */ |
1539 | if (vp->v_vfsp->vfs_flag & VFS_RDONLY) | 1558 | if (vp->v_vfsp->vfs_flag & VFS_RDONLY) |
@@ -1545,8 +1564,6 @@ xfs_release( | |||
1545 | return 0; | 1564 | return 0; |
1546 | #endif | 1565 | #endif |
1547 | 1566 | ||
1548 | mp = ip->i_mount; | ||
1549 | |||
1550 | if (ip->i_d.di_nlink != 0) { | 1567 | if (ip->i_d.di_nlink != 0) { |
1551 | if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && | 1568 | if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && |
1552 | ((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0 || | 1569 | ((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0 || |
@@ -1579,8 +1596,8 @@ xfs_inactive( | |||
1579 | cred_t *credp) | 1596 | cred_t *credp) |
1580 | { | 1597 | { |
1581 | xfs_inode_t *ip; | 1598 | xfs_inode_t *ip; |
1582 | vnode_t *vp; | 1599 | bhv_vnode_t *vp; |
1583 | xfs_bmap_free_t free_list; | 1600 | xfs_bmap_free_t free_list; |
1584 | xfs_fsblock_t first_block; | 1601 | xfs_fsblock_t first_block; |
1585 | int committed; | 1602 | int committed; |
1586 | xfs_trans_t *tp; | 1603 | xfs_trans_t *tp; |
@@ -1760,7 +1777,7 @@ xfs_inactive( | |||
1760 | cmn_err(CE_NOTE, | 1777 | cmn_err(CE_NOTE, |
1761 | "xfs_inactive: xfs_ifree() returned an error = %d on %s", | 1778 | "xfs_inactive: xfs_ifree() returned an error = %d on %s", |
1762 | error, mp->m_fsname); | 1779 | error, mp->m_fsname); |
1763 | xfs_force_shutdown(mp, XFS_METADATA_IO_ERROR); | 1780 | xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); |
1764 | } | 1781 | } |
1765 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_ABORT); | 1782 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_ABORT); |
1766 | } else { | 1783 | } else { |
@@ -1795,17 +1812,17 @@ xfs_inactive( | |||
1795 | STATIC int | 1812 | STATIC int |
1796 | xfs_lookup( | 1813 | xfs_lookup( |
1797 | bhv_desc_t *dir_bdp, | 1814 | bhv_desc_t *dir_bdp, |
1798 | vname_t *dentry, | 1815 | bhv_vname_t *dentry, |
1799 | vnode_t **vpp, | 1816 | bhv_vnode_t **vpp, |
1800 | int flags, | 1817 | int flags, |
1801 | vnode_t *rdir, | 1818 | bhv_vnode_t *rdir, |
1802 | cred_t *credp) | 1819 | cred_t *credp) |
1803 | { | 1820 | { |
1804 | xfs_inode_t *dp, *ip; | 1821 | xfs_inode_t *dp, *ip; |
1805 | xfs_ino_t e_inum; | 1822 | xfs_ino_t e_inum; |
1806 | int error; | 1823 | int error; |
1807 | uint lock_mode; | 1824 | uint lock_mode; |
1808 | vnode_t *dir_vp; | 1825 | bhv_vnode_t *dir_vp; |
1809 | 1826 | ||
1810 | dir_vp = BHV_TO_VNODE(dir_bdp); | 1827 | dir_vp = BHV_TO_VNODE(dir_bdp); |
1811 | vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address); | 1828 | vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address); |
@@ -1832,15 +1849,15 @@ xfs_lookup( | |||
1832 | STATIC int | 1849 | STATIC int |
1833 | xfs_create( | 1850 | xfs_create( |
1834 | bhv_desc_t *dir_bdp, | 1851 | bhv_desc_t *dir_bdp, |
1835 | vname_t *dentry, | 1852 | bhv_vname_t *dentry, |
1836 | vattr_t *vap, | 1853 | bhv_vattr_t *vap, |
1837 | vnode_t **vpp, | 1854 | bhv_vnode_t **vpp, |
1838 | cred_t *credp) | 1855 | cred_t *credp) |
1839 | { | 1856 | { |
1840 | char *name = VNAME(dentry); | 1857 | char *name = VNAME(dentry); |
1841 | vnode_t *dir_vp; | 1858 | bhv_vnode_t *dir_vp; |
1842 | xfs_inode_t *dp, *ip; | 1859 | xfs_inode_t *dp, *ip; |
1843 | vnode_t *vp=NULL; | 1860 | bhv_vnode_t *vp = NULL; |
1844 | xfs_trans_t *tp; | 1861 | xfs_trans_t *tp; |
1845 | xfs_mount_t *mp; | 1862 | xfs_mount_t *mp; |
1846 | xfs_dev_t rdev; | 1863 | xfs_dev_t rdev; |
@@ -1938,8 +1955,7 @@ xfs_create( | |||
1938 | if (error) | 1955 | if (error) |
1939 | goto error_return; | 1956 | goto error_return; |
1940 | 1957 | ||
1941 | if (resblks == 0 && | 1958 | if (resblks == 0 && (error = xfs_dir_canenter(tp, dp, name, namelen))) |
1942 | (error = XFS_DIR_CANENTER(mp, tp, dp, name, namelen))) | ||
1943 | goto error_return; | 1959 | goto error_return; |
1944 | rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0; | 1960 | rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0; |
1945 | error = xfs_dir_ialloc(&tp, dp, vap->va_mode, 1, | 1961 | error = xfs_dir_ialloc(&tp, dp, vap->va_mode, 1, |
@@ -1970,9 +1986,9 @@ xfs_create( | |||
1970 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | 1986 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
1971 | dp_joined_to_trans = B_TRUE; | 1987 | dp_joined_to_trans = B_TRUE; |
1972 | 1988 | ||
1973 | error = XFS_DIR_CREATENAME(mp, tp, dp, name, namelen, ip->i_ino, | 1989 | error = xfs_dir_createname(tp, dp, name, namelen, ip->i_ino, |
1974 | &first_block, &free_list, | 1990 | &first_block, &free_list, resblks ? |
1975 | resblks ? resblks - XFS_IALLOC_SPACE_RES(mp) : 0); | 1991 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); |
1976 | if (error) { | 1992 | if (error) { |
1977 | ASSERT(error != ENOSPC); | 1993 | ASSERT(error != ENOSPC); |
1978 | goto abort_return; | 1994 | goto abort_return; |
@@ -2026,7 +2042,7 @@ xfs_create( | |||
2026 | * Propagate the fact that the vnode changed after the | 2042 | * Propagate the fact that the vnode changed after the |
2027 | * xfs_inode locks have been released. | 2043 | * xfs_inode locks have been released. |
2028 | */ | 2044 | */ |
2029 | VOP_VNODE_CHANGE(vp, VCHANGE_FLAGS_TRUNCATED, 3); | 2045 | bhv_vop_vnode_change(vp, VCHANGE_FLAGS_TRUNCATED, 3); |
2030 | 2046 | ||
2031 | *vpp = vp; | 2047 | *vpp = vp; |
2032 | 2048 | ||
@@ -2107,7 +2123,7 @@ int xfs_rm_attempts; | |||
2107 | STATIC int | 2123 | STATIC int |
2108 | xfs_lock_dir_and_entry( | 2124 | xfs_lock_dir_and_entry( |
2109 | xfs_inode_t *dp, | 2125 | xfs_inode_t *dp, |
2110 | vname_t *dentry, | 2126 | bhv_vname_t *dentry, |
2111 | xfs_inode_t *ip) /* inode of entry 'name' */ | 2127 | xfs_inode_t *ip) /* inode of entry 'name' */ |
2112 | { | 2128 | { |
2113 | int attempts; | 2129 | int attempts; |
@@ -2321,10 +2337,10 @@ int remove_which_error_return = 0; | |||
2321 | STATIC int | 2337 | STATIC int |
2322 | xfs_remove( | 2338 | xfs_remove( |
2323 | bhv_desc_t *dir_bdp, | 2339 | bhv_desc_t *dir_bdp, |
2324 | vname_t *dentry, | 2340 | bhv_vname_t *dentry, |
2325 | cred_t *credp) | 2341 | cred_t *credp) |
2326 | { | 2342 | { |
2327 | vnode_t *dir_vp; | 2343 | bhv_vnode_t *dir_vp; |
2328 | char *name = VNAME(dentry); | 2344 | char *name = VNAME(dentry); |
2329 | xfs_inode_t *dp, *ip; | 2345 | xfs_inode_t *dp, *ip; |
2330 | xfs_trans_t *tp = NULL; | 2346 | xfs_trans_t *tp = NULL; |
@@ -2448,8 +2464,8 @@ xfs_remove( | |||
2448 | * Entry must exist since we did a lookup in xfs_lock_dir_and_entry. | 2464 | * Entry must exist since we did a lookup in xfs_lock_dir_and_entry. |
2449 | */ | 2465 | */ |
2450 | XFS_BMAP_INIT(&free_list, &first_block); | 2466 | XFS_BMAP_INIT(&free_list, &first_block); |
2451 | error = XFS_DIR_REMOVENAME(mp, tp, dp, name, namelen, ip->i_ino, | 2467 | error = xfs_dir_removename(tp, dp, name, namelen, ip->i_ino, |
2452 | &first_block, &free_list, 0); | 2468 | &first_block, &free_list, 0); |
2453 | if (error) { | 2469 | if (error) { |
2454 | ASSERT(error != ENOENT); | 2470 | ASSERT(error != ENOENT); |
2455 | REMOVE_DEBUG_TRACE(__LINE__); | 2471 | REMOVE_DEBUG_TRACE(__LINE__); |
@@ -2511,7 +2527,7 @@ xfs_remove( | |||
2511 | /* | 2527 | /* |
2512 | * Let interposed file systems know about removed links. | 2528 | * Let interposed file systems know about removed links. |
2513 | */ | 2529 | */ |
2514 | VOP_LINK_REMOVED(XFS_ITOV(ip), dir_vp, link_zero); | 2530 | bhv_vop_link_removed(XFS_ITOV(ip), dir_vp, link_zero); |
2515 | 2531 | ||
2516 | IRELE(ip); | 2532 | IRELE(ip); |
2517 | 2533 | ||
@@ -2564,8 +2580,8 @@ xfs_remove( | |||
2564 | STATIC int | 2580 | STATIC int |
2565 | xfs_link( | 2581 | xfs_link( |
2566 | bhv_desc_t *target_dir_bdp, | 2582 | bhv_desc_t *target_dir_bdp, |
2567 | vnode_t *src_vp, | 2583 | bhv_vnode_t *src_vp, |
2568 | vname_t *dentry, | 2584 | bhv_vname_t *dentry, |
2569 | cred_t *credp) | 2585 | cred_t *credp) |
2570 | { | 2586 | { |
2571 | xfs_inode_t *tdp, *sip; | 2587 | xfs_inode_t *tdp, *sip; |
@@ -2577,7 +2593,7 @@ xfs_link( | |||
2577 | xfs_fsblock_t first_block; | 2593 | xfs_fsblock_t first_block; |
2578 | int cancel_flags; | 2594 | int cancel_flags; |
2579 | int committed; | 2595 | int committed; |
2580 | vnode_t *target_dir_vp; | 2596 | bhv_vnode_t *target_dir_vp; |
2581 | int resblks; | 2597 | int resblks; |
2582 | char *target_name = VNAME(dentry); | 2598 | char *target_name = VNAME(dentry); |
2583 | int target_namelen; | 2599 | int target_namelen; |
@@ -2668,13 +2684,12 @@ xfs_link( | |||
2668 | } | 2684 | } |
2669 | 2685 | ||
2670 | if (resblks == 0 && | 2686 | if (resblks == 0 && |
2671 | (error = XFS_DIR_CANENTER(mp, tp, tdp, target_name, | 2687 | (error = xfs_dir_canenter(tp, tdp, target_name, target_namelen))) |
2672 | target_namelen))) | ||
2673 | goto error_return; | 2688 | goto error_return; |
2674 | 2689 | ||
2675 | XFS_BMAP_INIT(&free_list, &first_block); | 2690 | XFS_BMAP_INIT(&free_list, &first_block); |
2676 | 2691 | ||
2677 | error = XFS_DIR_CREATENAME(mp, tp, tdp, target_name, target_namelen, | 2692 | error = xfs_dir_createname(tp, tdp, target_name, target_namelen, |
2678 | sip->i_ino, &first_block, &free_list, | 2693 | sip->i_ino, &first_block, &free_list, |
2679 | resblks); | 2694 | resblks); |
2680 | if (error) | 2695 | if (error) |
@@ -2734,15 +2749,15 @@ std_return: | |||
2734 | STATIC int | 2749 | STATIC int |
2735 | xfs_mkdir( | 2750 | xfs_mkdir( |
2736 | bhv_desc_t *dir_bdp, | 2751 | bhv_desc_t *dir_bdp, |
2737 | vname_t *dentry, | 2752 | bhv_vname_t *dentry, |
2738 | vattr_t *vap, | 2753 | bhv_vattr_t *vap, |
2739 | vnode_t **vpp, | 2754 | bhv_vnode_t **vpp, |
2740 | cred_t *credp) | 2755 | cred_t *credp) |
2741 | { | 2756 | { |
2742 | char *dir_name = VNAME(dentry); | 2757 | char *dir_name = VNAME(dentry); |
2743 | xfs_inode_t *dp; | 2758 | xfs_inode_t *dp; |
2744 | xfs_inode_t *cdp; /* inode of created dir */ | 2759 | xfs_inode_t *cdp; /* inode of created dir */ |
2745 | vnode_t *cvp; /* vnode of created dir */ | 2760 | bhv_vnode_t *cvp; /* vnode of created dir */ |
2746 | xfs_trans_t *tp; | 2761 | xfs_trans_t *tp; |
2747 | xfs_mount_t *mp; | 2762 | xfs_mount_t *mp; |
2748 | int cancel_flags; | 2763 | int cancel_flags; |
@@ -2750,7 +2765,7 @@ xfs_mkdir( | |||
2750 | int committed; | 2765 | int committed; |
2751 | xfs_bmap_free_t free_list; | 2766 | xfs_bmap_free_t free_list; |
2752 | xfs_fsblock_t first_block; | 2767 | xfs_fsblock_t first_block; |
2753 | vnode_t *dir_vp; | 2768 | bhv_vnode_t *dir_vp; |
2754 | boolean_t dp_joined_to_trans; | 2769 | boolean_t dp_joined_to_trans; |
2755 | boolean_t created = B_FALSE; | 2770 | boolean_t created = B_FALSE; |
2756 | int dm_event_sent = 0; | 2771 | int dm_event_sent = 0; |
@@ -2840,7 +2855,7 @@ xfs_mkdir( | |||
2840 | goto error_return; | 2855 | goto error_return; |
2841 | 2856 | ||
2842 | if (resblks == 0 && | 2857 | if (resblks == 0 && |
2843 | (error = XFS_DIR_CANENTER(mp, tp, dp, dir_name, dir_namelen))) | 2858 | (error = xfs_dir_canenter(tp, dp, dir_name, dir_namelen))) |
2844 | goto error_return; | 2859 | goto error_return; |
2845 | /* | 2860 | /* |
2846 | * create the directory inode. | 2861 | * create the directory inode. |
@@ -2867,9 +2882,9 @@ xfs_mkdir( | |||
2867 | 2882 | ||
2868 | XFS_BMAP_INIT(&free_list, &first_block); | 2883 | XFS_BMAP_INIT(&free_list, &first_block); |
2869 | 2884 | ||
2870 | error = XFS_DIR_CREATENAME(mp, tp, dp, dir_name, dir_namelen, | 2885 | error = xfs_dir_createname(tp, dp, dir_name, dir_namelen, cdp->i_ino, |
2871 | cdp->i_ino, &first_block, &free_list, | 2886 | &first_block, &free_list, resblks ? |
2872 | resblks ? resblks - XFS_IALLOC_SPACE_RES(mp) : 0); | 2887 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); |
2873 | if (error) { | 2888 | if (error) { |
2874 | ASSERT(error != ENOSPC); | 2889 | ASSERT(error != ENOSPC); |
2875 | goto error1; | 2890 | goto error1; |
@@ -2883,16 +2898,14 @@ xfs_mkdir( | |||
2883 | */ | 2898 | */ |
2884 | dp->i_gen++; | 2899 | dp->i_gen++; |
2885 | 2900 | ||
2886 | error = XFS_DIR_INIT(mp, tp, cdp, dp); | 2901 | error = xfs_dir_init(tp, cdp, dp); |
2887 | if (error) { | 2902 | if (error) |
2888 | goto error2; | 2903 | goto error2; |
2889 | } | ||
2890 | 2904 | ||
2891 | cdp->i_gen = 1; | 2905 | cdp->i_gen = 1; |
2892 | error = xfs_bumplink(tp, dp); | 2906 | error = xfs_bumplink(tp, dp); |
2893 | if (error) { | 2907 | if (error) |
2894 | goto error2; | 2908 | goto error2; |
2895 | } | ||
2896 | 2909 | ||
2897 | cvp = XFS_ITOV(cdp); | 2910 | cvp = XFS_ITOV(cdp); |
2898 | 2911 | ||
@@ -2969,7 +2982,7 @@ std_return: | |||
2969 | STATIC int | 2982 | STATIC int |
2970 | xfs_rmdir( | 2983 | xfs_rmdir( |
2971 | bhv_desc_t *dir_bdp, | 2984 | bhv_desc_t *dir_bdp, |
2972 | vname_t *dentry, | 2985 | bhv_vname_t *dentry, |
2973 | cred_t *credp) | 2986 | cred_t *credp) |
2974 | { | 2987 | { |
2975 | char *name = VNAME(dentry); | 2988 | char *name = VNAME(dentry); |
@@ -2982,7 +2995,7 @@ xfs_rmdir( | |||
2982 | xfs_fsblock_t first_block; | 2995 | xfs_fsblock_t first_block; |
2983 | int cancel_flags; | 2996 | int cancel_flags; |
2984 | int committed; | 2997 | int committed; |
2985 | vnode_t *dir_vp; | 2998 | bhv_vnode_t *dir_vp; |
2986 | int dm_di_mode = 0; | 2999 | int dm_di_mode = 0; |
2987 | int last_cdp_link; | 3000 | int last_cdp_link; |
2988 | int namelen; | 3001 | int namelen; |
@@ -3101,16 +3114,15 @@ xfs_rmdir( | |||
3101 | error = XFS_ERROR(ENOTEMPTY); | 3114 | error = XFS_ERROR(ENOTEMPTY); |
3102 | goto error_return; | 3115 | goto error_return; |
3103 | } | 3116 | } |
3104 | if (!XFS_DIR_ISEMPTY(mp, cdp)) { | 3117 | if (!xfs_dir_isempty(cdp)) { |
3105 | error = XFS_ERROR(ENOTEMPTY); | 3118 | error = XFS_ERROR(ENOTEMPTY); |
3106 | goto error_return; | 3119 | goto error_return; |
3107 | } | 3120 | } |
3108 | 3121 | ||
3109 | error = XFS_DIR_REMOVENAME(mp, tp, dp, name, namelen, cdp->i_ino, | 3122 | error = xfs_dir_removename(tp, dp, name, namelen, cdp->i_ino, |
3110 | &first_block, &free_list, resblks); | 3123 | &first_block, &free_list, resblks); |
3111 | if (error) { | 3124 | if (error) |
3112 | goto error1; | 3125 | goto error1; |
3113 | } | ||
3114 | 3126 | ||
3115 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 3127 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
3116 | 3128 | ||
@@ -3181,7 +3193,7 @@ xfs_rmdir( | |||
3181 | /* | 3193 | /* |
3182 | * Let interposed file systems know about removed links. | 3194 | * Let interposed file systems know about removed links. |
3183 | */ | 3195 | */ |
3184 | VOP_LINK_REMOVED(XFS_ITOV(cdp), dir_vp, last_cdp_link); | 3196 | bhv_vop_link_removed(XFS_ITOV(cdp), dir_vp, last_cdp_link); |
3185 | 3197 | ||
3186 | IRELE(cdp); | 3198 | IRELE(cdp); |
3187 | 3199 | ||
@@ -3209,8 +3221,6 @@ xfs_rmdir( | |||
3209 | 3221 | ||
3210 | 3222 | ||
3211 | /* | 3223 | /* |
3212 | * xfs_readdir | ||
3213 | * | ||
3214 | * Read dp's entries starting at uiop->uio_offset and translate them into | 3224 | * Read dp's entries starting at uiop->uio_offset and translate them into |
3215 | * bufsize bytes worth of struct dirents starting at bufbase. | 3225 | * bufsize bytes worth of struct dirents starting at bufbase. |
3216 | */ | 3226 | */ |
@@ -3230,28 +3240,23 @@ xfs_readdir( | |||
3230 | (inst_t *)__return_address); | 3240 | (inst_t *)__return_address); |
3231 | dp = XFS_BHVTOI(dir_bdp); | 3241 | dp = XFS_BHVTOI(dir_bdp); |
3232 | 3242 | ||
3233 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) { | 3243 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
3234 | return XFS_ERROR(EIO); | 3244 | return XFS_ERROR(EIO); |
3235 | } | ||
3236 | 3245 | ||
3237 | lock_mode = xfs_ilock_map_shared(dp); | 3246 | lock_mode = xfs_ilock_map_shared(dp); |
3238 | error = XFS_DIR_GETDENTS(dp->i_mount, tp, dp, uiop, eofp); | 3247 | error = xfs_dir_getdents(tp, dp, uiop, eofp); |
3239 | xfs_iunlock_map_shared(dp, lock_mode); | 3248 | xfs_iunlock_map_shared(dp, lock_mode); |
3240 | return error; | 3249 | return error; |
3241 | } | 3250 | } |
3242 | 3251 | ||
3243 | 3252 | ||
3244 | /* | ||
3245 | * xfs_symlink | ||
3246 | * | ||
3247 | */ | ||
3248 | STATIC int | 3253 | STATIC int |
3249 | xfs_symlink( | 3254 | xfs_symlink( |
3250 | bhv_desc_t *dir_bdp, | 3255 | bhv_desc_t *dir_bdp, |
3251 | vname_t *dentry, | 3256 | bhv_vname_t *dentry, |
3252 | vattr_t *vap, | 3257 | bhv_vattr_t *vap, |
3253 | char *target_path, | 3258 | char *target_path, |
3254 | vnode_t **vpp, | 3259 | bhv_vnode_t **vpp, |
3255 | cred_t *credp) | 3260 | cred_t *credp) |
3256 | { | 3261 | { |
3257 | xfs_trans_t *tp; | 3262 | xfs_trans_t *tp; |
@@ -3263,7 +3268,7 @@ xfs_symlink( | |||
3263 | xfs_bmap_free_t free_list; | 3268 | xfs_bmap_free_t free_list; |
3264 | xfs_fsblock_t first_block; | 3269 | xfs_fsblock_t first_block; |
3265 | boolean_t dp_joined_to_trans; | 3270 | boolean_t dp_joined_to_trans; |
3266 | vnode_t *dir_vp; | 3271 | bhv_vnode_t *dir_vp; |
3267 | uint cancel_flags; | 3272 | uint cancel_flags; |
3268 | int committed; | 3273 | int committed; |
3269 | xfs_fileoff_t first_fsb; | 3274 | xfs_fileoff_t first_fsb; |
@@ -3308,7 +3313,7 @@ xfs_symlink( | |||
3308 | int len, total; | 3313 | int len, total; |
3309 | char *path; | 3314 | char *path; |
3310 | 3315 | ||
3311 | for(total = 0, path = target_path; total < pathlen;) { | 3316 | for (total = 0, path = target_path; total < pathlen;) { |
3312 | /* | 3317 | /* |
3313 | * Skip any slashes. | 3318 | * Skip any slashes. |
3314 | */ | 3319 | */ |
@@ -3402,7 +3407,7 @@ xfs_symlink( | |||
3402 | * Check for ability to enter directory entry, if no space reserved. | 3407 | * Check for ability to enter directory entry, if no space reserved. |
3403 | */ | 3408 | */ |
3404 | if (resblks == 0 && | 3409 | if (resblks == 0 && |
3405 | (error = XFS_DIR_CANENTER(mp, tp, dp, link_name, link_namelen))) | 3410 | (error = xfs_dir_canenter(tp, dp, link_name, link_namelen))) |
3406 | goto error_return; | 3411 | goto error_return; |
3407 | /* | 3412 | /* |
3408 | * Initialize the bmap freelist prior to calling either | 3413 | * Initialize the bmap freelist prior to calling either |
@@ -3457,7 +3462,7 @@ xfs_symlink( | |||
3457 | error = xfs_bmapi(tp, ip, first_fsb, fs_blocks, | 3462 | error = xfs_bmapi(tp, ip, first_fsb, fs_blocks, |
3458 | XFS_BMAPI_WRITE | XFS_BMAPI_METADATA, | 3463 | XFS_BMAPI_WRITE | XFS_BMAPI_METADATA, |
3459 | &first_block, resblks, mval, &nmaps, | 3464 | &first_block, resblks, mval, &nmaps, |
3460 | &free_list); | 3465 | &free_list, NULL); |
3461 | if (error) { | 3466 | if (error) { |
3462 | goto error1; | 3467 | goto error1; |
3463 | } | 3468 | } |
@@ -3489,11 +3494,10 @@ xfs_symlink( | |||
3489 | /* | 3494 | /* |
3490 | * Create the directory entry for the symlink. | 3495 | * Create the directory entry for the symlink. |
3491 | */ | 3496 | */ |
3492 | error = XFS_DIR_CREATENAME(mp, tp, dp, link_name, link_namelen, | 3497 | error = xfs_dir_createname(tp, dp, link_name, link_namelen, ip->i_ino, |
3493 | ip->i_ino, &first_block, &free_list, resblks); | 3498 | &first_block, &free_list, resblks); |
3494 | if (error) { | 3499 | if (error) |
3495 | goto error1; | 3500 | goto error1; |
3496 | } | ||
3497 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 3501 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
3498 | xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE); | 3502 | xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE); |
3499 | 3503 | ||
@@ -3541,7 +3545,7 @@ std_return: | |||
3541 | } | 3545 | } |
3542 | 3546 | ||
3543 | if (!error) { | 3547 | if (!error) { |
3544 | vnode_t *vp; | 3548 | bhv_vnode_t *vp; |
3545 | 3549 | ||
3546 | ASSERT(ip); | 3550 | ASSERT(ip); |
3547 | vp = XFS_ITOV(ip); | 3551 | vp = XFS_ITOV(ip); |
@@ -3606,10 +3610,10 @@ xfs_fid2( | |||
3606 | int | 3610 | int |
3607 | xfs_rwlock( | 3611 | xfs_rwlock( |
3608 | bhv_desc_t *bdp, | 3612 | bhv_desc_t *bdp, |
3609 | vrwlock_t locktype) | 3613 | bhv_vrwlock_t locktype) |
3610 | { | 3614 | { |
3611 | xfs_inode_t *ip; | 3615 | xfs_inode_t *ip; |
3612 | vnode_t *vp; | 3616 | bhv_vnode_t *vp; |
3613 | 3617 | ||
3614 | vp = BHV_TO_VNODE(bdp); | 3618 | vp = BHV_TO_VNODE(bdp); |
3615 | if (VN_ISDIR(vp)) | 3619 | if (VN_ISDIR(vp)) |
@@ -3637,10 +3641,10 @@ xfs_rwlock( | |||
3637 | void | 3641 | void |
3638 | xfs_rwunlock( | 3642 | xfs_rwunlock( |
3639 | bhv_desc_t *bdp, | 3643 | bhv_desc_t *bdp, |
3640 | vrwlock_t locktype) | 3644 | bhv_vrwlock_t locktype) |
3641 | { | 3645 | { |
3642 | xfs_inode_t *ip; | 3646 | xfs_inode_t *ip; |
3643 | vnode_t *vp; | 3647 | bhv_vnode_t *vp; |
3644 | 3648 | ||
3645 | vp = BHV_TO_VNODE(bdp); | 3649 | vp = BHV_TO_VNODE(bdp); |
3646 | if (VN_ISDIR(vp)) | 3650 | if (VN_ISDIR(vp)) |
@@ -3744,7 +3748,6 @@ xfs_inode_flush( | |||
3744 | return error; | 3748 | return error; |
3745 | } | 3749 | } |
3746 | 3750 | ||
3747 | |||
3748 | int | 3751 | int |
3749 | xfs_set_dmattrs ( | 3752 | xfs_set_dmattrs ( |
3750 | bhv_desc_t *bdp, | 3753 | bhv_desc_t *bdp, |
@@ -3785,16 +3788,12 @@ xfs_set_dmattrs ( | |||
3785 | return error; | 3788 | return error; |
3786 | } | 3789 | } |
3787 | 3790 | ||
3788 | |||
3789 | /* | ||
3790 | * xfs_reclaim | ||
3791 | */ | ||
3792 | STATIC int | 3791 | STATIC int |
3793 | xfs_reclaim( | 3792 | xfs_reclaim( |
3794 | bhv_desc_t *bdp) | 3793 | bhv_desc_t *bdp) |
3795 | { | 3794 | { |
3796 | xfs_inode_t *ip; | 3795 | xfs_inode_t *ip; |
3797 | vnode_t *vp; | 3796 | bhv_vnode_t *vp; |
3798 | 3797 | ||
3799 | vp = BHV_TO_VNODE(bdp); | 3798 | vp = BHV_TO_VNODE(bdp); |
3800 | ip = XFS_BHVTOI(bdp); | 3799 | ip = XFS_BHVTOI(bdp); |
@@ -3849,7 +3848,7 @@ xfs_finish_reclaim( | |||
3849 | int sync_mode) | 3848 | int sync_mode) |
3850 | { | 3849 | { |
3851 | xfs_ihash_t *ih = ip->i_hash; | 3850 | xfs_ihash_t *ih = ip->i_hash; |
3852 | vnode_t *vp = XFS_ITOV_NULL(ip); | 3851 | bhv_vnode_t *vp = XFS_ITOV_NULL(ip); |
3853 | int error; | 3852 | int error; |
3854 | 3853 | ||
3855 | if (vp && VN_BAD(vp)) | 3854 | if (vp && VN_BAD(vp)) |
@@ -4116,10 +4115,10 @@ retry: | |||
4116 | * Issue the xfs_bmapi() call to allocate the blocks | 4115 | * Issue the xfs_bmapi() call to allocate the blocks |
4117 | */ | 4116 | */ |
4118 | XFS_BMAP_INIT(&free_list, &firstfsb); | 4117 | XFS_BMAP_INIT(&free_list, &firstfsb); |
4119 | error = xfs_bmapi(tp, ip, startoffset_fsb, | 4118 | error = XFS_BMAPI(mp, tp, &ip->i_iocore, startoffset_fsb, |
4120 | allocatesize_fsb, bmapi_flag, | 4119 | allocatesize_fsb, bmapi_flag, |
4121 | &firstfsb, 0, imapp, &nimaps, | 4120 | &firstfsb, 0, imapp, &nimaps, |
4122 | &free_list); | 4121 | &free_list, NULL); |
4123 | if (error) { | 4122 | if (error) { |
4124 | goto error0; | 4123 | goto error0; |
4125 | } | 4124 | } |
@@ -4199,8 +4198,8 @@ xfs_zero_remaining_bytes( | |||
4199 | for (offset = startoff; offset <= endoff; offset = lastoffset + 1) { | 4198 | for (offset = startoff; offset <= endoff; offset = lastoffset + 1) { |
4200 | offset_fsb = XFS_B_TO_FSBT(mp, offset); | 4199 | offset_fsb = XFS_B_TO_FSBT(mp, offset); |
4201 | nimap = 1; | 4200 | nimap = 1; |
4202 | error = xfs_bmapi(NULL, ip, offset_fsb, 1, 0, NULL, 0, &imap, | 4201 | error = XFS_BMAPI(mp, NULL, &ip->i_iocore, offset_fsb, 1, 0, |
4203 | &nimap, NULL); | 4202 | NULL, 0, &imap, &nimap, NULL, NULL); |
4204 | if (error || nimap < 1) | 4203 | if (error || nimap < 1) |
4205 | break; | 4204 | break; |
4206 | ASSERT(imap.br_blockcount >= 1); | 4205 | ASSERT(imap.br_blockcount >= 1); |
@@ -4259,7 +4258,7 @@ xfs_free_file_space( | |||
4259 | xfs_off_t len, | 4258 | xfs_off_t len, |
4260 | int attr_flags) | 4259 | int attr_flags) |
4261 | { | 4260 | { |
4262 | vnode_t *vp; | 4261 | bhv_vnode_t *vp; |
4263 | int committed; | 4262 | int committed; |
4264 | int done; | 4263 | int done; |
4265 | xfs_off_t end_dmi_offset; | 4264 | xfs_off_t end_dmi_offset; |
@@ -4308,7 +4307,6 @@ xfs_free_file_space( | |||
4308 | return error; | 4307 | return error; |
4309 | } | 4308 | } |
4310 | 4309 | ||
4311 | ASSERT(attr_flags & ATTR_NOLOCK ? attr_flags & ATTR_DMI : 1); | ||
4312 | if (attr_flags & ATTR_NOLOCK) | 4310 | if (attr_flags & ATTR_NOLOCK) |
4313 | need_iolock = 0; | 4311 | need_iolock = 0; |
4314 | if (need_iolock) { | 4312 | if (need_iolock) { |
@@ -4326,7 +4324,7 @@ xfs_free_file_space( | |||
4326 | if (VN_CACHED(vp) != 0) { | 4324 | if (VN_CACHED(vp) != 0) { |
4327 | xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1, | 4325 | xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1, |
4328 | ctooff(offtoct(ioffset)), -1); | 4326 | ctooff(offtoct(ioffset)), -1); |
4329 | VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(ioffset)), | 4327 | bhv_vop_flushinval_pages(vp, ctooff(offtoct(ioffset)), |
4330 | -1, FI_REMAPF_LOCKED); | 4328 | -1, FI_REMAPF_LOCKED); |
4331 | } | 4329 | } |
4332 | 4330 | ||
@@ -4338,8 +4336,8 @@ xfs_free_file_space( | |||
4338 | */ | 4336 | */ |
4339 | if (rt && !XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb)) { | 4337 | if (rt && !XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb)) { |
4340 | nimap = 1; | 4338 | nimap = 1; |
4341 | error = xfs_bmapi(NULL, ip, startoffset_fsb, 1, 0, NULL, 0, | 4339 | error = XFS_BMAPI(mp, NULL, &ip->i_iocore, startoffset_fsb, |
4342 | &imap, &nimap, NULL); | 4340 | 1, 0, NULL, 0, &imap, &nimap, NULL, NULL); |
4343 | if (error) | 4341 | if (error) |
4344 | goto out_unlock_iolock; | 4342 | goto out_unlock_iolock; |
4345 | ASSERT(nimap == 0 || nimap == 1); | 4343 | ASSERT(nimap == 0 || nimap == 1); |
@@ -4353,8 +4351,8 @@ xfs_free_file_space( | |||
4353 | startoffset_fsb += mp->m_sb.sb_rextsize - mod; | 4351 | startoffset_fsb += mp->m_sb.sb_rextsize - mod; |
4354 | } | 4352 | } |
4355 | nimap = 1; | 4353 | nimap = 1; |
4356 | error = xfs_bmapi(NULL, ip, endoffset_fsb - 1, 1, 0, NULL, 0, | 4354 | error = XFS_BMAPI(mp, NULL, &ip->i_iocore, endoffset_fsb - 1, |
4357 | &imap, &nimap, NULL); | 4355 | 1, 0, NULL, 0, &imap, &nimap, NULL, NULL); |
4358 | if (error) | 4356 | if (error) |
4359 | goto out_unlock_iolock; | 4357 | goto out_unlock_iolock; |
4360 | ASSERT(nimap == 0 || nimap == 1); | 4358 | ASSERT(nimap == 0 || nimap == 1); |
@@ -4426,9 +4424,9 @@ xfs_free_file_space( | |||
4426 | * issue the bunmapi() call to free the blocks | 4424 | * issue the bunmapi() call to free the blocks |
4427 | */ | 4425 | */ |
4428 | XFS_BMAP_INIT(&free_list, &firstfsb); | 4426 | XFS_BMAP_INIT(&free_list, &firstfsb); |
4429 | error = xfs_bunmapi(tp, ip, startoffset_fsb, | 4427 | error = XFS_BUNMAPI(mp, tp, &ip->i_iocore, startoffset_fsb, |
4430 | endoffset_fsb - startoffset_fsb, | 4428 | endoffset_fsb - startoffset_fsb, |
4431 | 0, 2, &firstfsb, &free_list, &done); | 4429 | 0, 2, &firstfsb, &free_list, NULL, &done); |
4432 | if (error) { | 4430 | if (error) { |
4433 | goto error0; | 4431 | goto error0; |
4434 | } | 4432 | } |
@@ -4488,8 +4486,8 @@ xfs_change_file_space( | |||
4488 | xfs_off_t startoffset; | 4486 | xfs_off_t startoffset; |
4489 | xfs_off_t llen; | 4487 | xfs_off_t llen; |
4490 | xfs_trans_t *tp; | 4488 | xfs_trans_t *tp; |
4491 | vattr_t va; | 4489 | bhv_vattr_t va; |
4492 | vnode_t *vp; | 4490 | bhv_vnode_t *vp; |
4493 | 4491 | ||
4494 | vp = BHV_TO_VNODE(bdp); | 4492 | vp = BHV_TO_VNODE(bdp); |
4495 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); | 4493 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); |
@@ -4642,9 +4640,10 @@ xfs_change_file_space( | |||
4642 | return error; | 4640 | return error; |
4643 | } | 4641 | } |
4644 | 4642 | ||
4645 | vnodeops_t xfs_vnodeops = { | 4643 | bhv_vnodeops_t xfs_vnodeops = { |
4646 | BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS), | 4644 | BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS), |
4647 | .vop_open = xfs_open, | 4645 | .vop_open = xfs_open, |
4646 | .vop_close = xfs_close, | ||
4648 | .vop_read = xfs_read, | 4647 | .vop_read = xfs_read, |
4649 | #ifdef HAVE_SENDFILE | 4648 | #ifdef HAVE_SENDFILE |
4650 | .vop_sendfile = xfs_sendfile, | 4649 | .vop_sendfile = xfs_sendfile, |