aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2005-11-01 22:38:42 -0500
committerNathan Scott <nathans@sgi.com>2005-11-01 22:38:42 -0500
commita844f4510dce23c07f3923cb42138f5fdd745017 (patch)
treeffb37e9e60f02d5e92bd69bb53b568e1c991c17f /fs/xfs
parent61c1e689fbde7cb50a76262bba190715d86beab6 (diff)
[XFS] Remove xfs_macros.c, xfs_macros.h, rework headers a whole lot.
SGI-PV: 943122 SGI-Modid: xfs-linux:xfs-kern:23901a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c11
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c19
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c13
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c18
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.h5
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c15
-rw-r--r--fs/xfs/linux-2.6/xfs_sysctl.c18
-rw-r--r--fs/xfs/linux-2.6/xfs_vfs.c2
-rw-r--r--fs/xfs/quota/xfs_dquot.c12
-rw-r--r--fs/xfs/quota/xfs_dquot_item.c13
-rw-r--r--fs/xfs/quota/xfs_qm.c17
-rw-r--r--fs/xfs/quota/xfs_qm_bhv.c16
-rw-r--r--fs/xfs/quota/xfs_qm_stats.c15
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c16
-rw-r--r--fs/xfs/quota/xfs_trans_dquot.c12
-rw-r--r--fs/xfs/xfs.h3
-rw-r--r--fs/xfs/xfs_acl.c12
-rw-r--r--fs/xfs/xfs_ag.h150
-rw-r--r--fs/xfs/xfs_alloc.c18
-rw-r--r--fs/xfs/xfs_alloc_btree.c18
-rw-r--r--fs/xfs/xfs_alloc_btree.h135
-rw-r--r--fs/xfs/xfs_attr.c21
-rw-r--r--fs/xfs/xfs_attr_leaf.c21
-rw-r--r--fs/xfs/xfs_attr_leaf.h77
-rw-r--r--fs/xfs/xfs_attr_sf.h29
-rw-r--r--fs/xfs/xfs_bit.h36
-rw-r--r--fs/xfs/xfs_bmap.c24
-rw-r--r--fs/xfs/xfs_bmap.h19
-rw-r--r--fs/xfs/xfs_bmap_btree.c20
-rw-r--r--fs/xfs/xfs_bmap_btree.h596
-rw-r--r--fs/xfs/xfs_btree.c20
-rw-r--r--fs/xfs/xfs_btree.h120
-rw-r--r--fs/xfs/xfs_buf_item.c18
-rw-r--r--fs/xfs/xfs_da_btree.c20
-rw-r--r--fs/xfs/xfs_da_btree.h68
-rw-r--r--fs/xfs/xfs_dfrag.c16
-rw-r--r--fs/xfs/xfs_dinode.h169
-rw-r--r--fs/xfs/xfs_dir.c12
-rw-r--r--fs/xfs/xfs_dir2.c21
-rw-r--r--fs/xfs/xfs_dir2_block.c18
-rw-r--r--fs/xfs/xfs_dir2_block.h62
-rw-r--r--fs/xfs/xfs_dir2_data.c16
-rw-r--r--fs/xfs/xfs_dir2_data.h93
-rw-r--r--fs/xfs/xfs_dir2_leaf.c18
-rw-r--r--fs/xfs/xfs_dir2_leaf.h310
-rw-r--r--fs/xfs/xfs_dir2_node.c16
-rw-r--r--fs/xfs/xfs_dir2_node.h111
-rw-r--r--fs/xfs/xfs_dir2_sf.c17
-rw-r--r--fs/xfs/xfs_dir2_sf.h194
-rw-r--r--fs/xfs/xfs_dir2_trace.c11
-rw-r--r--fs/xfs/xfs_dir_leaf.c24
-rw-r--r--fs/xfs/xfs_dir_leaf.h37
-rw-r--r--fs/xfs/xfs_dir_sf.h73
-rw-r--r--fs/xfs/xfs_dmops.c5
-rw-r--r--fs/xfs/xfs_error.c10
-rw-r--r--fs/xfs/xfs_error.h66
-rw-r--r--fs/xfs/xfs_extfree_item.c11
-rw-r--r--fs/xfs/xfs_fsops.c25
-rw-r--r--fs/xfs/xfs_ialloc.c16
-rw-r--r--fs/xfs/xfs_ialloc.h40
-rw-r--r--fs/xfs/xfs_ialloc_btree.c15
-rw-r--r--fs/xfs/xfs_ialloc_btree.h205
-rw-r--r--fs/xfs/xfs_iget.c18
-rw-r--r--fs/xfs/xfs_inode.c23
-rw-r--r--fs/xfs/xfs_inode.h75
-rw-r--r--fs/xfs/xfs_inode_item.c24
-rw-r--r--fs/xfs/xfs_inode_item.h41
-rw-r--r--fs/xfs/xfs_inum.h104
-rw-r--r--fs/xfs/xfs_iocore.c21
-rw-r--r--fs/xfs/xfs_iomap.c13
-rw-r--r--fs/xfs/xfs_itable.c14
-rw-r--r--fs/xfs/xfs_log.c25
-rw-r--r--fs/xfs/xfs_log_priv.h141
-rw-r--r--fs/xfs/xfs_log_recover.c23
-rw-r--r--fs/xfs/xfs_mount.c15
-rw-r--r--fs/xfs/xfs_mount.h68
-rw-r--r--fs/xfs/xfs_qmops.c5
-rw-r--r--fs/xfs/xfs_rename.c11
-rw-r--r--fs/xfs/xfs_rtalloc.c19
-rw-r--r--fs/xfs/xfs_rw.c20
-rw-r--r--fs/xfs/xfs_rw.h99
-rw-r--r--fs/xfs/xfs_sb.h398
-rw-r--r--fs/xfs/xfs_trans.c20
-rw-r--r--fs/xfs/xfs_trans.h120
-rw-r--r--fs/xfs/xfs_trans_ail.c5
-rw-r--r--fs/xfs/xfs_trans_buf.c17
-rw-r--r--fs/xfs/xfs_trans_extfree.c5
-rw-r--r--fs/xfs/xfs_trans_inode.c18
-rw-r--r--fs/xfs/xfs_trans_item.c5
-rw-r--r--fs/xfs/xfs_utils.c11
-rw-r--r--fs/xfs/xfs_vfsops.c28
-rw-r--r--fs/xfs/xfs_vnodeops.c31
93 files changed, 1567 insertions, 3093 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 7aa398724706..8c05c3c30741 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -29,11 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_inum.h" 33#include "xfs_bit.h"
35#include "xfs_log.h" 34#include "xfs_log.h"
35#include "xfs_inum.h"
36#include "xfs_sb.h" 36#include "xfs_sb.h"
37#include "xfs_ag.h"
37#include "xfs_dir.h" 38#include "xfs_dir.h"
38#include "xfs_dir2.h" 39#include "xfs_dir2.h"
39#include "xfs_trans.h" 40#include "xfs_trans.h"
@@ -42,13 +43,13 @@
42#include "xfs_bmap_btree.h" 43#include "xfs_bmap_btree.h"
43#include "xfs_alloc_btree.h" 44#include "xfs_alloc_btree.h"
44#include "xfs_ialloc_btree.h" 45#include "xfs_ialloc_btree.h"
45#include "xfs_alloc.h"
46#include "xfs_btree.h"
47#include "xfs_attr_sf.h"
48#include "xfs_dir_sf.h" 46#include "xfs_dir_sf.h"
49#include "xfs_dir2_sf.h" 47#include "xfs_dir2_sf.h"
48#include "xfs_attr_sf.h"
50#include "xfs_dinode.h" 49#include "xfs_dinode.h"
51#include "xfs_inode.h" 50#include "xfs_inode.h"
51#include "xfs_alloc.h"
52#include "xfs_btree.h"
52#include "xfs_error.h" 53#include "xfs_error.h"
53#include "xfs_rw.h" 54#include "xfs_rw.h"
54#include "xfs_iomap.h" 55#include "xfs_iomap.h"
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 3881622bcf08..b0c00eaa79e4 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -29,11 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_inum.h" 33#include "xfs_bit.h"
35#include "xfs_log.h" 34#include "xfs_log.h"
35#include "xfs_inum.h"
36#include "xfs_sb.h" 36#include "xfs_sb.h"
37#include "xfs_ag.h"
37#include "xfs_dir.h" 38#include "xfs_dir.h"
38#include "xfs_dir2.h" 39#include "xfs_dir2.h"
39#include "xfs_trans.h" 40#include "xfs_trans.h"
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 6a3326bcd8d0..d880e9c65fcd 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -29,39 +29,38 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34
35#include "xfs_fs.h" 33#include "xfs_fs.h"
36#include "xfs_inum.h" 34#include "xfs_bit.h"
37#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
38#include "xfs_trans.h" 37#include "xfs_trans.h"
39#include "xfs_sb.h" 38#include "xfs_sb.h"
39#include "xfs_ag.h"
40#include "xfs_dir.h" 40#include "xfs_dir.h"
41#include "xfs_dir2.h" 41#include "xfs_dir2.h"
42#include "xfs_alloc.h" 42#include "xfs_alloc.h"
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
48#include "xfs_btree.h"
49#include "xfs_ialloc.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
49#include "xfs_attr_sf.h"
52#include "xfs_dir2_sf.h" 50#include "xfs_dir2_sf.h"
53#include "xfs_dinode.h" 51#include "xfs_dinode.h"
54#include "xfs_inode.h" 52#include "xfs_inode.h"
55#include "xfs_bmap.h" 53#include "xfs_btree.h"
56#include "xfs_bit.h" 54#include "xfs_ialloc.h"
57#include "xfs_rtalloc.h" 55#include "xfs_rtalloc.h"
58#include "xfs_error.h"
59#include "xfs_itable.h" 56#include "xfs_itable.h"
57#include "xfs_error.h"
60#include "xfs_rw.h" 58#include "xfs_rw.h"
61#include "xfs_acl.h" 59#include "xfs_acl.h"
62#include "xfs_cap.h" 60#include "xfs_cap.h"
63#include "xfs_mac.h" 61#include "xfs_mac.h"
64#include "xfs_attr.h" 62#include "xfs_attr.h"
63#include "xfs_bmap.h"
65#include "xfs_buf_item.h" 64#include "xfs_buf_item.h"
66#include "xfs_utils.h" 65#include "xfs_utils.h"
67#include "xfs_dfrag.h" 66#include "xfs_dfrag.h"
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 68c83ec31143..12d2a702c6c3 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -29,11 +29,11 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_fs.h" 33#include "xfs_fs.h"
35#include "xfs_inum.h" 34#include "xfs_bit.h"
36#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
37#include "xfs_trans.h" 37#include "xfs_trans.h"
38#include "xfs_sb.h" 38#include "xfs_sb.h"
39#include "xfs_ag.h" 39#include "xfs_ag.h"
@@ -43,18 +43,17 @@
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_quota.h" 44#include "xfs_quota.h"
45#include "xfs_mount.h" 45#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
47#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 48#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 49#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 50#include "xfs_dir2_sf.h"
51#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 52#include "xfs_dinode.h"
55#include "xfs_inode.h" 53#include "xfs_inode.h"
56#include "xfs_bmap.h" 54#include "xfs_bmap.h"
57#include "xfs_bit.h" 55#include "xfs_btree.h"
56#include "xfs_ialloc.h"
58#include "xfs_rtalloc.h" 57#include "xfs_rtalloc.h"
59#include "xfs_error.h" 58#include "xfs_error.h"
60#include "xfs_itable.h" 59#include "xfs_itable.h"
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index c04f0c063c58..36dc8b0368b7 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -29,16 +29,11 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32/*
33 * fs/xfs/linux/xfs_lrw.c (Linux Read Write stuff)
34 *
35 */
36
37#include "xfs.h" 32#include "xfs.h"
38
39#include "xfs_fs.h" 33#include "xfs_fs.h"
40#include "xfs_inum.h" 34#include "xfs_bit.h"
41#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
42#include "xfs_trans.h" 37#include "xfs_trans.h"
43#include "xfs_sb.h" 38#include "xfs_sb.h"
44#include "xfs_ag.h" 39#include "xfs_ag.h"
@@ -48,18 +43,17 @@
48#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
49#include "xfs_quota.h" 44#include "xfs_quota.h"
50#include "xfs_mount.h" 45#include "xfs_mount.h"
51#include "xfs_alloc_btree.h"
52#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
47#include "xfs_alloc_btree.h"
53#include "xfs_ialloc_btree.h" 48#include "xfs_ialloc_btree.h"
54#include "xfs_btree.h"
55#include "xfs_ialloc.h"
56#include "xfs_attr_sf.h"
57#include "xfs_dir_sf.h" 49#include "xfs_dir_sf.h"
58#include "xfs_dir2_sf.h" 50#include "xfs_dir2_sf.h"
51#include "xfs_attr_sf.h"
59#include "xfs_dinode.h" 52#include "xfs_dinode.h"
60#include "xfs_inode.h" 53#include "xfs_inode.h"
61#include "xfs_bmap.h" 54#include "xfs_bmap.h"
62#include "xfs_bit.h" 55#include "xfs_btree.h"
56#include "xfs_ialloc.h"
63#include "xfs_rtalloc.h" 57#include "xfs_rtalloc.h"
64#include "xfs_error.h" 58#include "xfs_error.h"
65#include "xfs_itable.h" 59#include "xfs_itable.h"
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
index 6294dcdb797c..0647e48a8a15 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.h
+++ b/fs/xfs/linux-2.6/xfs_lrw.h
@@ -107,9 +107,4 @@ extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *,
107 107
108extern int xfs_dev_is_read_only(struct xfs_mount *, char *); 108extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
109 109
110#define XFS_FSB_TO_DB_IO(io,fsb) \
111 (((io)->io_flags & XFS_IOCORE_RT) ? \
112 XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
113 XFS_FSB_TO_DADDR((io)->io_mount, (fsb)))
114
115#endif /* __XFS_LRW_H__ */ 110#endif /* __XFS_LRW_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index f6f6b6750d4f..fac4862d09a6 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -29,32 +29,31 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34 33#include "xfs_bit.h"
35#include "xfs_inum.h"
36#include "xfs_log.h" 34#include "xfs_log.h"
37#include "xfs_clnt.h" 35#include "xfs_clnt.h"
36#include "xfs_inum.h"
38#include "xfs_trans.h" 37#include "xfs_trans.h"
39#include "xfs_sb.h" 38#include "xfs_sb.h"
39#include "xfs_ag.h"
40#include "xfs_dir.h" 40#include "xfs_dir.h"
41#include "xfs_dir2.h" 41#include "xfs_dir2.h"
42#include "xfs_alloc.h" 42#include "xfs_alloc.h"
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_quota.h" 44#include "xfs_quota.h"
45#include "xfs_mount.h" 45#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
47#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 48#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 49#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 50#include "xfs_dir2_sf.h"
51#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 52#include "xfs_dinode.h"
55#include "xfs_inode.h" 53#include "xfs_inode.h"
54#include "xfs_btree.h"
55#include "xfs_ialloc.h"
56#include "xfs_bmap.h" 56#include "xfs_bmap.h"
57#include "xfs_bit.h"
58#include "xfs_rtalloc.h" 57#include "xfs_rtalloc.h"
59#include "xfs_error.h" 58#include "xfs_error.h"
60#include "xfs_itable.h" 59#include "xfs_itable.h"
diff --git a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/linux-2.6/xfs_sysctl.c
index 0dc010356f4d..3dbd57fda2d6 100644
--- a/fs/xfs/linux-2.6/xfs_sysctl.c
+++ b/fs/xfs/linux-2.6/xfs_sysctl.c
@@ -29,9 +29,7 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_rw.h"
35#include <linux/sysctl.h> 33#include <linux/sysctl.h>
36#include <linux/proc_fs.h> 34#include <linux/proc_fs.h>
37 35
@@ -76,7 +74,7 @@ xfs_stats_clear_proc_handler(
76STATIC ctl_table xfs_table[] = { 74STATIC ctl_table xfs_table[] = {
77 {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val, 75 {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
78 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 76 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
79 &sysctl_intvec, NULL, 77 &sysctl_intvec, NULL,
80 &xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max}, 78 &xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max},
81 79
82 {XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val, 80 {XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
@@ -86,22 +84,22 @@ STATIC ctl_table xfs_table[] = {
86 84
87 {XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val, 85 {XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
88 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 86 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
89 &sysctl_intvec, NULL, 87 &sysctl_intvec, NULL,
90 &xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max}, 88 &xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max},
91 89
92 {XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val, 90 {XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
93 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 91 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
94 &sysctl_intvec, NULL, 92 &sysctl_intvec, NULL,
95 &xfs_params.panic_mask.min, &xfs_params.panic_mask.max}, 93 &xfs_params.panic_mask.min, &xfs_params.panic_mask.max},
96 94
97 {XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val, 95 {XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
98 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 96 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
99 &sysctl_intvec, NULL, 97 &sysctl_intvec, NULL,
100 &xfs_params.error_level.min, &xfs_params.error_level.max}, 98 &xfs_params.error_level.min, &xfs_params.error_level.max},
101 99
102 {XFS_SYNCD_TIMER, "xfssyncd_centisecs", &xfs_params.syncd_timer.val, 100 {XFS_SYNCD_TIMER, "xfssyncd_centisecs", &xfs_params.syncd_timer.val,
103 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 101 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
104 &sysctl_intvec, NULL, 102 &sysctl_intvec, NULL,
105 &xfs_params.syncd_timer.min, &xfs_params.syncd_timer.max}, 103 &xfs_params.syncd_timer.min, &xfs_params.syncd_timer.max},
106 104
107 {XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val, 105 {XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val,
@@ -118,7 +116,7 @@ STATIC ctl_table xfs_table[] = {
118 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 116 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
119 &sysctl_intvec, NULL, 117 &sysctl_intvec, NULL,
120 &xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max}, 118 &xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max},
121 119
122 {XFS_BUF_TIMER, "xfsbufd_centisecs", &xfs_params.xfs_buf_timer.val, 120 {XFS_BUF_TIMER, "xfsbufd_centisecs", &xfs_params.xfs_buf_timer.val,
123 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 121 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
124 &sysctl_intvec, NULL, 122 &sysctl_intvec, NULL,
@@ -136,14 +134,14 @@ STATIC ctl_table xfs_table[] = {
136 134
137 {XFS_ROTORSTEP, "rotorstep", &xfs_params.rotorstep.val, 135 {XFS_ROTORSTEP, "rotorstep", &xfs_params.rotorstep.val,
138 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 136 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
139 &sysctl_intvec, NULL, 137 &sysctl_intvec, NULL,
140 &xfs_params.rotorstep.min, &xfs_params.rotorstep.max}, 138 &xfs_params.rotorstep.min, &xfs_params.rotorstep.max},
141 139
142 /* please keep this the last entry */ 140 /* please keep this the last entry */
143#ifdef CONFIG_PROC_FS 141#ifdef CONFIG_PROC_FS
144 {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val, 142 {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
145 sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler, 143 sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler,
146 &sysctl_intvec, NULL, 144 &sysctl_intvec, NULL,
147 &xfs_params.stats_clear.min, &xfs_params.stats_clear.max}, 145 &xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
148#endif /* CONFIG_PROC_FS */ 146#endif /* CONFIG_PROC_FS */
149 147
diff --git a/fs/xfs/linux-2.6/xfs_vfs.c b/fs/xfs/linux-2.6/xfs_vfs.c
index 34cc902ec119..1a08a1d84252 100644
--- a/fs/xfs/linux-2.6/xfs_vfs.c
+++ b/fs/xfs/linux-2.6/xfs_vfs.c
@@ -29,10 +29,8 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_fs.h" 33#include "xfs_fs.h"
35#include "xfs_macros.h"
36#include "xfs_inum.h" 34#include "xfs_inum.h"
37#include "xfs_log.h" 35#include "xfs_log.h"
38#include "xfs_clnt.h" 36#include "xfs_clnt.h"
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index 9987977a4927..5971f6f6ec78 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -32,8 +32,9 @@
32 32
33#include "xfs.h" 33#include "xfs.h"
34#include "xfs_fs.h" 34#include "xfs_fs.h"
35#include "xfs_inum.h" 35#include "xfs_bit.h"
36#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
37#include "xfs_trans.h" 38#include "xfs_trans.h"
38#include "xfs_sb.h" 39#include "xfs_sb.h"
39#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -43,18 +44,17 @@
43#include "xfs_dmapi.h" 44#include "xfs_dmapi.h"
44#include "xfs_quota.h" 45#include "xfs_quota.h"
45#include "xfs_mount.h" 46#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 47#include "xfs_bmap_btree.h"
48#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 49#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 50#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 51#include "xfs_dir2_sf.h"
52#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 53#include "xfs_dinode.h"
55#include "xfs_inode.h" 54#include "xfs_inode.h"
55#include "xfs_btree.h"
56#include "xfs_ialloc.h"
56#include "xfs_bmap.h" 57#include "xfs_bmap.h"
57#include "xfs_bit.h"
58#include "xfs_rtalloc.h" 58#include "xfs_rtalloc.h"
59#include "xfs_error.h" 59#include "xfs_error.h"
60#include "xfs_itable.h" 60#include "xfs_itable.h"
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c
index e74eaa7dd1bc..86f223032751 100644
--- a/fs/xfs/quota/xfs_dquot_item.c
+++ b/fs/xfs/quota/xfs_dquot_item.c
@@ -32,8 +32,9 @@
32 32
33#include "xfs.h" 33#include "xfs.h"
34#include "xfs_fs.h" 34#include "xfs_fs.h"
35#include "xfs_inum.h" 35#include "xfs_bit.h"
36#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
37#include "xfs_trans.h" 38#include "xfs_trans.h"
38#include "xfs_sb.h" 39#include "xfs_sb.h"
39#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -43,18 +44,17 @@
43#include "xfs_dmapi.h" 44#include "xfs_dmapi.h"
44#include "xfs_quota.h" 45#include "xfs_quota.h"
45#include "xfs_mount.h" 46#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 47#include "xfs_bmap_btree.h"
48#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 49#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 50#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 51#include "xfs_dir2_sf.h"
52#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 53#include "xfs_dinode.h"
55#include "xfs_inode.h" 54#include "xfs_inode.h"
56#include "xfs_bmap.h" 55#include "xfs_bmap.h"
57#include "xfs_bit.h" 56#include "xfs_btree.h"
57#include "xfs_ialloc.h"
58#include "xfs_rtalloc.h" 58#include "xfs_rtalloc.h"
59#include "xfs_error.h" 59#include "xfs_error.h"
60#include "xfs_itable.h" 60#include "xfs_itable.h"
@@ -65,7 +65,6 @@
65#include "xfs_attr.h" 65#include "xfs_attr.h"
66#include "xfs_buf_item.h" 66#include "xfs_buf_item.h"
67#include "xfs_trans_priv.h" 67#include "xfs_trans_priv.h"
68
69#include "xfs_qm.h" 68#include "xfs_qm.h"
70 69
71 70
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index efde16e0a913..9041ea8452e1 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -32,8 +32,9 @@
32 32
33#include "xfs.h" 33#include "xfs.h"
34#include "xfs_fs.h" 34#include "xfs_fs.h"
35#include "xfs_inum.h" 35#include "xfs_bit.h"
36#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
37#include "xfs_clnt.h" 38#include "xfs_clnt.h"
38#include "xfs_trans.h" 39#include "xfs_trans.h"
39#include "xfs_sb.h" 40#include "xfs_sb.h"
@@ -44,21 +45,20 @@
44#include "xfs_dmapi.h" 45#include "xfs_dmapi.h"
45#include "xfs_quota.h" 46#include "xfs_quota.h"
46#include "xfs_mount.h" 47#include "xfs_mount.h"
47#include "xfs_alloc_btree.h"
48#include "xfs_bmap_btree.h" 48#include "xfs_bmap_btree.h"
49#include "xfs_alloc_btree.h"
49#include "xfs_ialloc_btree.h" 50#include "xfs_ialloc_btree.h"
50#include "xfs_btree.h"
51#include "xfs_ialloc.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 51#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 52#include "xfs_dir2_sf.h"
53#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 54#include "xfs_dinode.h"
56#include "xfs_inode.h" 55#include "xfs_inode.h"
57#include "xfs_bmap.h" 56#include "xfs_btree.h"
58#include "xfs_bit.h" 57#include "xfs_ialloc.h"
58#include "xfs_itable.h"
59#include "xfs_rtalloc.h" 59#include "xfs_rtalloc.h"
60#include "xfs_error.h" 60#include "xfs_error.h"
61#include "xfs_itable.h" 61#include "xfs_bmap.h"
62#include "xfs_rw.h" 62#include "xfs_rw.h"
63#include "xfs_acl.h" 63#include "xfs_acl.h"
64#include "xfs_cap.h" 64#include "xfs_cap.h"
@@ -67,7 +67,6 @@
67#include "xfs_buf_item.h" 67#include "xfs_buf_item.h"
68#include "xfs_trans_space.h" 68#include "xfs_trans_space.h"
69#include "xfs_utils.h" 69#include "xfs_utils.h"
70
71#include "xfs_qm.h" 70#include "xfs_qm.h"
72 71
73/* 72/*
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/quota/xfs_qm_bhv.c
index 8890a18a99d8..dac7cf8d729c 100644
--- a/fs/xfs/quota/xfs_qm_bhv.c
+++ b/fs/xfs/quota/xfs_qm_bhv.c
@@ -32,39 +32,39 @@
32 32
33#include "xfs.h" 33#include "xfs.h"
34#include "xfs_fs.h" 34#include "xfs_fs.h"
35#include "xfs_inum.h" 35#include "xfs_bit.h"
36#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
37#include "xfs_clnt.h" 38#include "xfs_clnt.h"
38#include "xfs_trans.h" 39#include "xfs_trans.h"
39#include "xfs_sb.h" 40#include "xfs_sb.h"
41#include "xfs_ag.h"
40#include "xfs_dir.h" 42#include "xfs_dir.h"
41#include "xfs_dir2.h" 43#include "xfs_dir2.h"
42#include "xfs_alloc.h" 44#include "xfs_alloc.h"
43#include "xfs_dmapi.h" 45#include "xfs_dmapi.h"
44#include "xfs_quota.h" 46#include "xfs_quota.h"
45#include "xfs_mount.h" 47#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 48#include "xfs_bmap_btree.h"
49#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 50#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 51#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 52#include "xfs_dir2_sf.h"
53#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 54#include "xfs_dinode.h"
55#include "xfs_inode.h" 55#include "xfs_inode.h"
56#include "xfs_ialloc.h"
57#include "xfs_itable.h"
58#include "xfs_btree.h"
56#include "xfs_bmap.h" 59#include "xfs_bmap.h"
57#include "xfs_bit.h"
58#include "xfs_rtalloc.h" 60#include "xfs_rtalloc.h"
59#include "xfs_error.h" 61#include "xfs_error.h"
60#include "xfs_itable.h"
61#include "xfs_rw.h" 62#include "xfs_rw.h"
62#include "xfs_acl.h" 63#include "xfs_acl.h"
63#include "xfs_cap.h" 64#include "xfs_cap.h"
64#include "xfs_mac.h" 65#include "xfs_mac.h"
65#include "xfs_attr.h" 66#include "xfs_attr.h"
66#include "xfs_buf_item.h" 67#include "xfs_buf_item.h"
67
68#include "xfs_qm.h" 68#include "xfs_qm.h"
69 69
70#define MNTOPT_QUOTA "quota" /* disk quotas (user) */ 70#define MNTOPT_QUOTA "quota" /* disk quotas (user) */
diff --git a/fs/xfs/quota/xfs_qm_stats.c b/fs/xfs/quota/xfs_qm_stats.c
index 29978e037fee..b8befe1c90ec 100644
--- a/fs/xfs/quota/xfs_qm_stats.c
+++ b/fs/xfs/quota/xfs_qm_stats.c
@@ -32,31 +32,32 @@
32 32
33#include "xfs.h" 33#include "xfs.h"
34#include "xfs_fs.h" 34#include "xfs_fs.h"
35#include "xfs_inum.h" 35#include "xfs_bit.h"
36#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
37#include "xfs_trans.h" 38#include "xfs_trans.h"
38#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h"
39#include "xfs_dir.h" 41#include "xfs_dir.h"
40#include "xfs_dir2.h" 42#include "xfs_dir2.h"
41#include "xfs_alloc.h" 43#include "xfs_alloc.h"
42#include "xfs_dmapi.h" 44#include "xfs_dmapi.h"
43#include "xfs_quota.h" 45#include "xfs_quota.h"
44#include "xfs_mount.h" 46#include "xfs_mount.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 47#include "xfs_bmap_btree.h"
48#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 49#include "xfs_ialloc_btree.h"
48#include "xfs_btree.h"
49#include "xfs_ialloc.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dir_sf.h" 50#include "xfs_dir_sf.h"
52#include "xfs_dir2_sf.h" 51#include "xfs_dir2_sf.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dinode.h" 53#include "xfs_dinode.h"
54#include "xfs_inode.h" 54#include "xfs_inode.h"
55#include "xfs_ialloc.h"
56#include "xfs_itable.h"
55#include "xfs_bmap.h" 57#include "xfs_bmap.h"
56#include "xfs_bit.h" 58#include "xfs_btree.h"
57#include "xfs_rtalloc.h" 59#include "xfs_rtalloc.h"
58#include "xfs_error.h" 60#include "xfs_error.h"
59#include "xfs_itable.h"
60#include "xfs_rw.h" 61#include "xfs_rw.h"
61#include "xfs_acl.h" 62#include "xfs_acl.h"
62#include "xfs_cap.h" 63#include "xfs_cap.h"
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index 485f83d41191..ba320f6431a3 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -32,31 +32,32 @@
32 32
33#include "xfs.h" 33#include "xfs.h"
34#include "xfs_fs.h" 34#include "xfs_fs.h"
35#include "xfs_inum.h" 35#include "xfs_bit.h"
36#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
37#include "xfs_trans.h" 38#include "xfs_trans.h"
38#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h"
39#include "xfs_dir.h" 41#include "xfs_dir.h"
40#include "xfs_dir2.h" 42#include "xfs_dir2.h"
41#include "xfs_alloc.h" 43#include "xfs_alloc.h"
42#include "xfs_dmapi.h" 44#include "xfs_dmapi.h"
43#include "xfs_quota.h" 45#include "xfs_quota.h"
44#include "xfs_mount.h" 46#include "xfs_mount.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 47#include "xfs_bmap_btree.h"
48#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 49#include "xfs_ialloc_btree.h"
48#include "xfs_btree.h"
49#include "xfs_ialloc.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dir_sf.h" 50#include "xfs_dir_sf.h"
52#include "xfs_dir2_sf.h" 51#include "xfs_dir2_sf.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dinode.h" 53#include "xfs_dinode.h"
54#include "xfs_inode.h" 54#include "xfs_inode.h"
55#include "xfs_ialloc.h"
56#include "xfs_itable.h"
55#include "xfs_bmap.h" 57#include "xfs_bmap.h"
56#include "xfs_bit.h" 58#include "xfs_btree.h"
57#include "xfs_rtalloc.h" 59#include "xfs_rtalloc.h"
58#include "xfs_error.h" 60#include "xfs_error.h"
59#include "xfs_itable.h"
60#include "xfs_rw.h" 61#include "xfs_rw.h"
61#include "xfs_acl.h" 62#include "xfs_acl.h"
62#include "xfs_cap.h" 63#include "xfs_cap.h"
@@ -64,7 +65,6 @@
64#include "xfs_attr.h" 65#include "xfs_attr.h"
65#include "xfs_buf_item.h" 66#include "xfs_buf_item.h"
66#include "xfs_utils.h" 67#include "xfs_utils.h"
67
68#include "xfs_qm.h" 68#include "xfs_qm.h"
69 69
70#ifdef DEBUG 70#ifdef DEBUG
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c
index 3b99daf8a640..afa3bb57e5d1 100644
--- a/fs/xfs/quota/xfs_trans_dquot.c
+++ b/fs/xfs/quota/xfs_trans_dquot.c
@@ -32,8 +32,9 @@
32 32
33#include "xfs.h" 33#include "xfs.h"
34#include "xfs_fs.h" 34#include "xfs_fs.h"
35#include "xfs_inum.h" 35#include "xfs_bit.h"
36#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
37#include "xfs_trans.h" 38#include "xfs_trans.h"
38#include "xfs_sb.h" 39#include "xfs_sb.h"
39#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -43,21 +44,20 @@
43#include "xfs_dmapi.h" 44#include "xfs_dmapi.h"
44#include "xfs_quota.h" 45#include "xfs_quota.h"
45#include "xfs_mount.h" 46#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 47#include "xfs_bmap_btree.h"
48#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 49#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h" 50#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 51#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 52#include "xfs_dir2_sf.h"
54#include "xfs_dinode.h" 53#include "xfs_dinode.h"
55#include "xfs_inode.h" 54#include "xfs_inode.h"
55#include "xfs_ialloc.h"
56#include "xfs_itable.h"
57#include "xfs_btree.h"
56#include "xfs_bmap.h" 58#include "xfs_bmap.h"
57#include "xfs_bit.h"
58#include "xfs_rtalloc.h" 59#include "xfs_rtalloc.h"
59#include "xfs_error.h" 60#include "xfs_error.h"
60#include "xfs_itable.h"
61#include "xfs_rw.h" 61#include "xfs_rw.h"
62#include "xfs_acl.h" 62#include "xfs_acl.h"
63#include "xfs_cap.h" 63#include "xfs_cap.h"
diff --git a/fs/xfs/xfs.h b/fs/xfs/xfs.h
index 7e276dcaf4dc..30c4ab4f9c45 100644
--- a/fs/xfs/xfs.h
+++ b/fs/xfs/xfs.h
@@ -34,7 +34,4 @@
34 34
35#include <linux-2.6/xfs_linux.h> 35#include <linux-2.6/xfs_linux.h>
36 36
37#include <xfs_fs.h>
38#include <xfs_macros.h>
39
40#endif /* __XFS_H__ */ 37#endif /* __XFS_H__ */
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 49fdc392fc8a..33c5f402b4ed 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -29,21 +29,23 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34 33#include "xfs_fs.h"
34#include "xfs_types.h"
35#include "xfs_bit.h"
35#include "xfs_inum.h" 36#include "xfs_inum.h"
37#include "xfs_ag.h"
36#include "xfs_dir.h" 38#include "xfs_dir.h"
37#include "xfs_dir2.h" 39#include "xfs_dir2.h"
38#include "xfs_alloc_btree.h"
39#include "xfs_bmap_btree.h" 40#include "xfs_bmap_btree.h"
41#include "xfs_alloc_btree.h"
40#include "xfs_ialloc_btree.h" 42#include "xfs_ialloc_btree.h"
41#include "xfs_btree.h"
42#include "xfs_attr_sf.h"
43#include "xfs_dir_sf.h" 43#include "xfs_dir_sf.h"
44#include "xfs_dir2_sf.h" 44#include "xfs_dir2_sf.h"
45#include "xfs_attr_sf.h"
45#include "xfs_dinode.h" 46#include "xfs_dinode.h"
46#include "xfs_inode.h" 47#include "xfs_inode.h"
48#include "xfs_btree.h"
47#include "xfs_acl.h" 49#include "xfs_acl.h"
48#include "xfs_mac.h" 50#include "xfs_mac.h"
49#include "xfs_attr.h" 51#include "xfs_attr.h"
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
index 96b70f7fba39..7d15ef341a90 100644
--- a/fs/xfs/xfs_ag.h
+++ b/fs/xfs/xfs_ag.h
@@ -46,18 +46,9 @@ struct xfs_trans;
46#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */ 46#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */
47#define XFS_AGF_VERSION 1 47#define XFS_AGF_VERSION 1
48#define XFS_AGI_VERSION 1 48#define XFS_AGI_VERSION 1
49#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGF_GOOD_VERSION) 49
50int xfs_agf_good_version(unsigned v); 50#define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)
51#define XFS_AGF_GOOD_VERSION(v) xfs_agf_good_version(v) 51#define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)
52#else
53#define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)
54#endif
55#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGI_GOOD_VERSION)
56int xfs_agi_good_version(unsigned v);
57#define XFS_AGI_GOOD_VERSION(v) xfs_agi_good_version(v)
58#else
59#define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)
60#endif
61 52
62/* 53/*
63 * Btree number 0 is bno, 1 is cnt. This value gives the size of the 54 * Btree number 0 is bno, 1 is cnt. This value gives the size of the
@@ -110,12 +101,9 @@ typedef struct xfs_agf
110 101
111/* disk block (xfs_daddr_t) in the AG */ 102/* disk block (xfs_daddr_t) in the AG */
112#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log)) 103#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))
113#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGF_BLOCK) 104#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
114xfs_agblock_t xfs_agf_block(struct xfs_mount *mp); 105#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp))
115#define XFS_AGF_BLOCK(mp) xfs_agf_block(mp) 106
116#else
117#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
118#endif
119 107
120/* 108/*
121 * Size of the unlinked inode hash table in the agi. 109 * Size of the unlinked inode hash table in the agi.
@@ -165,25 +153,17 @@ typedef struct xfs_agi
165 153
166/* disk block (xfs_daddr_t) in the AG */ 154/* disk block (xfs_daddr_t) in the AG */
167#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log)) 155#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))
168#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGI_BLOCK) 156#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
169xfs_agblock_t xfs_agi_block(struct xfs_mount *mp); 157#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp))
170#define XFS_AGI_BLOCK(mp) xfs_agi_block(mp)
171#else
172#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
173#endif
174 158
175/* 159/*
176 * The third a.g. block contains the a.g. freelist, an array 160 * The third a.g. block contains the a.g. freelist, an array
177 * of block pointers to blocks owned by the allocation btree code. 161 * of block pointers to blocks owned by the allocation btree code.
178 */ 162 */
179#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) 163#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
180#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGFL_BLOCK) 164#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
181xfs_agblock_t xfs_agfl_block(struct xfs_mount *mp);
182#define XFS_AGFL_BLOCK(mp) xfs_agfl_block(mp)
183#else
184#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
185#endif
186#define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t)) 165#define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t))
166#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp))
187 167
188typedef struct xfs_agfl { 168typedef struct xfs_agfl {
189 xfs_agblock_t agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */ 169 xfs_agblock_t agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */
@@ -230,116 +210,38 @@ typedef struct xfs_perag
230 xfs_perag_busy_t *pagb_list; /* unstable blocks */ 210 xfs_perag_busy_t *pagb_list; /* unstable blocks */
231} xfs_perag_t; 211} xfs_perag_t;
232 212
233#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_MAXLEVELS) 213#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
234int xfs_ag_maxlevels(struct xfs_mount *mp); 214#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \
235#define XFS_AG_MAXLEVELS(mp) xfs_ag_maxlevels(mp) 215 (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
236#else 216#define XFS_MIN_FREELIST(a,mp) \
237#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels) 217 (XFS_MIN_FREELIST_RAW( \
238#endif
239#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST)
240int xfs_min_freelist(xfs_agf_t *a, struct xfs_mount *mp);
241#define XFS_MIN_FREELIST(a,mp) xfs_min_freelist(a,mp)
242#else
243#define XFS_MIN_FREELIST(a,mp) \
244 XFS_MIN_FREELIST_RAW( \
245 INT_GET((a)->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT), \ 218 INT_GET((a)->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT), \
246 INT_GET((a)->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT), mp) 219 INT_GET((a)->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT), mp))
247#endif
248#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST_PAG)
249int xfs_min_freelist_pag(xfs_perag_t *pag, struct xfs_mount *mp);
250#define XFS_MIN_FREELIST_PAG(pag,mp) xfs_min_freelist_pag(pag,mp)
251#else
252#define XFS_MIN_FREELIST_PAG(pag,mp) \ 220#define XFS_MIN_FREELIST_PAG(pag,mp) \
253 XFS_MIN_FREELIST_RAW((uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \ 221 (XFS_MIN_FREELIST_RAW( \
254 (uint_t)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp) 222 (uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
255#endif 223 (uint_t)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))
256#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST_RAW)
257int xfs_min_freelist_raw(int bl, int cl, struct xfs_mount *mp);
258#define XFS_MIN_FREELIST_RAW(bl,cl,mp) xfs_min_freelist_raw(bl,cl,mp)
259#else
260#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \
261 (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + \
262 MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
263#endif
264 224
265#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGB_TO_FSB) 225#define XFS_AGB_TO_FSB(mp,agno,agbno) \
266xfs_fsblock_t xfs_agb_to_fsb(struct xfs_mount *mp, xfs_agnumber_t agno,
267 xfs_agblock_t agbno);
268#define XFS_AGB_TO_FSB(mp,agno,agbno) xfs_agb_to_fsb(mp,agno,agbno)
269#else
270#define XFS_AGB_TO_FSB(mp,agno,agbno) \
271 (((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno)) 226 (((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))
272#endif 227#define XFS_FSB_TO_AGNO(mp,fsbno) \
273#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_AGNO)
274xfs_agnumber_t xfs_fsb_to_agno(struct xfs_mount *mp, xfs_fsblock_t fsbno);
275#define XFS_FSB_TO_AGNO(mp,fsbno) xfs_fsb_to_agno(mp,fsbno)
276#else
277#define XFS_FSB_TO_AGNO(mp,fsbno) \
278 ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog)) 228 ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))
279#endif 229#define XFS_FSB_TO_AGBNO(mp,fsbno) \
280#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_AGBNO)
281xfs_agblock_t xfs_fsb_to_agbno(struct xfs_mount *mp, xfs_fsblock_t fsbno);
282#define XFS_FSB_TO_AGBNO(mp,fsbno) xfs_fsb_to_agbno(mp,fsbno)
283#else
284#define XFS_FSB_TO_AGBNO(mp,fsbno) \
285 ((xfs_agblock_t)((fsbno) & XFS_MASK32LO((mp)->m_sb.sb_agblklog))) 230 ((xfs_agblock_t)((fsbno) & XFS_MASK32LO((mp)->m_sb.sb_agblklog)))
286#endif 231#define XFS_AGB_TO_DADDR(mp,agno,agbno) \
287 232 ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \
288#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGB_TO_DADDR) 233 (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))
289xfs_daddr_t xfs_agb_to_daddr(struct xfs_mount *mp, xfs_agnumber_t agno, 234#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
290 xfs_agblock_t agbno);
291#define XFS_AGB_TO_DADDR(mp,agno,agbno) xfs_agb_to_daddr(mp,agno,agbno)
292#else
293#define XFS_AGB_TO_DADDR(mp,agno,agbno) \
294 ((xfs_daddr_t)(XFS_FSB_TO_BB(mp, \
295 (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno))))
296#endif
297/*
298 * XFS_DADDR_TO_AGNO and XFS_DADDR_TO_AGBNO moved to xfs_mount.h
299 * to avoid header file ordering change
300 */
301
302#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_DADDR)
303xfs_daddr_t xfs_ag_daddr(struct xfs_mount *mp, xfs_agnumber_t agno,
304 xfs_daddr_t d);
305#define XFS_AG_DADDR(mp,agno,d) xfs_ag_daddr(mp,agno,d)
306#else
307#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
308#endif
309
310#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGF)
311xfs_agf_t *xfs_buf_to_agf(struct xfs_buf *bp);
312#define XFS_BUF_TO_AGF(bp) xfs_buf_to_agf(bp)
313#else
314#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp))
315#endif
316#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGI)
317xfs_agi_t *xfs_buf_to_agi(struct xfs_buf *bp);
318#define XFS_BUF_TO_AGI(bp) xfs_buf_to_agi(bp)
319#else
320#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp))
321#endif
322#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGFL)
323xfs_agfl_t *xfs_buf_to_agfl(struct xfs_buf *bp);
324#define XFS_BUF_TO_AGFL(bp) xfs_buf_to_agfl(bp)
325#else
326#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp))
327#endif
328 235
329/* 236/*
330 * For checking for bad ranges of xfs_daddr_t's, covering multiple 237 * For checking for bad ranges of xfs_daddr_t's, covering multiple
331 * allocation groups or a single xfs_daddr_t that's a superblock copy. 238 * allocation groups or a single xfs_daddr_t that's a superblock copy.
332 */ 239 */
333#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_CHECK_DADDR)
334void xfs_ag_check_daddr(struct xfs_mount *mp, xfs_daddr_t d, xfs_extlen_t len);
335#define XFS_AG_CHECK_DADDR(mp,d,len) xfs_ag_check_daddr(mp,d,len)
336#else
337#define XFS_AG_CHECK_DADDR(mp,d,len) \ 240#define XFS_AG_CHECK_DADDR(mp,d,len) \
338 ((len) == 1 ? \ 241 ((len) == 1 ? \
339 ASSERT((d) == XFS_SB_DADDR || \ 242 ASSERT((d) == XFS_SB_DADDR || \
340 XFS_DADDR_TO_AGBNO(mp, d) != XFS_SB_DADDR) : \ 243 XFS_DADDR_TO_AGBNO(mp, d) != XFS_SB_DADDR) : \
341 ASSERT(XFS_DADDR_TO_AGNO(mp, d) == \ 244 ASSERT(XFS_DADDR_TO_AGNO(mp, d) == \
342 XFS_DADDR_TO_AGNO(mp, (d) + (len) - 1))) 245 XFS_DADDR_TO_AGNO(mp, (d) + (len) - 1)))
343#endif
344 246
345#endif /* __XFS_AG_H__ */ 247#endif /* __XFS_AG_H__ */
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index dcfe19703620..c3a30e14bd13 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -29,28 +29,30 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * Free space allocation for XFS.
35 */
36#include "xfs.h" 32#include "xfs.h"
37#include "xfs_macros.h" 33#include "xfs_fs.h"
38#include "xfs_types.h" 34#include "xfs_types.h"
39#include "xfs_inum.h" 35#include "xfs_bit.h"
40#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
41#include "xfs_trans.h" 38#include "xfs_trans.h"
42#include "xfs_sb.h" 39#include "xfs_sb.h"
43#include "xfs_ag.h" 40#include "xfs_ag.h"
44#include "xfs_dir.h" 41#include "xfs_dir.h"
42#include "xfs_dir2.h"
45#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
46#include "xfs_mount.h" 44#include "xfs_mount.h"
47#include "xfs_alloc_btree.h"
48#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
49#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
48#include "xfs_dir_sf.h"
49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dinode.h"
52#include "xfs_inode.h"
50#include "xfs_btree.h" 53#include "xfs_btree.h"
51#include "xfs_ialloc.h" 54#include "xfs_ialloc.h"
52#include "xfs_alloc.h" 55#include "xfs_alloc.h"
53#include "xfs_bit.h"
54#include "xfs_error.h" 56#include "xfs_error.h"
55 57
56 58
diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c
index e0355a12d946..ccc421b438ff 100644
--- a/fs/xfs/xfs_alloc_btree.c
+++ b/fs/xfs/xfs_alloc_btree.c
@@ -29,25 +29,27 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * Free space allocation for XFS.
35 */
36
37#include "xfs.h" 32#include "xfs.h"
38#include "xfs_macros.h" 33#include "xfs_fs.h"
39#include "xfs_types.h" 34#include "xfs_types.h"
40#include "xfs_inum.h" 35#include "xfs_bit.h"
41#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
42#include "xfs_trans.h" 38#include "xfs_trans.h"
43#include "xfs_sb.h" 39#include "xfs_sb.h"
44#include "xfs_ag.h" 40#include "xfs_ag.h"
45#include "xfs_dir.h" 41#include "xfs_dir.h"
42#include "xfs_dir2.h"
46#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
47#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_bmap_btree.h"
48#include "xfs_alloc_btree.h" 46#include "xfs_alloc_btree.h"
49#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
50#include "xfs_bmap_btree.h" 48#include "xfs_dir_sf.h"
49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dinode.h"
52#include "xfs_inode.h"
51#include "xfs_btree.h" 53#include "xfs_btree.h"
52#include "xfs_ialloc.h" 54#include "xfs_ialloc.h"
53#include "xfs_alloc.h" 55#include "xfs_alloc.h"
diff --git a/fs/xfs/xfs_alloc_btree.h b/fs/xfs/xfs_alloc_btree.h
index ed5161a572ef..f857b0f248d3 100644
--- a/fs/xfs/xfs_alloc_btree.h
+++ b/fs/xfs/xfs_alloc_btree.h
@@ -62,38 +62,14 @@ typedef xfs_agblock_t xfs_alloc_ptr_t; /* btree pointer type */
62 /* btree block header type */ 62 /* btree block header type */
63typedef struct xfs_btree_sblock xfs_alloc_block_t; 63typedef struct xfs_btree_sblock xfs_alloc_block_t;
64 64
65#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_ALLOC_BLOCK) 65#define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)XFS_BUF_PTR(bp))
66xfs_alloc_block_t *xfs_buf_to_alloc_block(struct xfs_buf *bp);
67#define XFS_BUF_TO_ALLOC_BLOCK(bp) xfs_buf_to_alloc_block(bp)
68#else
69#define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)(XFS_BUF_PTR(bp)))
70#endif
71 66
72/* 67/*
73 * Real block structures have a size equal to the disk block size. 68 * Real block structures have a size equal to the disk block size.
74 */ 69 */
75
76#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_SIZE)
77int xfs_alloc_block_size(int lev, struct xfs_btree_cur *cur);
78#define XFS_ALLOC_BLOCK_SIZE(lev,cur) xfs_alloc_block_size(lev,cur)
79#else
80#define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) 70#define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
81#endif 71#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_alloc_mxr[lev != 0])
82 72#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_alloc_mnr[lev != 0])
83#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MAXRECS)
84int xfs_alloc_block_maxrecs(int lev, struct xfs_btree_cur *cur);
85#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) xfs_alloc_block_maxrecs(lev,cur)
86#else
87#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) \
88 ((cur)->bc_mp->m_alloc_mxr[lev != 0])
89#endif
90#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MINRECS)
91int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur);
92#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) xfs_alloc_block_minrecs(lev,cur)
93#else
94#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) \
95 ((cur)->bc_mp->m_alloc_mnr[lev != 0])
96#endif
97 73
98/* 74/*
99 * Minimum and maximum blocksize and sectorsize. 75 * Minimum and maximum blocksize and sectorsize.
@@ -113,145 +89,80 @@ int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur);
113 * Block numbers in the AG: 89 * Block numbers in the AG:
114 * SB is sector 0, AGF is sector 1, AGI is sector 2, AGFL is sector 3. 90 * SB is sector 0, AGF is sector 1, AGI is sector 2, AGFL is sector 3.
115 */ 91 */
116#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BNO_BLOCK)
117xfs_agblock_t xfs_bno_block(struct xfs_mount *mp);
118#define XFS_BNO_BLOCK(mp) xfs_bno_block(mp)
119#else
120#define XFS_BNO_BLOCK(mp) ((xfs_agblock_t)(XFS_AGFL_BLOCK(mp) + 1)) 92#define XFS_BNO_BLOCK(mp) ((xfs_agblock_t)(XFS_AGFL_BLOCK(mp) + 1))
121#endif
122#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CNT_BLOCK)
123xfs_agblock_t xfs_cnt_block(struct xfs_mount *mp);
124#define XFS_CNT_BLOCK(mp) xfs_cnt_block(mp)
125#else
126#define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) + 1)) 93#define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) + 1))
127#endif
128 94
129/* 95/*
130 * Record, key, and pointer address macros for btree blocks. 96 * Record, key, and pointer address macros for btree blocks.
131 */ 97 */
132#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_REC_ADDR)
133xfs_alloc_rec_t *xfs_alloc_rec_addr(xfs_alloc_block_t *bb, int i,
134 struct xfs_btree_cur *cur);
135#define XFS_ALLOC_REC_ADDR(bb,i,cur) xfs_alloc_rec_addr(bb,i,cur)
136#else
137#define XFS_ALLOC_REC_ADDR(bb,i,cur) \ 98#define XFS_ALLOC_REC_ADDR(bb,i,cur) \
138 XFS_BTREE_REC_ADDR(XFS_ALLOC_BLOCK_SIZE(0,cur), xfs_alloc, bb, i, \ 99 XFS_BTREE_REC_ADDR(XFS_ALLOC_BLOCK_SIZE(0,cur), xfs_alloc, \
139 XFS_ALLOC_BLOCK_MAXRECS(0, cur)) 100 bb, i, XFS_ALLOC_BLOCK_MAXRECS(0, cur))
140#endif
141 101
142#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_KEY_ADDR)
143xfs_alloc_key_t *xfs_alloc_key_addr(xfs_alloc_block_t *bb, int i,
144 struct xfs_btree_cur *cur);
145#define XFS_ALLOC_KEY_ADDR(bb,i,cur) xfs_alloc_key_addr(bb,i,cur)
146#else
147#define XFS_ALLOC_KEY_ADDR(bb,i,cur) \ 102#define XFS_ALLOC_KEY_ADDR(bb,i,cur) \
148 XFS_BTREE_KEY_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, bb, i, \ 103 XFS_BTREE_KEY_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, \
149 XFS_ALLOC_BLOCK_MAXRECS(1, cur)) 104 bb, i, XFS_ALLOC_BLOCK_MAXRECS(1, cur))
150#endif
151 105
152#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_PTR_ADDR)
153xfs_alloc_ptr_t *xfs_alloc_ptr_addr(xfs_alloc_block_t *bb, int i,
154 struct xfs_btree_cur *cur);
155#define XFS_ALLOC_PTR_ADDR(bb,i,cur) xfs_alloc_ptr_addr(bb,i,cur)
156#else
157#define XFS_ALLOC_PTR_ADDR(bb,i,cur) \ 106#define XFS_ALLOC_PTR_ADDR(bb,i,cur) \
158 XFS_BTREE_PTR_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, bb, i, \ 107 XFS_BTREE_PTR_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, \
159 XFS_ALLOC_BLOCK_MAXRECS(1, cur)) 108 bb, i, XFS_ALLOC_BLOCK_MAXRECS(1, cur))
160#endif
161
162/*
163 * Prototypes for externally visible routines.
164 */
165 109
166/* 110/*
167 * Decrement cursor by one record at the level. 111 * Decrement cursor by one record at the level.
168 * For nonzero levels the leaf-ward information is untouched. 112 * For nonzero levels the leaf-ward information is untouched.
169 */ 113 */
170int /* error */ 114extern int xfs_alloc_decrement(struct xfs_btree_cur *cur, int level, int *stat);
171xfs_alloc_decrement(
172 struct xfs_btree_cur *cur, /* btree cursor */
173 int level, /* level in btree, 0 is leaf */
174 int *stat); /* success/failure */
175 115
176/* 116/*
177 * Delete the record pointed to by cur. 117 * Delete the record pointed to by cur.
178 * The cursor refers to the place where the record was (could be inserted) 118 * The cursor refers to the place where the record was (could be inserted)
179 * when the operation returns. 119 * when the operation returns.
180 */ 120 */
181int /* error */ 121extern int xfs_alloc_delete(struct xfs_btree_cur *cur, int *stat);
182xfs_alloc_delete(
183 struct xfs_btree_cur *cur, /* btree cursor */
184 int *stat); /* success/failure */
185 122
186/* 123/*
187 * Get the data from the pointed-to record. 124 * Get the data from the pointed-to record.
188 */ 125 */
189int /* error */ 126extern int xfs_alloc_get_rec(struct xfs_btree_cur *cur, xfs_agblock_t *bno,
190xfs_alloc_get_rec( 127 xfs_extlen_t *len, int *stat);
191 struct xfs_btree_cur *cur, /* btree cursor */
192 xfs_agblock_t *bno, /* output: starting block of extent */
193 xfs_extlen_t *len, /* output: length of extent */
194 int *stat); /* output: success/failure */
195 128
196/* 129/*
197 * Increment cursor by one record at the level. 130 * Increment cursor by one record at the level.
198 * For nonzero levels the leaf-ward information is untouched. 131 * For nonzero levels the leaf-ward information is untouched.
199 */ 132 */
200int /* error */ 133extern int xfs_alloc_increment(struct xfs_btree_cur *cur, int level, int *stat);
201xfs_alloc_increment(
202 struct xfs_btree_cur *cur, /* btree cursor */
203 int level, /* level in btree, 0 is leaf */
204 int *stat); /* success/failure */
205 134
206/* 135/*
207 * Insert the current record at the point referenced by cur. 136 * Insert the current record at the point referenced by cur.
208 * The cursor may be inconsistent on return if splits have been done. 137 * The cursor may be inconsistent on return if splits have been done.
209 */ 138 */
210int /* error */ 139extern int xfs_alloc_insert(struct xfs_btree_cur *cur, int *stat);
211xfs_alloc_insert(
212 struct xfs_btree_cur *cur, /* btree cursor */
213 int *stat); /* success/failure */
214 140
215/* 141/*
216 * Lookup the record equal to [bno, len] in the btree given by cur. 142 * Lookup the record equal to [bno, len] in the btree given by cur.
217 */ 143 */
218int /* error */ 144extern int xfs_alloc_lookup_eq(struct xfs_btree_cur *cur, xfs_agblock_t bno,
219xfs_alloc_lookup_eq( 145 xfs_extlen_t len, int *stat);
220 struct xfs_btree_cur *cur, /* btree cursor */
221 xfs_agblock_t bno, /* starting block of extent */
222 xfs_extlen_t len, /* length of extent */
223 int *stat); /* success/failure */
224 146
225/* 147/*
226 * Lookup the first record greater than or equal to [bno, len] 148 * Lookup the first record greater than or equal to [bno, len]
227 * in the btree given by cur. 149 * in the btree given by cur.
228 */ 150 */
229int /* error */ 151extern int xfs_alloc_lookup_ge(struct xfs_btree_cur *cur, xfs_agblock_t bno,
230xfs_alloc_lookup_ge( 152 xfs_extlen_t len, int *stat);
231 struct xfs_btree_cur *cur, /* btree cursor */
232 xfs_agblock_t bno, /* starting block of extent */
233 xfs_extlen_t len, /* length of extent */
234 int *stat); /* success/failure */
235 153
236/* 154/*
237 * Lookup the first record less than or equal to [bno, len] 155 * Lookup the first record less than or equal to [bno, len]
238 * in the btree given by cur. 156 * in the btree given by cur.
239 */ 157 */
240int /* error */ 158extern int xfs_alloc_lookup_le(struct xfs_btree_cur *cur, xfs_agblock_t bno,
241xfs_alloc_lookup_le( 159 xfs_extlen_t len, int *stat);
242 struct xfs_btree_cur *cur, /* btree cursor */
243 xfs_agblock_t bno, /* starting block of extent */
244 xfs_extlen_t len, /* length of extent */
245 int *stat); /* success/failure */
246 160
247/* 161/*
248 * Update the record referred to by cur, to the value given by [bno, len]. 162 * Update the record referred to by cur, to the value given by [bno, len].
249 * This either works (return 0) or gets an EFSCORRUPTED error. 163 * This either works (return 0) or gets an EFSCORRUPTED error.
250 */ 164 */
251int /* error */ 165extern int xfs_alloc_update(struct xfs_btree_cur *cur, xfs_agblock_t bno,
252xfs_alloc_update( 166 xfs_extlen_t len);
253 struct xfs_btree_cur *cur, /* btree cursor */
254 xfs_agblock_t bno, /* starting block of extent */
255 xfs_extlen_t len); /* length of extent */
256 167
257#endif /* __XFS_ALLOC_BTREE_H__ */ 168#endif /* __XFS_ALLOC_BTREE_H__ */
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index c2c14b2103f1..7db18e9649df 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -31,11 +31,11 @@
31 */ 31 */
32 32
33#include "xfs.h" 33#include "xfs.h"
34 34#include "xfs_fs.h"
35#include "xfs_macros.h"
36#include "xfs_types.h" 35#include "xfs_types.h"
37#include "xfs_inum.h" 36#include "xfs_bit.h"
38#include "xfs_log.h" 37#include "xfs_log.h"
38#include "xfs_inum.h"
39#include "xfs_trans.h" 39#include "xfs_trans.h"
40#include "xfs_sb.h" 40#include "xfs_sb.h"
41#include "xfs_ag.h" 41#include "xfs_ag.h"
@@ -43,27 +43,26 @@
43#include "xfs_dir2.h" 43#include "xfs_dir2.h"
44#include "xfs_dmapi.h" 44#include "xfs_dmapi.h"
45#include "xfs_mount.h" 45#include "xfs_mount.h"
46#include "xfs_alloc_btree.h" 46#include "xfs_da_btree.h"
47#include "xfs_bmap_btree.h" 47#include "xfs_bmap_btree.h"
48#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 49#include "xfs_ialloc_btree.h"
49#include "xfs_alloc.h"
50#include "xfs_btree.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 50#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 51#include "xfs_dir2_sf.h"
52#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 53#include "xfs_dinode.h"
55#include "xfs_inode_item.h"
56#include "xfs_inode.h" 54#include "xfs_inode.h"
55#include "xfs_alloc.h"
56#include "xfs_btree.h"
57#include "xfs_inode_item.h"
57#include "xfs_bmap.h" 58#include "xfs_bmap.h"
58#include "xfs_da_btree.h"
59#include "xfs_attr.h" 59#include "xfs_attr.h"
60#include "xfs_attr_leaf.h" 60#include "xfs_attr_leaf.h"
61#include "xfs_error.h" 61#include "xfs_error.h"
62#include "xfs_bit.h"
63#include "xfs_quota.h" 62#include "xfs_quota.h"
64#include "xfs_rw.h"
65#include "xfs_trans_space.h" 63#include "xfs_trans_space.h"
66#include "xfs_acl.h" 64#include "xfs_acl.h"
65#include "xfs_rw.h"
67 66
68/* 67/*
69 * xfs_attr.c 68 * xfs_attr.c
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index 63c473f8d6db..be82014b9522 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -29,18 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32/*
33 * xfs_attr_leaf.c
34 *
35 * GROT: figure out how to recover gracefully when bmap returns ENOSPC.
36 */
37
38#include "xfs.h" 32#include "xfs.h"
39 33#include "xfs_fs.h"
40#include "xfs_macros.h"
41#include "xfs_types.h" 34#include "xfs_types.h"
42#include "xfs_inum.h" 35#include "xfs_bit.h"
43#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
44#include "xfs_trans.h" 38#include "xfs_trans.h"
45#include "xfs_sb.h" 39#include "xfs_sb.h"
46#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -48,23 +42,22 @@
48#include "xfs_dir2.h" 42#include "xfs_dir2.h"
49#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
50#include "xfs_mount.h" 44#include "xfs_mount.h"
51#include "xfs_alloc_btree.h" 45#include "xfs_da_btree.h"
52#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
47#include "xfs_alloc_btree.h"
53#include "xfs_ialloc_btree.h" 48#include "xfs_ialloc_btree.h"
54#include "xfs_alloc.h" 49#include "xfs_alloc.h"
55#include "xfs_btree.h" 50#include "xfs_btree.h"
56#include "xfs_attr_sf.h"
57#include "xfs_dir_sf.h" 51#include "xfs_dir_sf.h"
58#include "xfs_dir2_sf.h" 52#include "xfs_dir2_sf.h"
53#include "xfs_attr_sf.h"
59#include "xfs_dinode.h" 54#include "xfs_dinode.h"
60#include "xfs_inode_item.h"
61#include "xfs_inode.h" 55#include "xfs_inode.h"
56#include "xfs_inode_item.h"
62#include "xfs_bmap.h" 57#include "xfs_bmap.h"
63#include "xfs_da_btree.h"
64#include "xfs_attr.h" 58#include "xfs_attr.h"
65#include "xfs_attr_leaf.h" 59#include "xfs_attr_leaf.h"
66#include "xfs_error.h" 60#include "xfs_error.h"
67#include "xfs_bit.h"
68 61
69/* 62/*
70 * xfs_attr_leaf.c 63 * xfs_attr_leaf.c
diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h
index 326802f80d54..ef5f5eaa60d0 100644
--- a/fs/xfs/xfs_attr_leaf.h
+++ b/fs/xfs/xfs_attr_leaf.h
@@ -147,65 +147,58 @@ typedef struct xfs_attr_leaf_name_remote xfs_attr_leaf_name_remote_t;
147/* 147/*
148 * Cast typed pointers for "local" and "remote" name/value structs. 148 * Cast typed pointers for "local" and "remote" name/value structs.
149 */ 149 */
150#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME_REMOTE)
151xfs_attr_leaf_name_remote_t *
152xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx);
153#define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \ 150#define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \
154 xfs_attr_leaf_name_remote(leafp,idx) 151 xfs_attr_leaf_name_remote(leafp,idx)
155#else 152static inline xfs_attr_leaf_name_remote_t *
156#define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) /* remote name struct ptr */ \ 153xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx)
157 ((xfs_attr_leaf_name_remote_t *) \ 154{
158 &((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) 155 return (xfs_attr_leaf_name_remote_t *) &((char *)
159#endif 156 (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)];
160#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME_LOCAL) 157}
161xfs_attr_leaf_name_local_t * 158
162xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx);
163#define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \ 159#define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \
164 xfs_attr_leaf_name_local(leafp,idx) 160 xfs_attr_leaf_name_local(leafp,idx)
165#else 161static inline xfs_attr_leaf_name_local_t *
166#define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) /* local name struct ptr */ \ 162xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
167 ((xfs_attr_leaf_name_local_t *) \ 163{
168 &((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) 164 return (xfs_attr_leaf_name_local_t *) &((char *)
169#endif 165 (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)];
170#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME) 166}
171char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx); 167
172#define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx) 168#define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx)
173#else 169static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)
174#define XFS_ATTR_LEAF_NAME(leafp,idx) /* generic name struct ptr */ \ 170{
175 (&((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) 171 return (&((char *)
176#endif 172 (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)]);
173}
177 174
178/* 175/*
179 * Calculate total bytes used (including trailing pad for alignment) for 176 * Calculate total bytes used (including trailing pad for alignment) for
180 * a "local" name/value structure, a "remote" name/value structure, and 177 * a "local" name/value structure, a "remote" name/value structure, and
181 * a pointer which might be either. 178 * a pointer which might be either.
182 */ 179 */
183#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_REMOTE)
184int xfs_attr_leaf_entsize_remote(int nlen);
185#define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \ 180#define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \
186 xfs_attr_leaf_entsize_remote(nlen) 181 xfs_attr_leaf_entsize_remote(nlen)
187#else 182static inline int xfs_attr_leaf_entsize_remote(int nlen)
188#define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) /* space for remote struct */ \ 183{
189 (((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ 184 return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \
190 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1)) 185 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
191#endif 186}
192#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_LOCAL) 187
193int xfs_attr_leaf_entsize_local(int nlen, int vlen);
194#define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \ 188#define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \
195 xfs_attr_leaf_entsize_local(nlen,vlen) 189 xfs_attr_leaf_entsize_local(nlen,vlen)
196#else 190static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen)
197#define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) /* space for local struct */ \ 191{
198 (((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + \ 192 return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) +
199 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1)) 193 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
200#endif 194}
201#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX) 195
202int xfs_attr_leaf_entsize_local_max(int bsize);
203#define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \ 196#define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \
204 xfs_attr_leaf_entsize_local_max(bsize) 197 xfs_attr_leaf_entsize_local_max(bsize)
205#else 198static inline int xfs_attr_leaf_entsize_local_max(int bsize)
206#define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) /* max local struct size */ \ 199{
207 (((bsize) >> 1) + ((bsize) >> 2)) 200 return (((bsize) >> 1) + ((bsize) >> 2));
208#endif 201}
209 202
210 203
211/*======================================================================== 204/*========================================================================
diff --git a/fs/xfs/xfs_attr_sf.h b/fs/xfs/xfs_attr_sf.h
index ef7d2942d306..c8001929deab 100644
--- a/fs/xfs/xfs_attr_sf.h
+++ b/fs/xfs/xfs_attr_sf.h
@@ -71,38 +71,17 @@ typedef struct xfs_attr_sf_sort {
71 char *name; /* name value, pointer into buffer */ 71 char *name; /* name value, pointer into buffer */
72} xfs_attr_sf_sort_t; 72} xfs_attr_sf_sort_t;
73 73
74#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_SF_ENTSIZE_BYNAME)
75int xfs_attr_sf_entsize_byname(int nlen, int vlen);
76#define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) \
77 xfs_attr_sf_entsize_byname(nlen,vlen)
78#else
79#define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) /* space name/value uses */ \ 74#define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) /* space name/value uses */ \
80 ((int)sizeof(xfs_attr_sf_entry_t)-1 + (nlen)+(vlen)) 75 (((int)sizeof(xfs_attr_sf_entry_t)-1 + (nlen)+(vlen)))
81#endif
82#define XFS_ATTR_SF_ENTSIZE_MAX /* max space for name&value */ \ 76#define XFS_ATTR_SF_ENTSIZE_MAX /* max space for name&value */ \
83 ((1 << (NBBY*(int)sizeof(__uint8_t))) - 1) 77 ((1 << (NBBY*(int)sizeof(__uint8_t))) - 1)
84#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_SF_ENTSIZE)
85int xfs_attr_sf_entsize(xfs_attr_sf_entry_t *sfep);
86#define XFS_ATTR_SF_ENTSIZE(sfep) xfs_attr_sf_entsize(sfep)
87#else
88#define XFS_ATTR_SF_ENTSIZE(sfep) /* space an entry uses */ \ 78#define XFS_ATTR_SF_ENTSIZE(sfep) /* space an entry uses */ \
89 ((int)sizeof(xfs_attr_sf_entry_t)-1 + (sfep)->namelen+(sfep)->valuelen) 79 ((int)sizeof(xfs_attr_sf_entry_t)-1 + (sfep)->namelen+(sfep)->valuelen)
90#endif
91#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_SF_NEXTENTRY)
92xfs_attr_sf_entry_t *xfs_attr_sf_nextentry(xfs_attr_sf_entry_t *sfep);
93#define XFS_ATTR_SF_NEXTENTRY(sfep) xfs_attr_sf_nextentry(sfep)
94#else
95#define XFS_ATTR_SF_NEXTENTRY(sfep) /* next entry in struct */ \ 80#define XFS_ATTR_SF_NEXTENTRY(sfep) /* next entry in struct */ \
96 ((xfs_attr_sf_entry_t *) \ 81 ((xfs_attr_sf_entry_t *)((char *)(sfep) + XFS_ATTR_SF_ENTSIZE(sfep)))
97 ((char *)(sfep) + XFS_ATTR_SF_ENTSIZE(sfep)))
98#endif
99#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_SF_TOTSIZE)
100int xfs_attr_sf_totsize(struct xfs_inode *dp);
101#define XFS_ATTR_SF_TOTSIZE(dp) xfs_attr_sf_totsize(dp)
102#else
103#define XFS_ATTR_SF_TOTSIZE(dp) /* total space in use */ \ 82#define XFS_ATTR_SF_TOTSIZE(dp) /* total space in use */ \
104 (INT_GET(((xfs_attr_shortform_t *)((dp)->i_afp->if_u1.if_data))->hdr.totsize, ARCH_CONVERT)) 83 (INT_GET(((xfs_attr_shortform_t *) \
105#endif 84 ((dp)->i_afp->if_u1.if_data))->hdr.totsize, ARCH_CONVERT))
106 85
107#if defined(XFS_ATTR_TRACE) 86#if defined(XFS_ATTR_TRACE)
108/* 87/*
diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h
index 1e7f57ddf7a8..041e82485064 100644
--- a/fs/xfs/xfs_bit.h
+++ b/fs/xfs/xfs_bit.h
@@ -39,30 +39,26 @@
39/* 39/*
40 * masks with n high/low bits set, 32-bit values & 64-bit values 40 * masks with n high/low bits set, 32-bit values & 64-bit values
41 */ 41 */
42#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK32HI)
43__uint32_t xfs_mask32hi(int n);
44#define XFS_MASK32HI(n) xfs_mask32hi(n) 42#define XFS_MASK32HI(n) xfs_mask32hi(n)
45#else 43static inline __uint32_t xfs_mask32hi(int n)
46#define XFS_MASK32HI(n) ((__uint32_t)-1 << (32 - (n))) 44{
47#endif 45 return (__uint32_t)-1 << (32 - (n));
48#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK64HI) 46}
49__uint64_t xfs_mask64hi(int n);
50#define XFS_MASK64HI(n) xfs_mask64hi(n) 47#define XFS_MASK64HI(n) xfs_mask64hi(n)
51#else 48static inline __uint64_t xfs_mask64hi(int n)
52#define XFS_MASK64HI(n) ((__uint64_t)-1 << (64 - (n))) 49{
53#endif 50 return (__uint64_t)-1 << (64 - (n));
54#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK32LO) 51}
55__uint32_t xfs_mask32lo(int n);
56#define XFS_MASK32LO(n) xfs_mask32lo(n) 52#define XFS_MASK32LO(n) xfs_mask32lo(n)
57#else 53static inline __uint32_t xfs_mask32lo(int n)
58#define XFS_MASK32LO(n) (((__uint32_t)1 << (n)) - 1) 54{
59#endif 55 return ((__uint32_t)1 << (n)) - 1;
60#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK64LO) 56}
61__uint64_t xfs_mask64lo(int n);
62#define XFS_MASK64LO(n) xfs_mask64lo(n) 57#define XFS_MASK64LO(n) xfs_mask64lo(n)
63#else 58static inline __uint64_t xfs_mask64lo(int n)
64#define XFS_MASK64LO(n) (((__uint64_t)1 << (n)) - 1) 59{
65#endif 60 return ((__uint64_t)1 << (n)) - 1;
61}
66 62
67/* Get high bit set out of 32-bit argument, -1 if none set */ 63/* Get high bit set out of 32-bit argument, -1 if none set */
68extern int xfs_highbit32(__uint32_t v); 64extern int xfs_highbit32(__uint32_t v);
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 3e013530d00d..f8e3357c1e86 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -29,41 +29,39 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34 33#include "xfs_fs.h"
35#include "xfs_macros.h"
36#include "xfs_types.h" 34#include "xfs_types.h"
37#include "xfs_inum.h" 35#include "xfs_bit.h"
38#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
39#include "xfs_trans.h" 38#include "xfs_trans.h"
40#include "xfs_sb.h" 39#include "xfs_sb.h"
41#include "xfs_ag.h" 40#include "xfs_ag.h"
42#include "xfs_dir.h" 41#include "xfs_dir.h"
43#include "xfs_dir2.h" 42#include "xfs_dir2.h"
44#include "xfs_dmapi.h" 43#include "xfs_da_btree.h"
45#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 44#include "xfs_bmap_btree.h"
45#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 46#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 47#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 48#include "xfs_dir2_sf.h"
49#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 50#include "xfs_dinode.h"
55#include "xfs_inode_item.h"
56#include "xfs_inode.h" 51#include "xfs_inode.h"
52#include "xfs_btree.h"
53#include "xfs_dmapi.h"
54#include "xfs_mount.h"
55#include "xfs_ialloc.h"
57#include "xfs_itable.h" 56#include "xfs_itable.h"
57#include "xfs_inode_item.h"
58#include "xfs_extfree_item.h" 58#include "xfs_extfree_item.h"
59#include "xfs_alloc.h" 59#include "xfs_alloc.h"
60#include "xfs_bmap.h" 60#include "xfs_bmap.h"
61#include "xfs_rtalloc.h" 61#include "xfs_rtalloc.h"
62#include "xfs_error.h" 62#include "xfs_error.h"
63#include "xfs_da_btree.h"
64#include "xfs_dir_leaf.h" 63#include "xfs_dir_leaf.h"
65#include "xfs_attr_leaf.h" 64#include "xfs_attr_leaf.h"
66#include "xfs_bit.h"
67#include "xfs_rw.h" 65#include "xfs_rw.h"
68#include "xfs_quota.h" 66#include "xfs_quota.h"
69#include "xfs_trans_space.h" 67#include "xfs_trans_space.h"
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
index e42d1b7777e1..51a9c82f0f62 100644
--- a/fs/xfs/xfs_bmap.h
+++ b/fs/xfs/xfs_bmap.h
@@ -77,12 +77,11 @@ typedef struct xfs_bmap_free
77 /* combine contig. space */ 77 /* combine contig. space */
78#define XFS_BMAPI_CONTIG 0x400 /* must allocate only one extent */ 78#define XFS_BMAPI_CONTIG 0x400 /* must allocate only one extent */
79 79
80#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAPI_AFLAG)
81int xfs_bmapi_aflag(int w);
82#define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w) 80#define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w)
83#else 81static inline int xfs_bmapi_aflag(int w)
84#define XFS_BMAPI_AFLAG(w) ((w) == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0) 82{
85#endif 83 return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0);
84}
86 85
87/* 86/*
88 * Special values for xfs_bmbt_irec_t br_startblock field. 87 * Special values for xfs_bmbt_irec_t br_startblock field.
@@ -90,14 +89,12 @@ int xfs_bmapi_aflag(int w);
90#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL) 89#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
91#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL) 90#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
92 91
93#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_INIT)
94void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp);
95#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp) 92#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp)
96#else 93static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp)
97#define XFS_BMAP_INIT(flp,fbp) \ 94{
98 ((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \ 95 ((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \
99 (flp)->xbf_low = 0, *(fbp) = NULLFSBLOCK) 96 (flp)->xbf_low = 0, *(fbp) = NULLFSBLOCK);
100#endif 97}
101 98
102/* 99/*
103 * Argument structure for xfs_bmap_alloc. 100 * Argument structure for xfs_bmap_alloc.
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 09a77b17565b..cc72f77f9824 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -29,13 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34 33#include "xfs_fs.h"
35#include "xfs_macros.h"
36#include "xfs_types.h" 34#include "xfs_types.h"
37#include "xfs_inum.h" 35#include "xfs_bit.h"
38#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
39#include "xfs_trans.h" 38#include "xfs_trans.h"
40#include "xfs_sb.h" 39#include "xfs_sb.h"
41#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -43,20 +42,19 @@
43#include "xfs_dir2.h" 42#include "xfs_dir2.h"
44#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
45#include "xfs_mount.h" 44#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_itable.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 51#include "xfs_dinode.h"
56#include "xfs_inode_item.h"
57#include "xfs_inode.h" 52#include "xfs_inode.h"
53#include "xfs_inode_item.h"
58#include "xfs_alloc.h" 54#include "xfs_alloc.h"
59#include "xfs_bit.h" 55#include "xfs_btree.h"
56#include "xfs_ialloc.h"
57#include "xfs_itable.h"
60#include "xfs_bmap.h" 58#include "xfs_bmap.h"
61#include "xfs_error.h" 59#include "xfs_error.h"
62#include "xfs_quota.h" 60#include "xfs_quota.h"
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index 2cf4fe45cbcb..ff0102d14918 100644
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -114,31 +114,31 @@ typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;
114 (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) 114 (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
115#define DSTARTBLOCKMASK \ 115#define DSTARTBLOCKMASK \
116 (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) 116 (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
117#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_ISNULLSTARTBLOCK) 117
118int isnullstartblock(xfs_fsblock_t x);
119#define ISNULLSTARTBLOCK(x) isnullstartblock(x) 118#define ISNULLSTARTBLOCK(x) isnullstartblock(x)
120#else 119static inline int isnullstartblock(xfs_fsblock_t x)
121#define ISNULLSTARTBLOCK(x) (((x) & STARTBLOCKMASK) == STARTBLOCKMASK) 120{
122#endif 121 return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK;
123#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_ISNULLDSTARTBLOCK) 122}
124int isnulldstartblock(xfs_dfsbno_t x); 123
125#define ISNULLDSTARTBLOCK(x) isnulldstartblock(x) 124#define ISNULLDSTARTBLOCK(x) isnulldstartblock(x)
126#else 125static inline int isnulldstartblock(xfs_dfsbno_t x)
127#define ISNULLDSTARTBLOCK(x) (((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK) 126{
128#endif 127 return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK;
129#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_NULLSTARTBLOCK) 128}
130xfs_fsblock_t nullstartblock(int k); 129
131#define NULLSTARTBLOCK(k) nullstartblock(k) 130#define NULLSTARTBLOCK(k) nullstartblock(k)
132#else 131static inline xfs_fsblock_t nullstartblock(int k)
133#define NULLSTARTBLOCK(k) \ 132{
134 ((ASSERT(k < (1 << STARTBLOCKVALBITS))), (STARTBLOCKMASK | (k))) 133 ASSERT(k < (1 << STARTBLOCKVALBITS));
135#endif 134 return STARTBLOCKMASK | (k);
136#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_STARTBLOCKVAL) 135}
137xfs_filblks_t startblockval(xfs_fsblock_t x); 136
138#define STARTBLOCKVAL(x) startblockval(x) 137#define STARTBLOCKVAL(x) startblockval(x)
139#else 138static inline xfs_filblks_t startblockval(xfs_fsblock_t x)
140#define STARTBLOCKVAL(x) ((xfs_filblks_t)((x) & ~STARTBLOCKMASK)) 139{
141#endif 140 return (xfs_filblks_t)((x) & ~STARTBLOCKMASK);
141}
142 142
143/* 143/*
144 * Possible extent formats. 144 * Possible extent formats.
@@ -159,14 +159,9 @@ typedef enum {
159/* 159/*
160 * Extent state and extent format macros. 160 * Extent state and extent format macros.
161 */ 161 */
162#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTFMT_INODE ) 162#define XFS_EXTFMT_INODE(x) \
163xfs_exntfmt_t xfs_extfmt_inode(struct xfs_inode *ip); 163 (XFS_SB_VERSION_HASEXTFLGBIT(&((x)->i_mount->m_sb)) ? \
164#define XFS_EXTFMT_INODE(x) xfs_extfmt_inode(x) 164 XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
165#else
166#define XFS_EXTFMT_INODE(x) \
167 (XFS_SB_VERSION_HASEXTFLGBIT(&((x)->i_mount->m_sb)) ? \
168 XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
169#endif
170#define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN) 165#define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN)
171 166
172/* 167/*
@@ -192,248 +187,111 @@ typedef xfs_dfsbno_t xfs_bmbt_ptr_t, xfs_bmdr_ptr_t; /* btree pointer type */
192 /* btree block header type */ 187 /* btree block header type */
193typedef struct xfs_btree_lblock xfs_bmbt_block_t; 188typedef struct xfs_btree_lblock xfs_bmbt_block_t;
194 189
195#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_BMBT_BLOCK) 190#define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)XFS_BUF_PTR(bp))
196xfs_bmbt_block_t *xfs_buf_to_bmbt_block(struct xfs_buf *bp);
197#define XFS_BUF_TO_BMBT_BLOCK(bp) xfs_buf_to_bmbt_block(bp)
198#else
199#define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)(XFS_BUF_PTR(bp)))
200#endif
201 191
202#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_RBLOCK_DSIZE) 192#define XFS_BMAP_IBLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
203int xfs_bmap_rblock_dsize(int lev, struct xfs_btree_cur *cur); 193#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize)
204#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) xfs_bmap_rblock_dsize(lev,cur) 194#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \
205#else
206#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize)
207#endif
208#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_RBLOCK_ISIZE)
209int xfs_bmap_rblock_isize(int lev, struct xfs_btree_cur *cur);
210#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) xfs_bmap_rblock_isize(lev,cur)
211#else
212#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \
213 ((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \ 195 ((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \
214 (cur)->bc_private.b.whichfork)->if_broot_bytes) 196 (cur)->bc_private.b.whichfork)->if_broot_bytes)
215#endif
216#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_IBLOCK_SIZE)
217int xfs_bmap_iblock_size(int lev, struct xfs_btree_cur *cur);
218#define XFS_BMAP_IBLOCK_SIZE(lev,cur) xfs_bmap_iblock_size(lev,cur)
219#else
220#define XFS_BMAP_IBLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
221#endif
222 197
223#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DSIZE) 198#define XFS_BMAP_BLOCK_DSIZE(lev,cur) \
224int xfs_bmap_block_dsize(int lev, struct xfs_btree_cur *cur); 199 (((lev) == (cur)->bc_nlevels - 1 ? \
225#define XFS_BMAP_BLOCK_DSIZE(lev,cur) xfs_bmap_block_dsize(lev,cur) 200 XFS_BMAP_RBLOCK_DSIZE(lev,cur) : XFS_BMAP_IBLOCK_SIZE(lev,cur)))
226#else 201#define XFS_BMAP_BLOCK_ISIZE(lev,cur) \
227#define XFS_BMAP_BLOCK_DSIZE(lev,cur) \ 202 (((lev) == (cur)->bc_nlevels - 1 ? \
228 ((lev) == (cur)->bc_nlevels - 1 ? \ 203 XFS_BMAP_RBLOCK_ISIZE(lev,cur) : XFS_BMAP_IBLOCK_SIZE(lev,cur)))
229 XFS_BMAP_RBLOCK_DSIZE(lev,cur) : \
230 XFS_BMAP_IBLOCK_SIZE(lev,cur))
231#endif
232#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_ISIZE)
233int xfs_bmap_block_isize(int lev, struct xfs_btree_cur *cur);
234#define XFS_BMAP_BLOCK_ISIZE(lev,cur) xfs_bmap_block_isize(lev,cur)
235#else
236#define XFS_BMAP_BLOCK_ISIZE(lev,cur) \
237 ((lev) == (cur)->bc_nlevels - 1 ? \
238 XFS_BMAP_RBLOCK_ISIZE(lev,cur) : \
239 XFS_BMAP_IBLOCK_SIZE(lev,cur))
240#endif
241 204
242#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DMAXRECS)
243int xfs_bmap_block_dmaxrecs(int lev, struct xfs_btree_cur *cur);
244#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) xfs_bmap_block_dmaxrecs(lev,cur)
245#else
246#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \ 205#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \
247 ((lev) == (cur)->bc_nlevels - 1 ? \ 206 (((lev) == (cur)->bc_nlevels - 1 ? \
248 XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \ 207 XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \
249 xfs_bmdr, (lev) == 0) : \ 208 xfs_bmdr, (lev) == 0) : \
250 ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])) 209 ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])))
251#endif
252#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_IMAXRECS)
253int xfs_bmap_block_imaxrecs(int lev, struct xfs_btree_cur *cur);
254#define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) xfs_bmap_block_imaxrecs(lev,cur)
255#else
256#define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) \ 210#define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) \
257 ((lev) == (cur)->bc_nlevels - 1 ? \ 211 (((lev) == (cur)->bc_nlevels - 1 ? \
258 XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur), \ 212 XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur),\
259 xfs_bmbt, (lev) == 0) : \ 213 xfs_bmbt, (lev) == 0) : \
260 ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])) 214 ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0])))
261#endif
262 215
263#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DMINRECS)
264int xfs_bmap_block_dminrecs(int lev, struct xfs_btree_cur *cur);
265#define XFS_BMAP_BLOCK_DMINRECS(lev,cur) xfs_bmap_block_dminrecs(lev,cur)
266#else
267#define XFS_BMAP_BLOCK_DMINRECS(lev,cur) \ 216#define XFS_BMAP_BLOCK_DMINRECS(lev,cur) \
268 ((lev) == (cur)->bc_nlevels - 1 ? \ 217 (((lev) == (cur)->bc_nlevels - 1 ? \
269 XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \ 218 XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur),\
270 xfs_bmdr, (lev) == 0) : \ 219 xfs_bmdr, (lev) == 0) : \
271 ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])) 220 ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])))
272#endif
273#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_IMINRECS)
274int xfs_bmap_block_iminrecs(int lev, struct xfs_btree_cur *cur);
275#define XFS_BMAP_BLOCK_IMINRECS(lev,cur) xfs_bmap_block_iminrecs(lev,cur)
276#else
277#define XFS_BMAP_BLOCK_IMINRECS(lev,cur) \ 221#define XFS_BMAP_BLOCK_IMINRECS(lev,cur) \
278 ((lev) == (cur)->bc_nlevels - 1 ? \ 222 (((lev) == (cur)->bc_nlevels - 1 ? \
279 XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur), \ 223 XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur),\
280 xfs_bmbt, (lev) == 0) : \ 224 xfs_bmbt, (lev) == 0) : \
281 ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])) 225 ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])))
282#endif 226
283 227#define XFS_BMAP_REC_DADDR(bb,i,cur) \
284#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_REC_DADDR) 228 (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \
285xfs_bmbt_rec_t * 229 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
286xfs_bmap_rec_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); 230 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
287#define XFS_BMAP_REC_DADDR(bb,i,cur) xfs_bmap_rec_daddr(bb,i,cur) 231 INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
288#else 232#define XFS_BMAP_REC_IADDR(bb,i,cur) \
289#define XFS_BMAP_REC_DADDR(bb,i,cur) \ 233 (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE( \
290 XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \ 234 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
291 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ 235 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
292 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ 236 INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
293 INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) 237
294#endif 238#define XFS_BMAP_KEY_DADDR(bb,i,cur) \
295#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_REC_IADDR) 239 (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE( \
296xfs_bmbt_rec_t * 240 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
297xfs_bmap_rec_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); 241 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
298#define XFS_BMAP_REC_IADDR(bb,i,cur) xfs_bmap_rec_iaddr(bb,i,cur) 242 INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
299#else 243#define XFS_BMAP_KEY_IADDR(bb,i,cur) \
300#define XFS_BMAP_REC_IADDR(bb,i,cur) \ 244 (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE( \
301 XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE( \ 245 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
302 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ 246 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
303 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \ 247 INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
304 INT_GET((bb)->bb_level, ARCH_CONVERT), cur)) 248
305#endif 249#define XFS_BMAP_PTR_DADDR(bb,i,cur) \
306 250 (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE( \
307#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_KEY_DADDR) 251 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
308xfs_bmbt_key_t * 252 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
309xfs_bmap_key_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur); 253 INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
310#define XFS_BMAP_KEY_DADDR(bb,i,cur) xfs_bmap_key_daddr(bb,i,cur) 254#define XFS_BMAP_PTR_IADDR(bb,i,cur) \
311#else 255 (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE( \
312#define XFS_BMAP_KEY_DADDR(bb,i,cur) \ 256 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
313 XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE( \ 257 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
314 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \ 258 INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
315 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
316 INT_GET((bb)->bb_level, ARCH_CONVERT), cur))
317#endif
318#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_KEY_IADDR)
319xfs_bmbt_key_t *
320xfs_bmap_key_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
321#define XFS_BMAP_KEY_IADDR(bb,i,cur) xfs_bmap_key_iaddr(bb,i,cur)
322#else
323#define XFS_BMAP_KEY_IADDR(bb,i,cur) \
324 XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE( \
325 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
326 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
327 INT_GET((bb)->bb_level, ARCH_CONVERT), cur))
328#endif
329
330#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_PTR_DADDR)
331xfs_bmbt_ptr_t *
332xfs_bmap_ptr_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
333#define XFS_BMAP_PTR_DADDR(bb,i,cur) xfs_bmap_ptr_daddr(bb,i,cur)
334#else
335#define XFS_BMAP_PTR_DADDR(bb,i,cur) \
336 XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE( \
337 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
338 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
339 INT_GET((bb)->bb_level, ARCH_CONVERT), cur))
340#endif
341#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_PTR_IADDR)
342xfs_bmbt_ptr_t *
343xfs_bmap_ptr_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
344#define XFS_BMAP_PTR_IADDR(bb,i,cur) xfs_bmap_ptr_iaddr(bb,i,cur)
345#else
346#define XFS_BMAP_PTR_IADDR(bb,i,cur) \
347 XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE( \
348 INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
349 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
350 INT_GET((bb)->bb_level, ARCH_CONVERT), cur))
351#endif
352 259
353/* 260/*
354 * These are to be used when we know the size of the block and 261 * These are to be used when we know the size of the block and
355 * we don't have a cursor. 262 * we don't have a cursor.
356 */ 263 */
357#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_REC_ADDR)
358xfs_bmbt_rec_t *xfs_bmap_broot_rec_addr(xfs_bmbt_block_t *bb, int i, int sz);
359#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) xfs_bmap_broot_rec_addr(bb,i,sz)
360#else
361#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \ 264#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \
362 XFS_BTREE_REC_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)) 265 (XFS_BTREE_REC_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
363#endif
364#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_KEY_ADDR)
365xfs_bmbt_key_t *xfs_bmap_broot_key_addr(xfs_bmbt_block_t *bb, int i, int sz);
366#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) xfs_bmap_broot_key_addr(bb,i,sz)
367#else
368#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \ 266#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \
369 XFS_BTREE_KEY_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)) 267 (XFS_BTREE_KEY_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
370#endif
371#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_PTR_ADDR)
372xfs_bmbt_ptr_t *xfs_bmap_broot_ptr_addr(xfs_bmbt_block_t *bb, int i, int sz);
373#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) xfs_bmap_broot_ptr_addr(bb,i,sz)
374#else
375#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \ 268#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \
376 XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)) 269 (XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
377#endif 270
271#define XFS_BMAP_BROOT_NUMRECS(bb) INT_GET((bb)->bb_numrecs, ARCH_CONVERT)
272#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
378 273
379#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_NUMRECS)
380int xfs_bmap_broot_numrecs(xfs_bmdr_block_t *bb);
381#define XFS_BMAP_BROOT_NUMRECS(bb) xfs_bmap_broot_numrecs(bb)
382#else
383#define XFS_BMAP_BROOT_NUMRECS(bb) (INT_GET((bb)->bb_numrecs, ARCH_CONVERT))
384#endif
385#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_MAXRECS)
386int xfs_bmap_broot_maxrecs(int sz);
387#define XFS_BMAP_BROOT_MAXRECS(sz) xfs_bmap_broot_maxrecs(sz)
388#else
389#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
390#endif
391#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_SPACE_CALC)
392int xfs_bmap_broot_space_calc(int nrecs);
393#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) xfs_bmap_broot_space_calc(nrecs)
394#else
395#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \ 274#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \
396 ((int)(sizeof(xfs_bmbt_block_t) + \ 275 (int)(sizeof(xfs_bmbt_block_t) + \
397 ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))) 276 ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
398#endif 277
399#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_SPACE)
400int xfs_bmap_broot_space(xfs_bmdr_block_t *bb);
401#define XFS_BMAP_BROOT_SPACE(bb) xfs_bmap_broot_space(bb)
402#else
403#define XFS_BMAP_BROOT_SPACE(bb) \ 278#define XFS_BMAP_BROOT_SPACE(bb) \
404 XFS_BMAP_BROOT_SPACE_CALC(INT_GET((bb)->bb_numrecs, ARCH_CONVERT)) 279 (XFS_BMAP_BROOT_SPACE_CALC(INT_GET((bb)->bb_numrecs, ARCH_CONVERT)))
405#endif 280#define XFS_BMDR_SPACE_CALC(nrecs) \
406#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMDR_SPACE_CALC) 281 (int)(sizeof(xfs_bmdr_block_t) + \
407int xfs_bmdr_space_calc(int nrecs); 282 ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
408#define XFS_BMDR_SPACE_CALC(nrecs) xfs_bmdr_space_calc(nrecs)
409#else
410#define XFS_BMDR_SPACE_CALC(nrecs) \
411 ((int)(sizeof(xfs_bmdr_block_t) + \
412 ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)))))
413#endif
414 283
415/* 284/*
416 * Maximum number of bmap btree levels. 285 * Maximum number of bmap btree levels.
417 */ 286 */
418#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BM_MAXLEVELS) 287#define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[(w)])
419int xfs_bm_maxlevels(struct xfs_mount *mp, int w);
420#define XFS_BM_MAXLEVELS(mp,w) xfs_bm_maxlevels(mp,w)
421#else
422#define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[w])
423#endif
424 288
425#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_SANITY_CHECK) 289#define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
426int xfs_bmap_sanity_check(struct xfs_mount *mp, xfs_bmbt_block_t *bb,
427 int level);
428#define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
429 xfs_bmap_sanity_check(mp,bb,level)
430#else
431#define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
432 (INT_GET((bb)->bb_magic, ARCH_CONVERT) == XFS_BMAP_MAGIC && \ 290 (INT_GET((bb)->bb_magic, ARCH_CONVERT) == XFS_BMAP_MAGIC && \
433 INT_GET((bb)->bb_level, ARCH_CONVERT) == level && \ 291 INT_GET((bb)->bb_level, ARCH_CONVERT) == level && \
434 INT_GET((bb)->bb_numrecs, ARCH_CONVERT) > 0 && \ 292 INT_GET((bb)->bb_numrecs, ARCH_CONVERT) > 0 && \
435 INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= (mp)->m_bmap_dmxr[(level) != 0]) 293 INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= \
436#endif 294 (mp)->m_bmap_dmxr[(level) != 0])
437 295
438 296
439#ifdef __KERNEL__ 297#ifdef __KERNEL__
@@ -459,234 +317,84 @@ extern ktrace_t *xfs_bmbt_trace_buf;
459/* 317/*
460 * Prototypes for xfs_bmap.c to call. 318 * Prototypes for xfs_bmap.c to call.
461 */ 319 */
462 320extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int);
463void 321extern int xfs_bmbt_decrement(struct xfs_btree_cur *, int, int *);
464xfs_bmdr_to_bmbt( 322extern int xfs_bmbt_delete(struct xfs_btree_cur *, int *);
465 xfs_bmdr_block_t *, 323extern void xfs_bmbt_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
466 int, 324extern xfs_bmbt_block_t *xfs_bmbt_get_block(struct xfs_btree_cur *cur,
467 xfs_bmbt_block_t *, 325 int, struct xfs_buf **bpp);
468 int); 326extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_t *r);
469 327extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_t *r);
470int 328extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_t *r);
471xfs_bmbt_decrement( 329extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_t *r);
472 struct xfs_btree_cur *,
473 int,
474 int *);
475
476int
477xfs_bmbt_delete(
478 struct xfs_btree_cur *,
479 int *);
480
481void
482xfs_bmbt_get_all(
483 xfs_bmbt_rec_t *r,
484 xfs_bmbt_irec_t *s);
485
486xfs_bmbt_block_t *
487xfs_bmbt_get_block(
488 struct xfs_btree_cur *cur,
489 int level,
490 struct xfs_buf **bpp);
491
492xfs_filblks_t
493xfs_bmbt_get_blockcount(
494 xfs_bmbt_rec_t *r);
495
496xfs_fsblock_t
497xfs_bmbt_get_startblock(
498 xfs_bmbt_rec_t *r);
499
500xfs_fileoff_t
501xfs_bmbt_get_startoff(
502 xfs_bmbt_rec_t *r);
503
504xfs_exntst_t
505xfs_bmbt_get_state(
506 xfs_bmbt_rec_t *r);
507 330
508#ifndef XFS_NATIVE_HOST 331#ifndef XFS_NATIVE_HOST
509void 332extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
510xfs_bmbt_disk_get_all( 333extern xfs_exntst_t xfs_bmbt_disk_get_state(xfs_bmbt_rec_t *r);
511 xfs_bmbt_rec_t *r, 334extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r);
512 xfs_bmbt_irec_t *s); 335extern xfs_fsblock_t xfs_bmbt_disk_get_startblock(xfs_bmbt_rec_t *r);
513 336extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r);
514xfs_exntst_t 337#else
515xfs_bmbt_disk_get_state( 338#define xfs_bmbt_disk_get_all(r, s) xfs_bmbt_get_all(r, s)
516 xfs_bmbt_rec_t *r); 339#define xfs_bmbt_disk_get_state(r) xfs_bmbt_get_state(r)
517 340#define xfs_bmbt_disk_get_blockcount(r) xfs_bmbt_get_blockcount(r)
518xfs_filblks_t 341#define xfs_bmbt_disk_get_startblock(r) xfs_bmbt_get_blockcount(r)
519xfs_bmbt_disk_get_blockcount( 342#define xfs_bmbt_disk_get_startoff(r) xfs_bmbt_get_startoff(r)
520 xfs_bmbt_rec_t *r);
521
522xfs_fsblock_t
523xfs_bmbt_disk_get_startblock(
524 xfs_bmbt_rec_t *r);
525
526xfs_fileoff_t
527xfs_bmbt_disk_get_startoff(
528 xfs_bmbt_rec_t *r);
529
530#else
531#define xfs_bmbt_disk_get_all(r, s) \
532 xfs_bmbt_get_all(r, s)
533#define xfs_bmbt_disk_get_state(r) \
534 xfs_bmbt_get_state(r)
535#define xfs_bmbt_disk_get_blockcount(r) \
536 xfs_bmbt_get_blockcount(r)
537#define xfs_bmbt_disk_get_startblock(r) \
538 xfs_bmbt_get_blockcount(r)
539#define xfs_bmbt_disk_get_startoff(r) \
540 xfs_bmbt_get_startoff(r)
541#endif /* XFS_NATIVE_HOST */ 343#endif /* XFS_NATIVE_HOST */
542 344
543int 345extern int xfs_bmbt_increment(struct xfs_btree_cur *, int, int *);
544xfs_bmbt_increment( 346extern int xfs_bmbt_insert(struct xfs_btree_cur *, int *);
545 struct xfs_btree_cur *, 347extern void xfs_bmbt_log_block(struct xfs_btree_cur *, struct xfs_buf *, int);
546 int, 348extern void xfs_bmbt_log_recs(struct xfs_btree_cur *, struct xfs_buf *, int,
547 int *); 349 int);
548 350extern int xfs_bmbt_lookup_eq(struct xfs_btree_cur *, xfs_fileoff_t,
549int 351 xfs_fsblock_t, xfs_filblks_t, int *);
550xfs_bmbt_insert( 352extern int xfs_bmbt_lookup_ge(struct xfs_btree_cur *, xfs_fileoff_t,
551 struct xfs_btree_cur *, 353 xfs_fsblock_t, xfs_filblks_t, int *);
552 int *);
553
554void
555xfs_bmbt_log_block(
556 struct xfs_btree_cur *,
557 struct xfs_buf *,
558 int);
559
560void
561xfs_bmbt_log_recs(
562 struct xfs_btree_cur *,
563 struct xfs_buf *,
564 int,
565 int);
566
567int
568xfs_bmbt_lookup_eq(
569 struct xfs_btree_cur *,
570 xfs_fileoff_t,
571 xfs_fsblock_t,
572 xfs_filblks_t,
573 int *);
574
575int
576xfs_bmbt_lookup_ge(
577 struct xfs_btree_cur *,
578 xfs_fileoff_t,
579 xfs_fsblock_t,
580 xfs_filblks_t,
581 int *);
582 354
583/* 355/*
584 * Give the bmap btree a new root block. Copy the old broot contents 356 * Give the bmap btree a new root block. Copy the old broot contents
585 * down into a real block and make the broot point to it. 357 * down into a real block and make the broot point to it.
586 */ 358 */
587int /* error */ 359extern int xfs_bmbt_newroot(struct xfs_btree_cur *cur, int *lflags, int *stat);
588xfs_bmbt_newroot( 360
589 struct xfs_btree_cur *cur, /* btree cursor */ 361extern void xfs_bmbt_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
590 int *logflags, /* logging flags for inode */ 362extern void xfs_bmbt_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o,
591 int *stat); /* return status - 0 fail */ 363 xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
592 364extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_t *r, xfs_filblks_t v);
593void 365extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_t *r, xfs_fsblock_t v);
594xfs_bmbt_set_all( 366extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_t *r, xfs_fileoff_t v);
595 xfs_bmbt_rec_t *r, 367extern void xfs_bmbt_set_state(xfs_bmbt_rec_t *r, xfs_exntst_t v);
596 xfs_bmbt_irec_t *s);
597
598void
599xfs_bmbt_set_allf(
600 xfs_bmbt_rec_t *r,
601 xfs_fileoff_t o,
602 xfs_fsblock_t b,
603 xfs_filblks_t c,
604 xfs_exntst_t v);
605
606void
607xfs_bmbt_set_blockcount(
608 xfs_bmbt_rec_t *r,
609 xfs_filblks_t v);
610
611void
612xfs_bmbt_set_startblock(
613 xfs_bmbt_rec_t *r,
614 xfs_fsblock_t v);
615
616void
617xfs_bmbt_set_startoff(
618 xfs_bmbt_rec_t *r,
619 xfs_fileoff_t v);
620
621void
622xfs_bmbt_set_state(
623 xfs_bmbt_rec_t *r,
624 xfs_exntst_t v);
625 368
626#ifndef XFS_NATIVE_HOST 369#ifndef XFS_NATIVE_HOST
627void 370extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
628xfs_bmbt_disk_set_all( 371extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o,
629 xfs_bmbt_rec_t *r, 372 xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
630 xfs_bmbt_irec_t *s);
631
632void
633xfs_bmbt_disk_set_allf(
634 xfs_bmbt_rec_t *r,
635 xfs_fileoff_t o,
636 xfs_fsblock_t b,
637 xfs_filblks_t c,
638 xfs_exntst_t v);
639#else 373#else
640#define xfs_bmbt_disk_set_all(r, s) \ 374#define xfs_bmbt_disk_set_all(r, s) xfs_bmbt_set_all(r, s)
641 xfs_bmbt_set_all(r, s) 375#define xfs_bmbt_disk_set_allf(r, o, b, c, v) xfs_bmbt_set_allf(r, o, b, c, v)
642#define xfs_bmbt_disk_set_allf(r, o, b, c, v) \
643 xfs_bmbt_set_allf(r, o, b, c, v)
644#endif /* XFS_NATIVE_HOST */ 376#endif /* XFS_NATIVE_HOST */
645 377
646void 378extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int);
647xfs_bmbt_to_bmdr( 379extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t,
648 xfs_bmbt_block_t *, 380 xfs_fsblock_t, xfs_filblks_t, xfs_exntst_t);
649 int,
650 xfs_bmdr_block_t *,
651 int);
652
653int
654xfs_bmbt_update(
655 struct xfs_btree_cur *,
656 xfs_fileoff_t,
657 xfs_fsblock_t,
658 xfs_filblks_t,
659 xfs_exntst_t);
660 381
661#ifdef DEBUG 382#ifdef DEBUG
662/* 383/*
663 * Get the data from the pointed-to record. 384 * Get the data from the pointed-to record.
664 */ 385 */
665int 386extern int xfs_bmbt_get_rec(struct xfs_btree_cur *, xfs_fileoff_t *,
666xfs_bmbt_get_rec( 387 xfs_fsblock_t *, xfs_filblks_t *,
667 struct xfs_btree_cur *, 388 xfs_exntst_t *, int *);
668 xfs_fileoff_t *,
669 xfs_fsblock_t *,
670 xfs_filblks_t *,
671 xfs_exntst_t *,
672 int *);
673#endif 389#endif
674 390
675
676/* 391/*
677 * Search an extent list for the extent which includes block 392 * Search an extent list for the extent which includes block
678 * bno. 393 * bno.
679 */ 394 */
680xfs_bmbt_rec_t * 395xfs_bmbt_rec_t *xfs_bmap_do_search_extents(xfs_bmbt_rec_t *,
681xfs_bmap_do_search_extents( 396 xfs_extnum_t, xfs_extnum_t, xfs_fileoff_t, int *,
682 xfs_bmbt_rec_t *, 397 xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *);
683 xfs_extnum_t,
684 xfs_extnum_t,
685 xfs_fileoff_t,
686 int *,
687 xfs_extnum_t *,
688 xfs_bmbt_irec_t *,
689 xfs_bmbt_irec_t *);
690 398
691#endif /* __KERNEL__ */ 399#endif /* __KERNEL__ */
692 400
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index 0cc63d657a14..4d63f1c490fe 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -29,17 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * This file contains common code for the space manager's btree implementations.
35 */
36
37#include "xfs.h" 32#include "xfs.h"
38 33#include "xfs_fs.h"
39#include "xfs_macros.h"
40#include "xfs_types.h" 34#include "xfs_types.h"
41#include "xfs_inum.h" 35#include "xfs_bit.h"
42#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
43#include "xfs_trans.h" 38#include "xfs_trans.h"
44#include "xfs_sb.h" 39#include "xfs_sb.h"
45#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -47,17 +42,16 @@
47#include "xfs_dir2.h" 42#include "xfs_dir2.h"
48#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
49#include "xfs_mount.h" 44#include "xfs_mount.h"
50#include "xfs_alloc_btree.h"
51#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
52#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
53#include "xfs_btree.h"
54#include "xfs_ialloc.h"
55#include "xfs_attr_sf.h"
56#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
57#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
58#include "xfs_dinode.h" 51#include "xfs_dinode.h"
59#include "xfs_inode.h" 52#include "xfs_inode.h"
60#include "xfs_bit.h" 53#include "xfs_btree.h"
54#include "xfs_ialloc.h"
61#include "xfs_error.h" 55#include "xfs_error.h"
62 56
63/* 57/*
diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h
index 09b4e1532a35..30ee83712c79 100644
--- a/fs/xfs/xfs_btree.h
+++ b/fs/xfs/xfs_btree.h
@@ -113,12 +113,7 @@ typedef struct xfs_btree_block
113/* 113/*
114 * Boolean to select which form of xfs_btree_block_t.bb_u to use. 114 * Boolean to select which form of xfs_btree_block_t.bb_u to use.
115 */ 115 */
116#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BTREE_LONG_PTRS)
117int xfs_btree_long_ptrs(xfs_btnum_t btnum);
118#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP) 116#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP)
119#else
120#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP)
121#endif
122 117
123/* 118/*
124 * Magic numbers for btree blocks. 119 * Magic numbers for btree blocks.
@@ -205,24 +200,10 @@ typedef struct xfs_btree_cur
205/* 200/*
206 * Convert from buffer to btree block header. 201 * Convert from buffer to btree block header.
207 */ 202 */
208#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_BLOCK) 203#define XFS_BUF_TO_BLOCK(bp) ((xfs_btree_block_t *)XFS_BUF_PTR(bp))
209xfs_btree_block_t *xfs_buf_to_block(struct xfs_buf *bp); 204#define XFS_BUF_TO_LBLOCK(bp) ((xfs_btree_lblock_t *)XFS_BUF_PTR(bp))
210#define XFS_BUF_TO_BLOCK(bp) xfs_buf_to_block(bp) 205#define XFS_BUF_TO_SBLOCK(bp) ((xfs_btree_sblock_t *)XFS_BUF_PTR(bp))
211#else 206
212#define XFS_BUF_TO_BLOCK(bp) ((xfs_btree_block_t *)(XFS_BUF_PTR(bp)))
213#endif
214#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_LBLOCK)
215xfs_btree_lblock_t *xfs_buf_to_lblock(struct xfs_buf *bp);
216#define XFS_BUF_TO_LBLOCK(bp) xfs_buf_to_lblock(bp)
217#else
218#define XFS_BUF_TO_LBLOCK(bp) ((xfs_btree_lblock_t *)(XFS_BUF_PTR(bp)))
219#endif
220#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBLOCK)
221xfs_btree_sblock_t *xfs_buf_to_sblock(struct xfs_buf *bp);
222#define XFS_BUF_TO_SBLOCK(bp) xfs_buf_to_sblock(bp)
223#else
224#define XFS_BUF_TO_SBLOCK(bp) ((xfs_btree_sblock_t *)(XFS_BUF_PTR(bp)))
225#endif
226 207
227#ifdef __KERNEL__ 208#ifdef __KERNEL__
228 209
@@ -477,106 +458,33 @@ xfs_btree_setbuf(
477/* 458/*
478 * Min and max functions for extlen, agblock, fileoff, and filblks types. 459 * Min and max functions for extlen, agblock, fileoff, and filblks types.
479 */ 460 */
480#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTLEN_MIN)
481xfs_extlen_t xfs_extlen_min(xfs_extlen_t a, xfs_extlen_t b);
482#define XFS_EXTLEN_MIN(a,b) xfs_extlen_min(a,b)
483#else
484#define XFS_EXTLEN_MIN(a,b) \ 461#define XFS_EXTLEN_MIN(a,b) \
485 ((xfs_extlen_t)(a) < (xfs_extlen_t)(b) ? \ 462 ((xfs_extlen_t)(a) < (xfs_extlen_t)(b) ? \
486 (xfs_extlen_t)(a) : (xfs_extlen_t)(b)) 463 (xfs_extlen_t)(a) : (xfs_extlen_t)(b))
487#endif
488#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTLEN_MAX)
489xfs_extlen_t xfs_extlen_max(xfs_extlen_t a, xfs_extlen_t b);
490#define XFS_EXTLEN_MAX(a,b) xfs_extlen_max(a,b)
491#else
492#define XFS_EXTLEN_MAX(a,b) \ 464#define XFS_EXTLEN_MAX(a,b) \
493 ((xfs_extlen_t)(a) > (xfs_extlen_t)(b) ? \ 465 ((xfs_extlen_t)(a) > (xfs_extlen_t)(b) ? \
494 (xfs_extlen_t)(a) : (xfs_extlen_t)(b)) 466 (xfs_extlen_t)(a) : (xfs_extlen_t)(b))
495#endif
496
497#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGBLOCK_MIN)
498xfs_agblock_t xfs_agblock_min(xfs_agblock_t a, xfs_agblock_t b);
499#define XFS_AGBLOCK_MIN(a,b) xfs_agblock_min(a,b)
500#else
501#define XFS_AGBLOCK_MIN(a,b) \ 467#define XFS_AGBLOCK_MIN(a,b) \
502 ((xfs_agblock_t)(a) < (xfs_agblock_t)(b) ? \ 468 ((xfs_agblock_t)(a) < (xfs_agblock_t)(b) ? \
503 (xfs_agblock_t)(a) : (xfs_agblock_t)(b)) 469 (xfs_agblock_t)(a) : (xfs_agblock_t)(b))
504#endif
505#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGBLOCK_MAX)
506xfs_agblock_t xfs_agblock_max(xfs_agblock_t a, xfs_agblock_t b);
507#define XFS_AGBLOCK_MAX(a,b) xfs_agblock_max(a,b)
508#else
509#define XFS_AGBLOCK_MAX(a,b) \ 470#define XFS_AGBLOCK_MAX(a,b) \
510 ((xfs_agblock_t)(a) > (xfs_agblock_t)(b) ? \ 471 ((xfs_agblock_t)(a) > (xfs_agblock_t)(b) ? \
511 (xfs_agblock_t)(a) : (xfs_agblock_t)(b)) 472 (xfs_agblock_t)(a) : (xfs_agblock_t)(b))
512#endif
513
514#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILEOFF_MIN)
515xfs_fileoff_t xfs_fileoff_min(xfs_fileoff_t a, xfs_fileoff_t b);
516#define XFS_FILEOFF_MIN(a,b) xfs_fileoff_min(a,b)
517#else
518#define XFS_FILEOFF_MIN(a,b) \ 473#define XFS_FILEOFF_MIN(a,b) \
519 ((xfs_fileoff_t)(a) < (xfs_fileoff_t)(b) ? \ 474 ((xfs_fileoff_t)(a) < (xfs_fileoff_t)(b) ? \
520 (xfs_fileoff_t)(a) : (xfs_fileoff_t)(b)) 475 (xfs_fileoff_t)(a) : (xfs_fileoff_t)(b))
521#endif
522#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILEOFF_MAX)
523xfs_fileoff_t xfs_fileoff_max(xfs_fileoff_t a, xfs_fileoff_t b);
524#define XFS_FILEOFF_MAX(a,b) xfs_fileoff_max(a,b)
525#else
526#define XFS_FILEOFF_MAX(a,b) \ 476#define XFS_FILEOFF_MAX(a,b) \
527 ((xfs_fileoff_t)(a) > (xfs_fileoff_t)(b) ? \ 477 ((xfs_fileoff_t)(a) > (xfs_fileoff_t)(b) ? \
528 (xfs_fileoff_t)(a) : (xfs_fileoff_t)(b)) 478 (xfs_fileoff_t)(a) : (xfs_fileoff_t)(b))
529#endif
530
531#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILBLKS_MIN)
532xfs_filblks_t xfs_filblks_min(xfs_filblks_t a, xfs_filblks_t b);
533#define XFS_FILBLKS_MIN(a,b) xfs_filblks_min(a,b)
534#else
535#define XFS_FILBLKS_MIN(a,b) \ 479#define XFS_FILBLKS_MIN(a,b) \
536 ((xfs_filblks_t)(a) < (xfs_filblks_t)(b) ? \ 480 ((xfs_filblks_t)(a) < (xfs_filblks_t)(b) ? \
537 (xfs_filblks_t)(a) : (xfs_filblks_t)(b)) 481 (xfs_filblks_t)(a) : (xfs_filblks_t)(b))
538#endif
539#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILBLKS_MAX)
540xfs_filblks_t xfs_filblks_max(xfs_filblks_t a, xfs_filblks_t b);
541#define XFS_FILBLKS_MAX(a,b) xfs_filblks_max(a,b)
542#else
543#define XFS_FILBLKS_MAX(a,b) \ 482#define XFS_FILBLKS_MAX(a,b) \
544 ((xfs_filblks_t)(a) > (xfs_filblks_t)(b) ? \ 483 ((xfs_filblks_t)(a) > (xfs_filblks_t)(b) ? \
545 (xfs_filblks_t)(a) : (xfs_filblks_t)(b)) 484 (xfs_filblks_t)(a) : (xfs_filblks_t)(b))
546#endif 485
547#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_SANITY_CHECK)
548int xfs_fsb_sanity_check(struct xfs_mount *mp, xfs_fsblock_t fsb);
549#define XFS_FSB_SANITY_CHECK(mp,fsb) xfs_fsb_sanity_check(mp,fsb)
550#else
551#define XFS_FSB_SANITY_CHECK(mp,fsb) \ 486#define XFS_FSB_SANITY_CHECK(mp,fsb) \
552 (XFS_FSB_TO_AGNO(mp, fsb) < mp->m_sb.sb_agcount && \ 487 (XFS_FSB_TO_AGNO(mp, fsb) < mp->m_sb.sb_agcount && \
553 XFS_FSB_TO_AGBNO(mp, fsb) < mp->m_sb.sb_agblocks) 488 XFS_FSB_TO_AGBNO(mp, fsb) < mp->m_sb.sb_agblocks)
554#endif
555
556/*
557 * Macros to set EFSCORRUPTED & return/branch.
558 */
559#define XFS_WANT_CORRUPTED_GOTO(x,l) \
560 { \
561 int fs_is_ok = (x); \
562 ASSERT(fs_is_ok); \
563 if (unlikely(!fs_is_ok)) { \
564 XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_GOTO", \
565 XFS_ERRLEVEL_LOW, NULL); \
566 error = XFS_ERROR(EFSCORRUPTED); \
567 goto l; \
568 } \
569 }
570
571#define XFS_WANT_CORRUPTED_RETURN(x) \
572 { \
573 int fs_is_ok = (x); \
574 ASSERT(fs_is_ok); \
575 if (unlikely(!fs_is_ok)) { \
576 XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_RETURN", \
577 XFS_ERRLEVEL_LOW, NULL); \
578 return XFS_ERROR(EFSCORRUPTED); \
579 } \
580 }
581 489
582#endif /* __XFS_BTREE_H__ */ 490#endif /* __XFS_BTREE_H__ */
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index a264657acfd9..a37ffc38bb16 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -29,29 +29,19 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * This file contains the implementation of the xfs_buf_log_item.
35 * It contains the item operations used to manipulate the buf log
36 * items as well as utility routines used by the buffer specific
37 * transaction routines.
38 */
39
40#include "xfs.h" 32#include "xfs.h"
41 33#include "xfs_fs.h"
42#include "xfs_macros.h"
43#include "xfs_types.h" 34#include "xfs_types.h"
44#include "xfs_inum.h" 35#include "xfs_bit.h"
45#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
46#include "xfs_trans.h" 38#include "xfs_trans.h"
47#include "xfs_buf_item.h"
48#include "xfs_sb.h" 39#include "xfs_sb.h"
49#include "xfs_dir.h" 40#include "xfs_dir.h"
50#include "xfs_dmapi.h" 41#include "xfs_dmapi.h"
51#include "xfs_mount.h" 42#include "xfs_mount.h"
43#include "xfs_buf_item.h"
52#include "xfs_trans_priv.h" 44#include "xfs_trans_priv.h"
53#include "xfs_rw.h"
54#include "xfs_bit.h"
55#include "xfs_error.h" 45#include "xfs_error.h"
56 46
57 47
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 7e086c60485f..b4075ec75453 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -29,13 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34 33#include "xfs_fs.h"
35#include "xfs_macros.h"
36#include "xfs_types.h" 34#include "xfs_types.h"
37#include "xfs_inum.h" 35#include "xfs_bit.h"
38#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
39#include "xfs_trans.h" 38#include "xfs_trans.h"
40#include "xfs_sb.h" 39#include "xfs_sb.h"
41#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -43,19 +42,19 @@
43#include "xfs_dir2.h" 42#include "xfs_dir2.h"
44#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
45#include "xfs_mount.h" 44#include "xfs_mount.h"
46#include "xfs_alloc_btree.h" 45#include "xfs_da_btree.h"
47#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
47#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 48#include "xfs_ialloc_btree.h"
49#include "xfs_alloc.h"
50#include "xfs_btree.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 49#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 50#include "xfs_dir2_sf.h"
51#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 52#include "xfs_dinode.h"
55#include "xfs_inode_item.h"
56#include "xfs_inode.h" 53#include "xfs_inode.h"
54#include "xfs_inode_item.h"
55#include "xfs_alloc.h"
56#include "xfs_btree.h"
57#include "xfs_bmap.h" 57#include "xfs_bmap.h"
58#include "xfs_da_btree.h"
59#include "xfs_attr.h" 58#include "xfs_attr.h"
60#include "xfs_attr_leaf.h" 59#include "xfs_attr_leaf.h"
61#include "xfs_dir_leaf.h" 60#include "xfs_dir_leaf.h"
@@ -64,7 +63,6 @@
64#include "xfs_dir2_block.h" 63#include "xfs_dir2_block.h"
65#include "xfs_dir2_node.h" 64#include "xfs_dir2_node.h"
66#include "xfs_error.h" 65#include "xfs_error.h"
67#include "xfs_bit.h"
68 66
69/* 67/*
70 * xfs_da_btree.c 68 * xfs_da_btree.c
diff --git a/fs/xfs/xfs_da_btree.h b/fs/xfs/xfs_da_btree.h
index a2199578b4c0..654956e9787c 100644
--- a/fs/xfs/xfs_da_btree.h
+++ b/fs/xfs/xfs_da_btree.h
@@ -92,72 +92,24 @@ typedef struct xfs_da_node_entry xfs_da_node_entry_t;
92 92
93#define XFS_DA_MAXHASH ((xfs_dahash_t)-1) /* largest valid hash value */ 93#define XFS_DA_MAXHASH ((xfs_dahash_t)-1) /* largest valid hash value */
94 94
95/* 95#define XFS_LBSIZE(mp) (mp)->m_sb.sb_blocksize
96 * Macros used by directory code to interface to the filesystem. 96#define XFS_LBLOG(mp) (mp)->m_sb.sb_blocklog
97 */
98#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LBSIZE)
99int xfs_lbsize(struct xfs_mount *mp);
100#define XFS_LBSIZE(mp) xfs_lbsize(mp)
101#else
102#define XFS_LBSIZE(mp) ((mp)->m_sb.sb_blocksize)
103#endif
104#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LBLOG)
105int xfs_lblog(struct xfs_mount *mp);
106#define XFS_LBLOG(mp) xfs_lblog(mp)
107#else
108#define XFS_LBLOG(mp) ((mp)->m_sb.sb_blocklog)
109#endif
110
111/*
112 * Macros used by directory code to interface to the kernel
113 */
114 97
115/*
116 * Macros used to manipulate directory off_t's
117 */
118#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_MAKE_BNOENTRY)
119__uint32_t xfs_da_make_bnoentry(struct xfs_mount *mp, xfs_dablk_t bno,
120 int entry);
121#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \ 98#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \
122 xfs_da_make_bnoentry(mp,bno,entry)
123#else
124#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \
125 (((bno) << (mp)->m_dircook_elog) | (entry)) 99 (((bno) << (mp)->m_dircook_elog) | (entry))
126#endif
127#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_MAKE_COOKIE)
128xfs_off_t xfs_da_make_cookie(struct xfs_mount *mp, xfs_dablk_t bno, int entry,
129 xfs_dahash_t hash);
130#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \ 100#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \
131 xfs_da_make_cookie(mp,bno,entry,hash)
132#else
133#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \
134 (((xfs_off_t)XFS_DA_MAKE_BNOENTRY(mp, bno, entry) << 32) | (hash)) 101 (((xfs_off_t)XFS_DA_MAKE_BNOENTRY(mp, bno, entry) << 32) | (hash))
135#endif 102#define XFS_DA_COOKIE_HASH(mp,cookie) ((xfs_dahash_t)cookie)
136#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_HASH) 103#define XFS_DA_COOKIE_BNO(mp,cookie) \
137xfs_dahash_t xfs_da_cookie_hash(struct xfs_mount *mp, xfs_off_t cookie); 104 ((((xfs_off_t)(cookie) >> 31) == -1LL ? \
138#define XFS_DA_COOKIE_HASH(mp,cookie) xfs_da_cookie_hash(mp,cookie)
139#else
140#define XFS_DA_COOKIE_HASH(mp,cookie) ((xfs_dahash_t)(cookie))
141#endif
142#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_BNO)
143xfs_dablk_t xfs_da_cookie_bno(struct xfs_mount *mp, xfs_off_t cookie);
144#define XFS_DA_COOKIE_BNO(mp,cookie) xfs_da_cookie_bno(mp,cookie)
145#else
146#define XFS_DA_COOKIE_BNO(mp,cookie) \
147 (((xfs_off_t)(cookie) >> 31) == -1LL ? \
148 (xfs_dablk_t)0 : \ 105 (xfs_dablk_t)0 : \
149 (xfs_dablk_t)((xfs_off_t)(cookie) >> ((mp)->m_dircook_elog + 32))) 106 (xfs_dablk_t)((xfs_off_t)(cookie) >> \
150#endif 107 ((mp)->m_dircook_elog + 32))))
151#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_ENTRY) 108#define XFS_DA_COOKIE_ENTRY(mp,cookie) \
152int xfs_da_cookie_entry(struct xfs_mount *mp, xfs_off_t cookie); 109 ((((xfs_off_t)(cookie) >> 31) == -1LL ? \
153#define XFS_DA_COOKIE_ENTRY(mp,cookie) xfs_da_cookie_entry(mp,cookie)
154#else
155#define XFS_DA_COOKIE_ENTRY(mp,cookie) \
156 (((xfs_off_t)(cookie) >> 31) == -1LL ? \
157 (xfs_dablk_t)0 : \ 110 (xfs_dablk_t)0 : \
158 (xfs_dablk_t)(((xfs_off_t)(cookie) >> 32) & \ 111 (xfs_dablk_t)(((xfs_off_t)(cookie) >> 32) & \
159 ((1 << (mp)->m_dircook_elog) - 1))) 112 ((1 << (mp)->m_dircook_elog) - 1))))
160#endif
161 113
162 114
163/*======================================================================== 115/*========================================================================
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 8dd7a3923f64..925b0a22c664 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -29,30 +29,30 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h"
40#include "xfs_dir.h" 41#include "xfs_dir.h"
41#include "xfs_dir2.h" 42#include "xfs_dir2.h"
42#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
43#include "xfs_mount.h" 44#include "xfs_mount.h"
44#include "xfs_ag.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
48#include "xfs_btree.h"
49#include "xfs_attr_sf.h"
50#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
51#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
52#include "xfs_dinode.h" 51#include "xfs_dinode.h"
53#include "xfs_inode_item.h"
54#include "xfs_inode.h" 52#include "xfs_inode.h"
53#include "xfs_inode_item.h"
55#include "xfs_bmap.h" 54#include "xfs_bmap.h"
55#include "xfs_btree.h"
56#include "xfs_ialloc.h" 56#include "xfs_ialloc.h"
57#include "xfs_itable.h" 57#include "xfs_itable.h"
58#include "xfs_dfrag.h" 58#include "xfs_dfrag.h"
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h
index f5c932b064e6..9e1fd2323255 100644
--- a/fs/xfs/xfs_dinode.h
+++ b/fs/xfs/xfs_dinode.h
@@ -37,13 +37,8 @@ struct xfs_mount;
37 37
38#define XFS_DINODE_VERSION_1 1 38#define XFS_DINODE_VERSION_1 1
39#define XFS_DINODE_VERSION_2 2 39#define XFS_DINODE_VERSION_2 2
40#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DINODE_GOOD_VERSION) 40#define XFS_DINODE_GOOD_VERSION(v) \
41int xfs_dinode_good_version(int v); 41 (((v) == XFS_DINODE_VERSION_1 || (v) == XFS_DINODE_VERSION_2))
42#define XFS_DINODE_GOOD_VERSION(v) xfs_dinode_good_version(v)
43#else
44#define XFS_DINODE_GOOD_VERSION(v) (((v) == XFS_DINODE_VERSION_1) || \
45 ((v) == XFS_DINODE_VERSION_2))
46#endif
47#define XFS_DINODE_MAGIC 0x494e /* 'IN' */ 42#define XFS_DINODE_MAGIC 0x494e /* 'IN' */
48 43
49/* 44/*
@@ -184,75 +179,30 @@ typedef enum xfs_dinode_fmt
184/* 179/*
185 * Inode size for given fs. 180 * Inode size for given fs.
186 */ 181 */
187#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LITINO)
188int xfs_litino(struct xfs_mount *mp);
189#define XFS_LITINO(mp) xfs_litino(mp)
190#else
191#define XFS_LITINO(mp) ((mp)->m_litino) 182#define XFS_LITINO(mp) ((mp)->m_litino)
192#endif
193#define XFS_BROOT_SIZE_ADJ \ 183#define XFS_BROOT_SIZE_ADJ \
194 (sizeof(xfs_bmbt_block_t) - sizeof(xfs_bmdr_block_t)) 184 (sizeof(xfs_bmbt_block_t) - sizeof(xfs_bmdr_block_t))
195 185
196/* 186/*
197 * Fork identifiers. Here so utilities can use them without including
198 * xfs_inode.h.
199 */
200#define XFS_DATA_FORK 0
201#define XFS_ATTR_FORK 1
202
203/*
204 * Inode data & attribute fork sizes, per inode. 187 * Inode data & attribute fork sizes, per inode.
205 */ 188 */
206#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_Q)
207int xfs_cfork_q_disk(xfs_dinode_core_t *dcp);
208int xfs_cfork_q(xfs_dinode_core_t *dcp);
209#define XFS_CFORK_Q_DISK(dcp) xfs_cfork_q_disk(dcp)
210#define XFS_CFORK_Q(dcp) xfs_cfork_q(dcp)
211#else
212#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0)
213#define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0) 189#define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0)
190#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0)
214 191
215#endif
216#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_BOFF)
217int xfs_cfork_boff_disk(xfs_dinode_core_t *dcp);
218int xfs_cfork_boff(xfs_dinode_core_t *dcp);
219#define XFS_CFORK_BOFF_DISK(dcp) xfs_cfork_boff_disk(dcp)
220#define XFS_CFORK_BOFF(dcp) xfs_cfork_boff(dcp)
221#else
222#define XFS_CFORK_BOFF_DISK(dcp) ((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3))
223#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3)) 192#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3))
193#define XFS_CFORK_BOFF_DISK(dcp) \
194 ((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3))
224 195
225#endif
226#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_DSIZE)
227int xfs_cfork_dsize_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
228int xfs_cfork_dsize(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
229#define XFS_CFORK_DSIZE_DISK(dcp,mp) xfs_cfork_dsize_disk(dcp,mp)
230#define XFS_CFORK_DSIZE(dcp,mp) xfs_cfork_dsize(dcp,mp)
231#else
232#define XFS_CFORK_DSIZE_DISK(dcp,mp) \ 196#define XFS_CFORK_DSIZE_DISK(dcp,mp) \
233 (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp)) 197 (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp))
234#define XFS_CFORK_DSIZE(dcp,mp) \ 198#define XFS_CFORK_DSIZE(dcp,mp) \
235 (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp)) 199 (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp))
236 200
237#endif
238#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_ASIZE)
239int xfs_cfork_asize_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
240int xfs_cfork_asize(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
241#define XFS_CFORK_ASIZE_DISK(dcp,mp) xfs_cfork_asize_disk(dcp,mp)
242#define XFS_CFORK_ASIZE(dcp,mp) xfs_cfork_asize(dcp,mp)
243#else
244#define XFS_CFORK_ASIZE_DISK(dcp,mp) \ 201#define XFS_CFORK_ASIZE_DISK(dcp,mp) \
245 (XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0) 202 (XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0)
246#define XFS_CFORK_ASIZE(dcp,mp) \ 203#define XFS_CFORK_ASIZE(dcp,mp) \
247 (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0) 204 (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0)
248 205
249#endif
250#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_SIZE)
251int xfs_cfork_size_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
252int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
253#define XFS_CFORK_SIZE_DISK(dcp,mp,w) xfs_cfork_size_disk(dcp,mp,w)
254#define XFS_CFORK_SIZE(dcp,mp,w) xfs_cfork_size(dcp,mp,w)
255#else
256#define XFS_CFORK_SIZE_DISK(dcp,mp,w) \ 206#define XFS_CFORK_SIZE_DISK(dcp,mp,w) \
257 ((w) == XFS_DATA_FORK ? \ 207 ((w) == XFS_DATA_FORK ? \
258 XFS_CFORK_DSIZE_DISK(dcp, mp) : \ 208 XFS_CFORK_DSIZE_DISK(dcp, mp) : \
@@ -261,93 +211,26 @@ int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
261 ((w) == XFS_DATA_FORK ? \ 211 ((w) == XFS_DATA_FORK ? \
262 XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp)) 212 XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp))
263 213
264#endif 214#define XFS_DFORK_DSIZE(dip,mp) \
265 215 XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp)
266#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DSIZE) 216#define XFS_DFORK_ASIZE(dip,mp) \
267int xfs_dfork_dsize(xfs_dinode_t *dip, struct xfs_mount *mp); 217 XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp)
268#define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp) 218#define XFS_DFORK_SIZE(dip,mp,w) \
269#else 219 XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w)
270#define XFS_DFORK_DSIZE(dip,mp) XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp)
271
272#endif
273#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_ASIZE)
274int xfs_dfork_asize(xfs_dinode_t *dip, struct xfs_mount *mp);
275#define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp)
276#else
277#define XFS_DFORK_ASIZE(dip,mp) XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp)
278
279#endif
280#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_SIZE)
281int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w);
282#define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w)
283#else
284#define XFS_DFORK_SIZE(dip,mp,w) XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w)
285
286#endif
287 220
288/*
289 * Macros for accessing per-fork disk inode information.
290 */
291#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_Q)
292int xfs_dfork_q(xfs_dinode_t *dip);
293#define XFS_DFORK_Q(dip) xfs_dfork_q(dip)
294#else
295#define XFS_DFORK_Q(dip) XFS_CFORK_Q_DISK(&(dip)->di_core) 221#define XFS_DFORK_Q(dip) XFS_CFORK_Q_DISK(&(dip)->di_core)
296
297#endif
298#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_BOFF)
299int xfs_dfork_boff(xfs_dinode_t *dip);
300#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip)
301#else
302#define XFS_DFORK_BOFF(dip) XFS_CFORK_BOFF_DISK(&(dip)->di_core) 222#define XFS_DFORK_BOFF(dip) XFS_CFORK_BOFF_DISK(&(dip)->di_core)
303
304#endif
305#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DPTR)
306char *xfs_dfork_dptr(xfs_dinode_t *dip);
307#define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip)
308#else
309#define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c) 223#define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c)
310 224#define XFS_DFORK_APTR(dip) \
311#endif 225 ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip))
312#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_APTR)
313char *xfs_dfork_aptr(xfs_dinode_t *dip);
314#define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip)
315#else
316#define XFS_DFORK_APTR(dip) ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip))
317
318#endif
319#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_PTR)
320char *xfs_dfork_ptr(xfs_dinode_t *dip, int w);
321#define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w)
322#else
323#define XFS_DFORK_PTR(dip,w) \ 226#define XFS_DFORK_PTR(dip,w) \
324 ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) 227 ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip))
325 228#define XFS_CFORK_FORMAT(dcp,w) \
326#endif
327#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FORMAT)
328int xfs_cfork_format(xfs_dinode_core_t *dcp, int w);
329#define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w)
330#else
331#define XFS_CFORK_FORMAT(dcp,w) \
332 ((w) == XFS_DATA_FORK ? (dcp)->di_format : (dcp)->di_aformat) 229 ((w) == XFS_DATA_FORK ? (dcp)->di_format : (dcp)->di_aformat)
333
334#endif
335#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FMT_SET)
336void xfs_cfork_fmt_set(xfs_dinode_core_t *dcp, int w, int n);
337#define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n)
338#else
339#define XFS_CFORK_FMT_SET(dcp,w,n) \ 230#define XFS_CFORK_FMT_SET(dcp,w,n) \
340 ((w) == XFS_DATA_FORK ? \ 231 ((w) == XFS_DATA_FORK ? \
341 ((dcp)->di_format = (n)) : \ 232 ((dcp)->di_format = (n)) : ((dcp)->di_aformat = (n)))
342 ((dcp)->di_aformat = (n)))
343 233
344#endif
345#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXTENTS)
346int xfs_cfork_nextents_disk(xfs_dinode_core_t *dcp, int w);
347int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w);
348#define XFS_CFORK_NEXTENTS_DISK(dcp,w) xfs_cfork_nextents_disk(dcp,w)
349#define XFS_CFORK_NEXTENTS(dcp,w) xfs_cfork_nextents(dcp,w)
350#else
351#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \ 234#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \
352 ((w) == XFS_DATA_FORK ? \ 235 ((w) == XFS_DATA_FORK ? \
353 INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \ 236 INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \
@@ -355,31 +238,13 @@ int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w);
355#define XFS_CFORK_NEXTENTS(dcp,w) \ 238#define XFS_CFORK_NEXTENTS(dcp,w) \
356 ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents) 239 ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents)
357 240
358#endif
359#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXT_SET)
360void xfs_cfork_next_set(xfs_dinode_core_t *dcp, int w, int n);
361#define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n)
362#else
363#define XFS_CFORK_NEXT_SET(dcp,w,n) \ 241#define XFS_CFORK_NEXT_SET(dcp,w,n) \
364 ((w) == XFS_DATA_FORK ? \ 242 ((w) == XFS_DATA_FORK ? \
365 ((dcp)->di_nextents = (n)) : \ 243 ((dcp)->di_nextents = (n)) : ((dcp)->di_anextents = (n)))
366 ((dcp)->di_anextents = (n)))
367
368#endif
369 244
370#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXTENTS)
371int xfs_dfork_nextents(xfs_dinode_t *dip, int w);
372#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w)
373#else
374#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w) 245#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w)
375#endif
376 246
377#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE) 247#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp))
378xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp);
379#define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp)
380#else
381#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)(XFS_BUF_PTR(bp)))
382#endif
383 248
384/* 249/*
385 * Values for di_flags 250 * Values for di_flags
diff --git a/fs/xfs/xfs_dir.c b/fs/xfs/xfs_dir.c
index 53787f35338b..d32824e8d86c 100644
--- a/fs/xfs/xfs_dir.c
+++ b/fs/xfs/xfs_dir.c
@@ -29,31 +29,29 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34 33#include "xfs_fs.h"
35#include "xfs_macros.h"
36#include "xfs_types.h" 34#include "xfs_types.h"
37#include "xfs_inum.h"
38#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
39#include "xfs_trans.h" 37#include "xfs_trans.h"
40#include "xfs_sb.h" 38#include "xfs_sb.h"
41#include "xfs_dir.h" 39#include "xfs_dir.h"
42#include "xfs_dir2.h" 40#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 41#include "xfs_dmapi.h"
44#include "xfs_mount.h" 42#include "xfs_mount.h"
45#include "xfs_alloc_btree.h" 43#include "xfs_da_btree.h"
46#include "xfs_bmap_btree.h" 44#include "xfs_bmap_btree.h"
45#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 46#include "xfs_ialloc_btree.h"
48#include "xfs_alloc.h" 47#include "xfs_alloc.h"
49#include "xfs_btree.h" 48#include "xfs_btree.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dir_sf.h" 49#include "xfs_dir_sf.h"
52#include "xfs_dir2_sf.h" 50#include "xfs_dir2_sf.h"
51#include "xfs_attr_sf.h"
53#include "xfs_dinode.h" 52#include "xfs_dinode.h"
54#include "xfs_inode.h" 53#include "xfs_inode.h"
55#include "xfs_bmap.h" 54#include "xfs_bmap.h"
56#include "xfs_da_btree.h"
57#include "xfs_dir_leaf.h" 55#include "xfs_dir_leaf.h"
58#include "xfs_error.h" 56#include "xfs_error.h"
59 57
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
index 49fc0a3695ae..40a741c7e5c4 100644
--- a/fs/xfs/xfs_dir2.c
+++ b/fs/xfs/xfs_dir2.c
@@ -29,18 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * XFS v2 directory implmentation.
35 * Top-level and utility routines.
36 */
37
38#include "xfs.h" 32#include "xfs.h"
39 33#include "xfs_fs.h"
40#include "xfs_macros.h"
41#include "xfs_types.h" 34#include "xfs_types.h"
42#include "xfs_inum.h" 35#include "xfs_bit.h"
43#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
44#include "xfs_trans.h" 38#include "xfs_trans.h"
45#include "xfs_sb.h" 39#include "xfs_sb.h"
46#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -48,16 +42,16 @@
48#include "xfs_dir2.h" 42#include "xfs_dir2.h"
49#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
50#include "xfs_mount.h" 44#include "xfs_mount.h"
51#include "xfs_alloc_btree.h" 45#include "xfs_da_btree.h"
52#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
53#include "xfs_attr_sf.h" 47#include "xfs_alloc_btree.h"
54#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
55#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
56#include "xfs_dinode.h" 51#include "xfs_dinode.h"
57#include "xfs_inode_item.h"
58#include "xfs_inode.h" 52#include "xfs_inode.h"
53#include "xfs_inode_item.h"
59#include "xfs_bmap.h" 54#include "xfs_bmap.h"
60#include "xfs_da_btree.h"
61#include "xfs_dir_leaf.h" 55#include "xfs_dir_leaf.h"
62#include "xfs_dir2_data.h" 56#include "xfs_dir2_data.h"
63#include "xfs_dir2_leaf.h" 57#include "xfs_dir2_leaf.h"
@@ -65,7 +59,6 @@
65#include "xfs_dir2_node.h" 59#include "xfs_dir2_node.h"
66#include "xfs_dir2_trace.h" 60#include "xfs_dir2_trace.h"
67#include "xfs_error.h" 61#include "xfs_error.h"
68#include "xfs_bit.h"
69 62
70/* 63/*
71 * Declarations for interface routines. 64 * Declarations for interface routines.
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index 088d3bdfac98..47b5d2c4b933 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -29,33 +29,25 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * xfs_dir2_block.c
35 * XFS V2 directory implementation, single-block form.
36 * See xfs_dir2_block.h for the format.
37 */
38
39#include "xfs.h" 32#include "xfs.h"
40 33#include "xfs_fs.h"
41#include "xfs_macros.h"
42#include "xfs_types.h" 34#include "xfs_types.h"
43#include "xfs_inum.h"
44#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
45#include "xfs_trans.h" 37#include "xfs_trans.h"
46#include "xfs_sb.h" 38#include "xfs_sb.h"
47#include "xfs_dir.h" 39#include "xfs_dir.h"
48#include "xfs_dir2.h" 40#include "xfs_dir2.h"
49#include "xfs_dmapi.h" 41#include "xfs_dmapi.h"
50#include "xfs_mount.h" 42#include "xfs_mount.h"
43#include "xfs_da_btree.h"
51#include "xfs_bmap_btree.h" 44#include "xfs_bmap_btree.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 45#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 46#include "xfs_dir2_sf.h"
47#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 48#include "xfs_dinode.h"
56#include "xfs_inode_item.h"
57#include "xfs_inode.h" 49#include "xfs_inode.h"
58#include "xfs_da_btree.h" 50#include "xfs_inode_item.h"
59#include "xfs_dir_leaf.h" 51#include "xfs_dir_leaf.h"
60#include "xfs_dir2_data.h" 52#include "xfs_dir2_data.h"
61#include "xfs_dir2_leaf.h" 53#include "xfs_dir2_leaf.h"
diff --git a/fs/xfs/xfs_dir2_block.h b/fs/xfs/xfs_dir2_block.h
index 5a578b84e246..70dcbe8976f7 100644
--- a/fs/xfs/xfs_dir2_block.h
+++ b/fs/xfs/xfs_dir2_block.h
@@ -74,53 +74,37 @@ typedef struct xfs_dir2_block {
74/* 74/*
75 * Pointer to the leaf header embedded in a data block (1-block format) 75 * Pointer to the leaf header embedded in a data block (1-block format)
76 */ 76 */
77#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BLOCK_TAIL_P)
78xfs_dir2_block_tail_t *
79xfs_dir2_block_tail_p(struct xfs_mount *mp, xfs_dir2_block_t *block);
80#define XFS_DIR2_BLOCK_TAIL_P(mp,block) xfs_dir2_block_tail_p(mp,block) 77#define XFS_DIR2_BLOCK_TAIL_P(mp,block) xfs_dir2_block_tail_p(mp,block)
81#else 78static inline xfs_dir2_block_tail_t *
82#define XFS_DIR2_BLOCK_TAIL_P(mp,block) \ 79xfs_dir2_block_tail_p(struct xfs_mount *mp, xfs_dir2_block_t *block)
83 (((xfs_dir2_block_tail_t *)((char *)(block) + (mp)->m_dirblksize)) - 1) 80{
84#endif 81 return (((xfs_dir2_block_tail_t *)
82 ((char *)(block) + (mp)->m_dirblksize)) - 1);
83}
85 84
86/* 85/*
87 * Pointer to the leaf entries embedded in a data block (1-block format) 86 * Pointer to the leaf entries embedded in a data block (1-block format)
88 */ 87 */
89#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BLOCK_LEAF_P) 88#define XFS_DIR2_BLOCK_LEAF_P(btp) xfs_dir2_block_leaf_p(btp)
90struct xfs_dir2_leaf_entry *xfs_dir2_block_leaf_p(xfs_dir2_block_tail_t *btp); 89static inline struct xfs_dir2_leaf_entry *
91#define XFS_DIR2_BLOCK_LEAF_P(btp) \ 90xfs_dir2_block_leaf_p(xfs_dir2_block_tail_t *btp)
92 xfs_dir2_block_leaf_p(btp) 91{
93#else 92 return (((struct xfs_dir2_leaf_entry *)
94#define XFS_DIR2_BLOCK_LEAF_P(btp) \ 93 (btp)) - INT_GET((btp)->count, ARCH_CONVERT));
95 (((struct xfs_dir2_leaf_entry *)(btp)) - INT_GET((btp)->count, ARCH_CONVERT)) 94}
96#endif
97 95
98/* 96/*
99 * Function declarations. 97 * Function declarations.
100 */ 98 */
101 99extern int xfs_dir2_block_addname(struct xfs_da_args *args);
102extern int 100extern int xfs_dir2_block_getdents(struct xfs_trans *tp, struct xfs_inode *dp,
103 xfs_dir2_block_addname(struct xfs_da_args *args); 101 struct uio *uio, int *eofp,
104 102 struct xfs_dirent *dbp, xfs_dir2_put_t put);
105extern int 103extern int xfs_dir2_block_lookup(struct xfs_da_args *args);
106 xfs_dir2_block_getdents(struct xfs_trans *tp, struct xfs_inode *dp, 104extern int xfs_dir2_block_removename(struct xfs_da_args *args);
107 struct uio *uio, int *eofp, struct xfs_dirent *dbp, 105extern int xfs_dir2_block_replace(struct xfs_da_args *args);
108 xfs_dir2_put_t put); 106extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,
109 107 struct xfs_dabuf *lbp, struct xfs_dabuf *dbp);
110extern int 108extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
111 xfs_dir2_block_lookup(struct xfs_da_args *args);
112
113extern int
114 xfs_dir2_block_removename(struct xfs_da_args *args);
115
116extern int
117 xfs_dir2_block_replace(struct xfs_da_args *args);
118
119extern int
120 xfs_dir2_leaf_to_block(struct xfs_da_args *args, struct xfs_dabuf *lbp,
121 struct xfs_dabuf *dbp);
122
123extern int
124 xfs_dir2_sf_to_block(struct xfs_da_args *args);
125 109
126#endif /* __XFS_DIR2_BLOCK_H__ */ 110#endif /* __XFS_DIR2_BLOCK_H__ */
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index a0aa0e44ff9d..4b25f7e7c810 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -29,32 +29,24 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * xfs_dir2_data.c
35 * Core data block handling routines for XFS V2 directories.
36 * See xfs_dir2_data.h for data structures.
37 */
38
39#include "xfs.h" 32#include "xfs.h"
40 33#include "xfs_fs.h"
41#include "xfs_macros.h"
42#include "xfs_types.h" 34#include "xfs_types.h"
43#include "xfs_inum.h"
44#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
45#include "xfs_trans.h" 37#include "xfs_trans.h"
46#include "xfs_sb.h" 38#include "xfs_sb.h"
47#include "xfs_dir.h" 39#include "xfs_dir.h"
48#include "xfs_dir2.h" 40#include "xfs_dir2.h"
49#include "xfs_dmapi.h" 41#include "xfs_dmapi.h"
50#include "xfs_mount.h" 42#include "xfs_mount.h"
43#include "xfs_da_btree.h"
51#include "xfs_bmap_btree.h" 44#include "xfs_bmap_btree.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 45#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 46#include "xfs_dir2_sf.h"
47#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 48#include "xfs_dinode.h"
56#include "xfs_inode.h" 49#include "xfs_inode.h"
57#include "xfs_da_btree.h"
58#include "xfs_dir_leaf.h" 50#include "xfs_dir_leaf.h"
59#include "xfs_dir2_data.h" 51#include "xfs_dir2_data.h"
60#include "xfs_dir2_leaf.h" 52#include "xfs_dir2_leaf.h"
diff --git a/fs/xfs/xfs_dir2_data.h b/fs/xfs/xfs_dir2_data.h
index 476cac920bf5..eeff85570723 100644
--- a/fs/xfs/xfs_dir2_data.h
+++ b/fs/xfs/xfs_dir2_data.h
@@ -137,88 +137,65 @@ typedef struct xfs_dir2_data {
137/* 137/*
138 * Size of a data entry. 138 * Size of a data entry.
139 */ 139 */
140#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_ENTSIZE)
141int xfs_dir2_data_entsize(int n);
142#define XFS_DIR2_DATA_ENTSIZE(n) xfs_dir2_data_entsize(n) 140#define XFS_DIR2_DATA_ENTSIZE(n) xfs_dir2_data_entsize(n)
143#else 141static inline int xfs_dir2_data_entsize(int n)
144#define XFS_DIR2_DATA_ENTSIZE(n) \ 142{
145 ((int)(roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \ 143 return (int)roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \
146 (uint)sizeof(xfs_dir2_data_off_t), XFS_DIR2_DATA_ALIGN))) 144 (uint)sizeof(xfs_dir2_data_off_t), XFS_DIR2_DATA_ALIGN);
147#endif 145}
148 146
149/* 147/*
150 * Pointer to an entry's tag word. 148 * Pointer to an entry's tag word.
151 */ 149 */
152#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_ENTRY_TAG_P)
153xfs_dir2_data_off_t *xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep);
154#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep) 150#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep)
155#else 151static inline xfs_dir2_data_off_t *
156#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) \ 152xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep)
157 ((xfs_dir2_data_off_t *)\ 153{
158 ((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \ 154 return (xfs_dir2_data_off_t *) \
159 (uint)sizeof(xfs_dir2_data_off_t))) 155 ((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \
160#endif 156 (uint)sizeof(xfs_dir2_data_off_t));
157}
161 158
162/* 159/*
163 * Pointer to a freespace's tag word. 160 * Pointer to a freespace's tag word.
164 */ 161 */
165#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_UNUSED_TAG_P)
166xfs_dir2_data_off_t *xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup);
167#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ 162#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \
168 xfs_dir2_data_unused_tag_p(dup) 163 xfs_dir2_data_unused_tag_p(dup)
169#else 164static inline xfs_dir2_data_off_t *
170#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ 165xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup)
171 ((xfs_dir2_data_off_t *)\ 166{
172 ((char *)(dup) + INT_GET((dup)->length, ARCH_CONVERT) \ 167 return (xfs_dir2_data_off_t *) \
173 - (uint)sizeof(xfs_dir2_data_off_t))) 168 ((char *)(dup) + INT_GET((dup)->length, ARCH_CONVERT) \
174#endif 169 - (uint)sizeof(xfs_dir2_data_off_t));
170}
175 171
176/* 172/*
177 * Function declarations. 173 * Function declarations.
178 */ 174 */
179
180#ifdef DEBUG 175#ifdef DEBUG
181extern void 176extern void xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_dabuf *bp);
182 xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_dabuf *bp);
183#else 177#else
184#define xfs_dir2_data_check(dp,bp) 178#define xfs_dir2_data_check(dp,bp)
185#endif 179#endif
186 180extern xfs_dir2_data_free_t *xfs_dir2_data_freefind(xfs_dir2_data_t *d,
187extern xfs_dir2_data_free_t * 181 xfs_dir2_data_unused_t *dup);
188 xfs_dir2_data_freefind(xfs_dir2_data_t *d, 182extern xfs_dir2_data_free_t *xfs_dir2_data_freeinsert(xfs_dir2_data_t *d,
189 xfs_dir2_data_unused_t *dup); 183 xfs_dir2_data_unused_t *dup, int *loghead);
190 184extern void xfs_dir2_data_freescan(struct xfs_mount *mp, xfs_dir2_data_t *d,
191extern xfs_dir2_data_free_t * 185 int *loghead, char *aendp);
192 xfs_dir2_data_freeinsert(xfs_dir2_data_t *d, 186extern int xfs_dir2_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno,
193 xfs_dir2_data_unused_t *dup, int *loghead); 187 struct xfs_dabuf **bpp);
194 188extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_dabuf *bp,
195extern void
196 xfs_dir2_data_freescan(struct xfs_mount *mp, xfs_dir2_data_t *d,
197 int *loghead, char *aendp);
198
199extern int
200 xfs_dir2_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno,
201 struct xfs_dabuf **bpp);
202
203extern void
204 xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_dabuf *bp,
205 xfs_dir2_data_entry_t *dep); 189 xfs_dir2_data_entry_t *dep);
206 190extern void xfs_dir2_data_log_header(struct xfs_trans *tp,
207extern void 191 struct xfs_dabuf *bp);
208 xfs_dir2_data_log_header(struct xfs_trans *tp, struct xfs_dabuf *bp); 192extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_dabuf *bp,
209 193 xfs_dir2_data_unused_t *dup);
210extern void 194extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_dabuf *bp,
211 xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_dabuf *bp,
212 xfs_dir2_data_unused_t *dup);
213
214extern void
215 xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_dabuf *bp,
216 xfs_dir2_data_aoff_t offset, 195 xfs_dir2_data_aoff_t offset,
217 xfs_dir2_data_aoff_t len, int *needlogp, 196 xfs_dir2_data_aoff_t len, int *needlogp,
218 int *needscanp); 197 int *needscanp);
219 198extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_dabuf *bp,
220extern void
221 xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_dabuf *bp,
222 xfs_dir2_data_unused_t *dup, 199 xfs_dir2_data_unused_t *dup,
223 xfs_dir2_data_aoff_t offset, 200 xfs_dir2_data_aoff_t offset,
224 xfs_dir2_data_aoff_t len, int *needlogp, 201 xfs_dir2_data_aoff_t len, int *needlogp,
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 056f5283904b..89e48877e0ea 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -29,21 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * xfs_dir2_leaf.c
35 * XFS directory version 2 implementation - single leaf form
36 * see xfs_dir2_leaf.h for data structures.
37 * These directories have multiple XFS_DIR2_DATA blocks and one
38 * XFS_DIR2_LEAF1 block containing the hash table and freespace map.
39 */
40
41#include "xfs.h" 32#include "xfs.h"
42 33#include "xfs_fs.h"
43#include "xfs_macros.h"
44#include "xfs_types.h" 34#include "xfs_types.h"
45#include "xfs_inum.h" 35#include "xfs_bit.h"
46#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
47#include "xfs_trans.h" 38#include "xfs_trans.h"
48#include "xfs_sb.h" 39#include "xfs_sb.h"
49#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -51,6 +42,7 @@
51#include "xfs_dir2.h" 42#include "xfs_dir2.h"
52#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
53#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_da_btree.h"
54#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
55#include "xfs_attr_sf.h" 47#include "xfs_attr_sf.h"
56#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
@@ -58,14 +50,12 @@
58#include "xfs_dinode.h" 50#include "xfs_dinode.h"
59#include "xfs_inode.h" 51#include "xfs_inode.h"
60#include "xfs_bmap.h" 52#include "xfs_bmap.h"
61#include "xfs_da_btree.h"
62#include "xfs_dir2_data.h" 53#include "xfs_dir2_data.h"
63#include "xfs_dir2_leaf.h" 54#include "xfs_dir2_leaf.h"
64#include "xfs_dir2_block.h" 55#include "xfs_dir2_block.h"
65#include "xfs_dir2_node.h" 56#include "xfs_dir2_node.h"
66#include "xfs_dir2_trace.h" 57#include "xfs_dir2_trace.h"
67#include "xfs_error.h" 58#include "xfs_error.h"
68#include "xfs_bit.h"
69 59
70/* 60/*
71 * Local function declarations. 61 * Local function declarations.
diff --git a/fs/xfs/xfs_dir2_leaf.h b/fs/xfs/xfs_dir2_leaf.h
index 3303cd6f4c00..43f0ec2131a9 100644
--- a/fs/xfs/xfs_dir2_leaf.h
+++ b/fs/xfs/xfs_dir2_leaf.h
@@ -44,10 +44,6 @@ struct xfs_mount;
44struct xfs_trans; 44struct xfs_trans;
45 45
46/* 46/*
47 * Constants.
48 */
49
50/*
51 * Offset of the leaf/node space. First block in this space 47 * Offset of the leaf/node space. First block in this space
52 * is the btree root. 48 * is the btree root.
53 */ 49 */
@@ -57,10 +53,6 @@ struct xfs_trans;
57 XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET) 53 XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET)
58 54
59/* 55/*
60 * Types.
61 */
62
63/*
64 * Offset in data space of a data entry. 56 * Offset in data space of a data entry.
65 */ 57 */
66typedef __uint32_t xfs_dir2_dataptr_t; 58typedef __uint32_t xfs_dir2_dataptr_t;
@@ -68,10 +60,6 @@ typedef __uint32_t xfs_dir2_dataptr_t;
68#define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0) 60#define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0)
69 61
70/* 62/*
71 * Structures.
72 */
73
74/*
75 * Leaf block header. 63 * Leaf block header.
76 */ 64 */
77typedef struct xfs_dir2_leaf_hdr { 65typedef struct xfs_dir2_leaf_hdr {
@@ -109,245 +97,193 @@ typedef struct xfs_dir2_leaf {
109} xfs_dir2_leaf_t; 97} xfs_dir2_leaf_t;
110 98
111/* 99/*
112 * Macros. 100 * DB blocks here are logical directory block numbers, not filesystem blocks.
113 * The DB blocks are logical directory block numbers, not filesystem blocks.
114 */ 101 */
115 102
116#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_MAX_LEAF_ENTS) 103#define XFS_DIR2_MAX_LEAF_ENTS(mp) xfs_dir2_max_leaf_ents(mp)
117int 104static inline int xfs_dir2_max_leaf_ents(struct xfs_mount *mp)
118xfs_dir2_max_leaf_ents(struct xfs_mount *mp); 105{
119#define XFS_DIR2_MAX_LEAF_ENTS(mp) \ 106 return (int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) /
120 xfs_dir2_max_leaf_ents(mp) 107 (uint)sizeof(xfs_dir2_leaf_entry_t));
121#else 108}
122#define XFS_DIR2_MAX_LEAF_ENTS(mp) \
123 ((int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) / \
124 (uint)sizeof(xfs_dir2_leaf_entry_t)))
125#endif
126 109
127/* 110/*
128 * Get address of the bestcount field in the single-leaf block. 111 * Get address of the bestcount field in the single-leaf block.
129 */ 112 */
130#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_TAIL_P) 113#define XFS_DIR2_LEAF_TAIL_P(mp,lp) xfs_dir2_leaf_tail_p(mp, lp)
131xfs_dir2_leaf_tail_t * 114static inline xfs_dir2_leaf_tail_t *
132xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp); 115xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp)
133#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \ 116{
134 xfs_dir2_leaf_tail_p(mp, lp) 117 return (xfs_dir2_leaf_tail_t *)
135#else 118 ((char *)(lp) + (mp)->m_dirblksize -
136#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \ 119 (uint)sizeof(xfs_dir2_leaf_tail_t));
137 ((xfs_dir2_leaf_tail_t *)\ 120}
138 ((char *)(lp) + (mp)->m_dirblksize - \
139 (uint)sizeof(xfs_dir2_leaf_tail_t)))
140#endif
141 121
142/* 122/*
143 * Get address of the bests array in the single-leaf block. 123 * Get address of the bests array in the single-leaf block.
144 */ 124 */
145#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_BESTS_P)
146xfs_dir2_data_off_t *
147xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp);
148#define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp) 125#define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp)
149#else 126static inline xfs_dir2_data_off_t *
150#define XFS_DIR2_LEAF_BESTS_P(ltp) \ 127xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp)
151 ((xfs_dir2_data_off_t *)(ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT)) 128{
152#endif 129 return (xfs_dir2_data_off_t *)
130 (ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT);
131}
153 132
154/* 133/*
155 * Convert dataptr to byte in file space 134 * Convert dataptr to byte in file space
156 */ 135 */
157#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_BYTE)
158xfs_dir2_off_t
159xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp);
160#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp) 136#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp)
161#else 137static inline xfs_dir2_off_t
162#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) \ 138xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
163 ((xfs_dir2_off_t)(dp) << XFS_DIR2_DATA_ALIGN_LOG) 139{
164#endif 140 return (xfs_dir2_off_t)(dp) << XFS_DIR2_DATA_ALIGN_LOG;
141}
165 142
166/* 143/*
167 * Convert byte in file space to dataptr. It had better be aligned. 144 * Convert byte in file space to dataptr. It had better be aligned.
168 */ 145 */
169#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DATAPTR)
170xfs_dir2_dataptr_t
171xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by);
172#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by) 146#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by)
173#else 147static inline xfs_dir2_dataptr_t
174#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) \ 148xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by)
175 ((xfs_dir2_dataptr_t)((by) >> XFS_DIR2_DATA_ALIGN_LOG)) 149{
176#endif 150 return (xfs_dir2_dataptr_t)((by) >> XFS_DIR2_DATA_ALIGN_LOG);
151}
152
153/*
154 * Convert byte in space to (DB) block
155 */
156#define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by)
157static inline xfs_dir2_db_t
158xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by)
159{
160 return (xfs_dir2_db_t)((by) >> \
161 ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog));
162}
177 163
178/* 164/*
179 * Convert dataptr to a block number 165 * Convert dataptr to a block number
180 */ 166 */
181#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_DB)
182xfs_dir2_db_t
183xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp);
184#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp) 167#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp)
185#else 168static inline xfs_dir2_db_t
186#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) \ 169xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
187 XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp)) 170{
188#endif 171 return XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp));
172}
173
174/*
175 * Convert byte in space to offset in a block
176 */
177#define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by)
178static inline xfs_dir2_data_aoff_t
179xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by)
180{
181 return (xfs_dir2_data_aoff_t)((by) & \
182 ((1 << ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) - 1));
183}
189 184
190/* 185/*
191 * Convert dataptr to a byte offset in a block 186 * Convert dataptr to a byte offset in a block
192 */ 187 */
193#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_OFF)
194xfs_dir2_data_aoff_t
195xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp);
196#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp) 188#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp)
197#else 189static inline xfs_dir2_data_aoff_t
198#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) \ 190xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
199 XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp)) 191{
200#endif 192 return XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp));
193}
201 194
202/* 195/*
203 * Convert block and offset to byte in space 196 * Convert block and offset to byte in space
204 */ 197 */
205#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_OFF_TO_BYTE)
206xfs_dir2_off_t
207xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db,
208 xfs_dir2_data_aoff_t o);
209#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ 198#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \
210 xfs_dir2_db_off_to_byte(mp, db, o) 199 xfs_dir2_db_off_to_byte(mp, db, o)
211#else 200static inline xfs_dir2_off_t
212#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ 201xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db,
213 (((xfs_dir2_off_t)(db) << \ 202 xfs_dir2_data_aoff_t o)
214 ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) + (o)) 203{
215#endif 204 return ((xfs_dir2_off_t)(db) << \
205 ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) + (o);
206}
216 207
217/* 208/*
218 * Convert byte in space to (DB) block 209 * Convert block (DB) to block (dablk)
219 */ 210 */
220#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DB) 211#define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db)
221xfs_dir2_db_t xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by); 212static inline xfs_dablk_t
222#define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by) 213xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db)
223#else 214{
224#define XFS_DIR2_BYTE_TO_DB(mp,by) \ 215 return (xfs_dablk_t)((db) << (mp)->m_sb.sb_dirblklog);
225 ((xfs_dir2_db_t)((by) >> \ 216}
226 ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)))
227#endif
228 217
229/* 218/*
230 * Convert byte in space to (DA) block 219 * Convert byte in space to (DA) block
231 */ 220 */
232#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DA)
233xfs_dablk_t xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by);
234#define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by) 221#define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by)
235#else 222static inline xfs_dablk_t
236#define XFS_DIR2_BYTE_TO_DA(mp,by) \ 223xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by)
237 XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by)) 224{
238#endif 225 return XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by));
239 226}
240/*
241 * Convert byte in space to offset in a block
242 */
243#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_OFF)
244xfs_dir2_data_aoff_t
245xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by);
246#define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by)
247#else
248#define XFS_DIR2_BYTE_TO_OFF(mp,by) \
249 ((xfs_dir2_data_aoff_t)((by) & \
250 ((1 << ((mp)->m_sb.sb_blocklog + \
251 (mp)->m_sb.sb_dirblklog)) - 1)))
252#endif
253 227
254/* 228/*
255 * Convert block and offset to dataptr 229 * Convert block and offset to dataptr
256 */ 230 */
257#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_OFF_TO_DATAPTR)
258xfs_dir2_dataptr_t
259xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db,
260 xfs_dir2_data_aoff_t o);
261#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ 231#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \
262 xfs_dir2_db_off_to_dataptr(mp, db, o) 232 xfs_dir2_db_off_to_dataptr(mp, db, o)
263#else 233static inline xfs_dir2_dataptr_t
264#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ 234xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db,
265 XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o)) 235 xfs_dir2_data_aoff_t o)
266#endif 236{
267 237 return XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o));
268/* 238}
269 * Convert block (DB) to block (dablk)
270 */
271#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_DA)
272xfs_dablk_t xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db);
273#define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db)
274#else
275#define XFS_DIR2_DB_TO_DA(mp,db) \
276 ((xfs_dablk_t)((db) << (mp)->m_sb.sb_dirblklog))
277#endif
278 239
279/* 240/*
280 * Convert block (dablk) to block (DB) 241 * Convert block (dablk) to block (DB)
281 */ 242 */
282#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DA_TO_DB)
283xfs_dir2_db_t xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da);
284#define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da) 243#define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da)
285#else 244static inline xfs_dir2_db_t
286#define XFS_DIR2_DA_TO_DB(mp,da) \ 245xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da)
287 ((xfs_dir2_db_t)((da) >> (mp)->m_sb.sb_dirblklog)) 246{
288#endif 247 return (xfs_dir2_db_t)((da) >> (mp)->m_sb.sb_dirblklog);
248}
289 249
290/* 250/*
291 * Convert block (dablk) to byte offset in space 251 * Convert block (dablk) to byte offset in space
292 */ 252 */
293#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DA_TO_BYTE)
294xfs_dir2_off_t xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da);
295#define XFS_DIR2_DA_TO_BYTE(mp,da) xfs_dir2_da_to_byte(mp, da) 253#define XFS_DIR2_DA_TO_BYTE(mp,da) xfs_dir2_da_to_byte(mp, da)
296#else 254static inline xfs_dir2_off_t
297#define XFS_DIR2_DA_TO_BYTE(mp,da) \ 255xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da)
298 XFS_DIR2_DB_OFF_TO_BYTE(mp, XFS_DIR2_DA_TO_DB(mp, da), 0) 256{
299#endif 257 return XFS_DIR2_DB_OFF_TO_BYTE(mp, XFS_DIR2_DA_TO_DB(mp, da), 0);
258}
300 259
301/* 260/*
302 * Function declarations. 261 * Function declarations.
303 */ 262 */
304 263extern int xfs_dir2_block_to_leaf(struct xfs_da_args *args,
305extern int 264 struct xfs_dabuf *dbp);
306 xfs_dir2_block_to_leaf(struct xfs_da_args *args, struct xfs_dabuf *dbp); 265extern int xfs_dir2_leaf_addname(struct xfs_da_args *args);
307 266extern void xfs_dir2_leaf_compact(struct xfs_da_args *args,
308extern int 267 struct xfs_dabuf *bp);
309 xfs_dir2_leaf_addname(struct xfs_da_args *args); 268extern void xfs_dir2_leaf_compact_x1(struct xfs_dabuf *bp, int *indexp,
310 269 int *lowstalep, int *highstalep,
311extern void 270 int *lowlogp, int *highlogp);
312 xfs_dir2_leaf_compact(struct xfs_da_args *args, struct xfs_dabuf *bp); 271extern int xfs_dir2_leaf_getdents(struct xfs_trans *tp, struct xfs_inode *dp,
313 272 struct uio *uio, int *eofp,
314extern void 273 struct xfs_dirent *dbp, xfs_dir2_put_t put);
315 xfs_dir2_leaf_compact_x1(struct xfs_dabuf *bp, int *indexp, 274extern int xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno,
316 int *lowstalep, int *highstalep, int *lowlogp, 275 struct xfs_dabuf **bpp, int magic);
317 int *highlogp); 276extern void xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_dabuf *bp,
318 277 int first, int last);
319extern int 278extern void xfs_dir2_leaf_log_header(struct xfs_trans *tp,
320 xfs_dir2_leaf_getdents(struct xfs_trans *tp, struct xfs_inode *dp, 279 struct xfs_dabuf *bp);
321 struct uio *uio, int *eofp, struct xfs_dirent *dbp, 280extern int xfs_dir2_leaf_lookup(struct xfs_da_args *args);
322 xfs_dir2_put_t put); 281extern int xfs_dir2_leaf_removename(struct xfs_da_args *args);
323 282extern int xfs_dir2_leaf_replace(struct xfs_da_args *args);
324extern int 283extern int xfs_dir2_leaf_search_hash(struct xfs_da_args *args,
325 xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno, 284 struct xfs_dabuf *lbp);
326 struct xfs_dabuf **bpp, int magic); 285extern int xfs_dir2_leaf_trim_data(struct xfs_da_args *args,
327 286 struct xfs_dabuf *lbp, xfs_dir2_db_t db);
328extern void 287extern int xfs_dir2_node_to_leaf(struct xfs_da_state *state);
329 xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_dabuf *bp,
330 int first, int last);
331
332extern void
333 xfs_dir2_leaf_log_header(struct xfs_trans *tp, struct xfs_dabuf *bp);
334
335extern int
336 xfs_dir2_leaf_lookup(struct xfs_da_args *args);
337
338extern int
339 xfs_dir2_leaf_removename(struct xfs_da_args *args);
340
341extern int
342 xfs_dir2_leaf_replace(struct xfs_da_args *args);
343
344extern int
345 xfs_dir2_leaf_search_hash(struct xfs_da_args *args,
346 struct xfs_dabuf *lbp);
347extern int
348 xfs_dir2_leaf_trim_data(struct xfs_da_args *args, struct xfs_dabuf *lbp, xfs_dir2_db_t db);
349
350extern int
351 xfs_dir2_node_to_leaf(struct xfs_da_state *state);
352 288
353#endif /* __XFS_DIR2_LEAF_H__ */ 289#endif /* __XFS_DIR2_LEAF_H__ */
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index a7615d86bfb7..2517460430d3 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -29,33 +29,25 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * xfs_dir2_node.c
35 * XFS directory implementation, version 2, node form files
36 * See data structures in xfs_dir2_node.h and xfs_da_btree.h.
37 */
38
39#include "xfs.h" 32#include "xfs.h"
40 33#include "xfs_fs.h"
41#include "xfs_macros.h"
42#include "xfs_types.h" 34#include "xfs_types.h"
43#include "xfs_inum.h"
44#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
45#include "xfs_trans.h" 37#include "xfs_trans.h"
46#include "xfs_sb.h" 38#include "xfs_sb.h"
47#include "xfs_dir.h" 39#include "xfs_dir.h"
48#include "xfs_dir2.h" 40#include "xfs_dir2.h"
49#include "xfs_dmapi.h" 41#include "xfs_dmapi.h"
50#include "xfs_mount.h" 42#include "xfs_mount.h"
43#include "xfs_da_btree.h"
51#include "xfs_bmap_btree.h" 44#include "xfs_bmap_btree.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 45#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 46#include "xfs_dir2_sf.h"
47#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 48#include "xfs_dinode.h"
56#include "xfs_inode.h" 49#include "xfs_inode.h"
57#include "xfs_bmap.h" 50#include "xfs_bmap.h"
58#include "xfs_da_btree.h"
59#include "xfs_dir2_data.h" 51#include "xfs_dir2_data.h"
60#include "xfs_dir2_leaf.h" 52#include "xfs_dir2_leaf.h"
61#include "xfs_dir2_block.h" 53#include "xfs_dir2_block.h"
diff --git a/fs/xfs/xfs_dir2_node.h b/fs/xfs/xfs_dir2_node.h
index 96db420c7c5c..70fa0797c207 100644
--- a/fs/xfs/xfs_dir2_node.h
+++ b/fs/xfs/xfs_dir2_node.h
@@ -45,10 +45,6 @@ struct xfs_inode;
45struct xfs_trans; 45struct xfs_trans;
46 46
47/* 47/*
48 * Constants.
49 */
50
51/*
52 * Offset of the freespace index. 48 * Offset of the freespace index.
53 */ 49 */
54#define XFS_DIR2_FREE_SPACE 2 50#define XFS_DIR2_FREE_SPACE 2
@@ -58,9 +54,6 @@ struct xfs_trans;
58 54
59#define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */ 55#define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */
60 56
61/*
62 * Structures.
63 */
64typedef struct xfs_dir2_free_hdr { 57typedef struct xfs_dir2_free_hdr {
65 __uint32_t magic; /* XFS_DIR2_FREE_MAGIC */ 58 __uint32_t magic; /* XFS_DIR2_FREE_MAGIC */
66 __int32_t firstdb; /* db of first entry */ 59 __int32_t firstdb; /* db of first entry */
@@ -73,87 +66,53 @@ typedef struct xfs_dir2_free {
73 xfs_dir2_data_off_t bests[1]; /* best free counts */ 66 xfs_dir2_data_off_t bests[1]; /* best free counts */
74 /* unused entries are -1 */ 67 /* unused entries are -1 */
75} xfs_dir2_free_t; 68} xfs_dir2_free_t;
69
76#define XFS_DIR2_MAX_FREE_BESTS(mp) \ 70#define XFS_DIR2_MAX_FREE_BESTS(mp) \
77 (((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_free_hdr_t)) / \ 71 (((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_free_hdr_t)) / \
78 (uint)sizeof(xfs_dir2_data_off_t)) 72 (uint)sizeof(xfs_dir2_data_off_t))
79 73
80/* 74/*
81 * Macros.
82 */
83
84/*
85 * Convert data space db to the corresponding free db. 75 * Convert data space db to the corresponding free db.
86 */ 76 */
87#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_FDB)
88xfs_dir2_db_t
89xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db);
90#define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db) 77#define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db)
91#else 78static inline xfs_dir2_db_t
92#define XFS_DIR2_DB_TO_FDB(mp,db) \ 79xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db)
93 (XFS_DIR2_FREE_FIRSTDB(mp) + (db) / XFS_DIR2_MAX_FREE_BESTS(mp)) 80{
94#endif 81 return (XFS_DIR2_FREE_FIRSTDB(mp) + (db) / XFS_DIR2_MAX_FREE_BESTS(mp));
82}
95 83
96/* 84/*
97 * Convert data space db to the corresponding index in a free db. 85 * Convert data space db to the corresponding index in a free db.
98 */ 86 */
99#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_FDINDEX)
100int
101xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db);
102#define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db) 87#define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db)
103#else 88static inline int
104#define XFS_DIR2_DB_TO_FDINDEX(mp,db) ((db) % XFS_DIR2_MAX_FREE_BESTS(mp)) 89xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db)
105#endif 90{
106 91 return ((db) % XFS_DIR2_MAX_FREE_BESTS(mp));
107/* 92}
108 * Functions. 93
109 */ 94extern void xfs_dir2_free_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp,
110 95 int first, int last);
111extern void 96extern int xfs_dir2_leaf_to_node(struct xfs_da_args *args,
112 xfs_dir2_free_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp, 97 struct xfs_dabuf *lbp);
113 int first, int last); 98extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count);
114 99extern int xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp,
115extern int 100 struct xfs_da_args *args, int *indexp,
116 xfs_dir2_leaf_to_node(struct xfs_da_args *args, struct xfs_dabuf *lbp); 101 struct xfs_da_state *state);
117 102extern int xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp,
118extern xfs_dahash_t 103 struct xfs_dabuf *leaf2_bp);
119 xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count); 104extern int xfs_dir2_leafn_split(struct xfs_da_state *state,
120 105 struct xfs_da_state_blk *oldblk,
121extern int 106 struct xfs_da_state_blk *newblk);
122 xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp, 107extern int xfs_dir2_leafn_toosmall(struct xfs_da_state *state, int *action);
123 struct xfs_da_args *args, int *indexp, 108extern void xfs_dir2_leafn_unbalance(struct xfs_da_state *state,
124 struct xfs_da_state *state); 109 struct xfs_da_state_blk *drop_blk,
125 110 struct xfs_da_state_blk *save_blk);
126extern int 111extern int xfs_dir2_node_addname(struct xfs_da_args *args);
127 xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp, 112extern int xfs_dir2_node_lookup(struct xfs_da_args *args);
128 struct xfs_dabuf *leaf2_bp); 113extern int xfs_dir2_node_removename(struct xfs_da_args *args);
129 114extern int xfs_dir2_node_replace(struct xfs_da_args *args);
130extern int 115extern int xfs_dir2_node_trim_free(struct xfs_da_args *args, xfs_fileoff_t fo,
131 xfs_dir2_leafn_split(struct xfs_da_state *state, 116 int *rvalp);
132 struct xfs_da_state_blk *oldblk,
133 struct xfs_da_state_blk *newblk);
134
135extern int
136 xfs_dir2_leafn_toosmall(struct xfs_da_state *state, int *action);
137
138extern void
139 xfs_dir2_leafn_unbalance(struct xfs_da_state *state,
140 struct xfs_da_state_blk *drop_blk,
141 struct xfs_da_state_blk *save_blk);
142
143extern int
144 xfs_dir2_node_addname(struct xfs_da_args *args);
145
146extern int
147 xfs_dir2_node_lookup(struct xfs_da_args *args);
148
149extern int
150 xfs_dir2_node_removename(struct xfs_da_args *args);
151
152extern int
153 xfs_dir2_node_replace(struct xfs_da_args *args);
154
155extern int
156 xfs_dir2_node_trim_free(struct xfs_da_args *args, xfs_fileoff_t fo,
157 int *rvalp);
158 117
159#endif /* __XFS_DIR2_NODE_H__ */ 118#endif /* __XFS_DIR2_NODE_H__ */
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index 6bbc61674411..95e703d5bc05 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -29,32 +29,25 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * xfs_dir2_sf.c
35 * Shortform directory implementation for v2 directories.
36 */
37
38#include "xfs.h" 32#include "xfs.h"
39 33#include "xfs_fs.h"
40#include "xfs_macros.h"
41#include "xfs_types.h" 34#include "xfs_types.h"
42#include "xfs_inum.h"
43#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
44#include "xfs_trans.h" 37#include "xfs_trans.h"
45#include "xfs_sb.h" 38#include "xfs_sb.h"
46#include "xfs_dir.h" 39#include "xfs_dir.h"
47#include "xfs_dir2.h" 40#include "xfs_dir2.h"
48#include "xfs_dmapi.h" 41#include "xfs_dmapi.h"
49#include "xfs_mount.h" 42#include "xfs_mount.h"
43#include "xfs_da_btree.h"
50#include "xfs_bmap_btree.h" 44#include "xfs_bmap_btree.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 45#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 46#include "xfs_dir2_sf.h"
47#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 48#include "xfs_dinode.h"
55#include "xfs_inode_item.h"
56#include "xfs_inode.h" 49#include "xfs_inode.h"
57#include "xfs_da_btree.h" 50#include "xfs_inode_item.h"
58#include "xfs_dir_leaf.h" 51#include "xfs_dir_leaf.h"
59#include "xfs_error.h" 52#include "xfs_error.h"
60#include "xfs_dir2_data.h" 53#include "xfs_dir2_data.h"
diff --git a/fs/xfs/xfs_dir2_sf.h b/fs/xfs/xfs_dir2_sf.h
index bac6f5a2a312..133464935ef1 100644
--- a/fs/xfs/xfs_dir2_sf.h
+++ b/fs/xfs/xfs_dir2_sf.h
@@ -104,140 +104,106 @@ typedef struct xfs_dir2_sf {
104 xfs_dir2_sf_entry_t list[1]; /* shortform entries */ 104 xfs_dir2_sf_entry_t list[1]; /* shortform entries */
105} xfs_dir2_sf_t; 105} xfs_dir2_sf_t;
106 106
107#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_HDR_SIZE)
108int xfs_dir2_sf_hdr_size(int i8count);
109#define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count) 107#define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count)
110#else 108static inline int xfs_dir2_sf_hdr_size(int i8count)
111#define XFS_DIR2_SF_HDR_SIZE(i8count) \ 109{
112 ((uint)sizeof(xfs_dir2_sf_hdr_t) - \ 110 return ((uint)sizeof(xfs_dir2_sf_hdr_t) - \
113 ((i8count) == 0) * \ 111 ((i8count) == 0) * \
114 ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))) 112 ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t)));
115#endif 113}
116 114
117#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_INUMBERP)
118xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep);
119#define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep) 115#define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep)
120#else 116static inline xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep)
121#define XFS_DIR2_SF_INUMBERP(sfep) \ 117{
122 ((xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen]) 118 return (xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen];
123#endif 119}
124
125#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_INUMBER)
126xfs_intino_t xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from);
127#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \
128 xfs_dir2_sf_get_inumber(sfp, from)
129 120
130#else 121#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \
131#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \ 122 xfs_dir2_sf_get_inumber(sfp, from)
132 ((sfp)->hdr.i8count == 0 ? \ 123static inline xfs_intino_t
124xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from)
125{
126 return ((sfp)->hdr.i8count == 0 ? \
133 (xfs_intino_t)XFS_GET_DIR_INO4((from)->i4) : \ 127 (xfs_intino_t)XFS_GET_DIR_INO4((from)->i4) : \
134 (xfs_intino_t)XFS_GET_DIR_INO8((from)->i8)) 128 (xfs_intino_t)XFS_GET_DIR_INO8((from)->i8));
135#endif 129}
136 130
137#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_INUMBER) 131#define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \
138void xfs_dir2_sf_put_inumber(xfs_dir2_sf_t *sfp, xfs_ino_t *from,
139 xfs_dir2_inou_t *to);
140#define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \
141 xfs_dir2_sf_put_inumber(sfp,from,to) 132 xfs_dir2_sf_put_inumber(sfp,from,to)
142#else 133static inline void xfs_dir2_sf_put_inumber(xfs_dir2_sf_t *sfp, xfs_ino_t *from,
143#define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \ 134 xfs_dir2_inou_t *to)
144 if ((sfp)->hdr.i8count == 0) { \ 135{
145 XFS_PUT_DIR_INO4(*(from), (to)->i4); \ 136 if ((sfp)->hdr.i8count == 0)
146 } else { \ 137 XFS_PUT_DIR_INO4(*(from), (to)->i4);
147 XFS_PUT_DIR_INO8(*(from), (to)->i8); \ 138 else
148 } 139 XFS_PUT_DIR_INO8(*(from), (to)->i8);
149#endif 140}
150 141
151#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_OFFSET)
152xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep);
153#define XFS_DIR2_SF_GET_OFFSET(sfep) \ 142#define XFS_DIR2_SF_GET_OFFSET(sfep) \
154 xfs_dir2_sf_get_offset(sfep) 143 xfs_dir2_sf_get_offset(sfep)
155#else 144static inline xfs_dir2_data_aoff_t
156#define XFS_DIR2_SF_GET_OFFSET(sfep) \ 145xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep)
157 INT_GET_UNALIGNED_16_BE(&(sfep)->offset.i) 146{
158#endif 147 return INT_GET_UNALIGNED_16_BE(&(sfep)->offset.i);
148}
159 149
160#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_OFFSET)
161void xfs_dir2_sf_put_offset(xfs_dir2_sf_entry_t *sfep,
162 xfs_dir2_data_aoff_t off);
163#define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \ 150#define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \
164 xfs_dir2_sf_put_offset(sfep,off) 151 xfs_dir2_sf_put_offset(sfep,off)
165#else 152static inline void
166#define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \ 153xfs_dir2_sf_put_offset(xfs_dir2_sf_entry_t *sfep, xfs_dir2_data_aoff_t off)
167 INT_SET_UNALIGNED_16_BE(&(sfep)->offset.i,off) 154{
168#endif 155 INT_SET_UNALIGNED_16_BE(&(sfep)->offset.i, off);
156}
169 157
170#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_ENTSIZE_BYNAME)
171int xfs_dir2_sf_entsize_byname(xfs_dir2_sf_t *sfp, int len);
172#define XFS_DIR2_SF_ENTSIZE_BYNAME(sfp,len) \ 158#define XFS_DIR2_SF_ENTSIZE_BYNAME(sfp,len) \
173 xfs_dir2_sf_entsize_byname(sfp,len) 159 xfs_dir2_sf_entsize_byname(sfp,len)
174#else 160static inline int xfs_dir2_sf_entsize_byname(xfs_dir2_sf_t *sfp, int len)
175#define XFS_DIR2_SF_ENTSIZE_BYNAME(sfp,len) /* space a name uses */ \ 161{
176 ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (len) - \ 162 return ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (len) - \
177 ((sfp)->hdr.i8count == 0) * \ 163 ((sfp)->hdr.i8count == 0) * \
178 ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))) 164 ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t)));
179#endif 165}
180 166
181#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_ENTSIZE_BYENTRY)
182int xfs_dir2_sf_entsize_byentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep);
183#define XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep) \ 167#define XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep) \
184 xfs_dir2_sf_entsize_byentry(sfp,sfep) 168 xfs_dir2_sf_entsize_byentry(sfp,sfep)
185#else 169static inline int
186#define XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep) /* space an entry uses */ \ 170xfs_dir2_sf_entsize_byentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep)
187 ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (sfep)->namelen - \ 171{
188 ((sfp)->hdr.i8count == 0) * \ 172 return ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (sfep)->namelen - \
189 ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))) 173 ((sfp)->hdr.i8count == 0) * \
190#endif 174 ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t)));
191 175}
192#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_FIRSTENTRY) 176
193xfs_dir2_sf_entry_t *xfs_dir2_sf_firstentry(xfs_dir2_sf_t *sfp);
194#define XFS_DIR2_SF_FIRSTENTRY(sfp) xfs_dir2_sf_firstentry(sfp) 177#define XFS_DIR2_SF_FIRSTENTRY(sfp) xfs_dir2_sf_firstentry(sfp)
195#else 178static inline xfs_dir2_sf_entry_t *xfs_dir2_sf_firstentry(xfs_dir2_sf_t *sfp)
196#define XFS_DIR2_SF_FIRSTENTRY(sfp) /* first entry in struct */ \ 179{
197 ((xfs_dir2_sf_entry_t *) \ 180 return ((xfs_dir2_sf_entry_t *) \
198 ((char *)(sfp) + XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count))) 181 ((char *)(sfp) + XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count)));
199#endif 182}
200 183
201#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_NEXTENTRY) 184#define XFS_DIR2_SF_NEXTENTRY(sfp,sfep) xfs_dir2_sf_nextentry(sfp,sfep)
202xfs_dir2_sf_entry_t *xfs_dir2_sf_nextentry(xfs_dir2_sf_t *sfp, 185static inline xfs_dir2_sf_entry_t *
203 xfs_dir2_sf_entry_t *sfep); 186xfs_dir2_sf_nextentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep)
204#define XFS_DIR2_SF_NEXTENTRY(sfp,sfep) xfs_dir2_sf_nextentry(sfp,sfep) 187{
205#else 188 return ((xfs_dir2_sf_entry_t *) \
206#define XFS_DIR2_SF_NEXTENTRY(sfp,sfep) /* next entry in struct */ \ 189 ((char *)(sfep) + XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep)));
207 ((xfs_dir2_sf_entry_t *) \ 190}
208 ((char *)(sfep) + XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep)))
209#endif
210 191
211/* 192/*
212 * Functions. 193 * Functions.
213 */ 194 */
214 195extern int xfs_dir2_block_sfsize(struct xfs_inode *dp,
215extern int 196 struct xfs_dir2_block *block,
216 xfs_dir2_block_sfsize(struct xfs_inode *dp, 197 xfs_dir2_sf_hdr_t *sfhp);
217 struct xfs_dir2_block *block, 198extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_dabuf *bp,
218 xfs_dir2_sf_hdr_t *sfhp); 199 int size, xfs_dir2_sf_hdr_t *sfhp);
219 200extern int xfs_dir2_sf_addname(struct xfs_da_args *args);
220extern int 201extern int xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino);
221 xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_dabuf *bp, 202extern int xfs_dir2_sf_getdents(struct xfs_inode *dp, struct uio *uio,
222 int size, xfs_dir2_sf_hdr_t *sfhp); 203 int *eofp, struct xfs_dirent *dbp,
223 204 xfs_dir2_put_t put);
224extern int 205extern int xfs_dir2_sf_lookup(struct xfs_da_args *args);
225 xfs_dir2_sf_addname(struct xfs_da_args *args); 206extern int xfs_dir2_sf_removename(struct xfs_da_args *args);
226 207extern int xfs_dir2_sf_replace(struct xfs_da_args *args);
227extern int
228 xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino);
229
230extern int
231 xfs_dir2_sf_getdents(struct xfs_inode *dp, struct uio *uio, int *eofp,
232 struct xfs_dirent *dbp, xfs_dir2_put_t put);
233
234extern int
235 xfs_dir2_sf_lookup(struct xfs_da_args *args);
236
237extern int
238 xfs_dir2_sf_removename(struct xfs_da_args *args);
239
240extern int
241 xfs_dir2_sf_replace(struct xfs_da_args *args);
242 208
243#endif /* __XFS_DIR2_SF_H__ */ 209#endif /* __XFS_DIR2_SF_H__ */
diff --git a/fs/xfs/xfs_dir2_trace.c b/fs/xfs/xfs_dir2_trace.c
index 9d6417393140..34e5138c670a 100644
--- a/fs/xfs/xfs_dir2_trace.c
+++ b/fs/xfs/xfs_dir2_trace.c
@@ -29,24 +29,19 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * xfs_dir2_trace.c
35 * Tracing for xfs v2 directories.
36 */
37#include "xfs.h" 32#include "xfs.h"
38 33#include "xfs_fs.h"
39#include "xfs_types.h" 34#include "xfs_types.h"
40#include "xfs_inum.h" 35#include "xfs_inum.h"
41#include "xfs_dir.h" 36#include "xfs_dir.h"
42#include "xfs_dir2.h" 37#include "xfs_dir2.h"
38#include "xfs_da_btree.h"
43#include "xfs_bmap_btree.h" 39#include "xfs_bmap_btree.h"
44#include "xfs_attr_sf.h"
45#include "xfs_dir_sf.h" 40#include "xfs_dir_sf.h"
46#include "xfs_dir2_sf.h" 41#include "xfs_dir2_sf.h"
42#include "xfs_attr_sf.h"
47#include "xfs_dinode.h" 43#include "xfs_dinode.h"
48#include "xfs_inode.h" 44#include "xfs_inode.h"
49#include "xfs_da_btree.h"
50#include "xfs_dir2_trace.h" 45#include "xfs_dir2_trace.h"
51 46
52#ifdef XFS_DIR2_TRACE 47#ifdef XFS_DIR2_TRACE
diff --git a/fs/xfs/xfs_dir_leaf.c b/fs/xfs/xfs_dir_leaf.c
index ca9bc2d9ba08..22997d314cf2 100644
--- a/fs/xfs/xfs_dir_leaf.c
+++ b/fs/xfs/xfs_dir_leaf.c
@@ -29,38 +29,30 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * xfs_dir_leaf.c
35 *
36 * GROT: figure out how to recover gracefully when bmap returns ENOSPC.
37 */
38
39#include "xfs.h" 32#include "xfs.h"
40 33#include "xfs_fs.h"
41#include "xfs_macros.h"
42#include "xfs_types.h" 34#include "xfs_types.h"
43#include "xfs_inum.h"
44#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
45#include "xfs_trans.h" 37#include "xfs_trans.h"
46#include "xfs_sb.h" 38#include "xfs_sb.h"
47#include "xfs_dir.h" 39#include "xfs_dir.h"
48#include "xfs_dir2.h" 40#include "xfs_dir2.h"
49#include "xfs_dmapi.h" 41#include "xfs_dmapi.h"
50#include "xfs_mount.h" 42#include "xfs_mount.h"
51#include "xfs_alloc_btree.h" 43#include "xfs_da_btree.h"
52#include "xfs_bmap_btree.h" 44#include "xfs_bmap_btree.h"
45#include "xfs_alloc_btree.h"
53#include "xfs_ialloc_btree.h" 46#include "xfs_ialloc_btree.h"
54#include "xfs_alloc.h"
55#include "xfs_btree.h"
56#include "xfs_attr_sf.h"
57#include "xfs_dir_sf.h" 47#include "xfs_dir_sf.h"
58#include "xfs_dir2_sf.h" 48#include "xfs_dir2_sf.h"
49#include "xfs_attr_sf.h"
59#include "xfs_dinode.h" 50#include "xfs_dinode.h"
60#include "xfs_inode_item.h"
61#include "xfs_inode.h" 51#include "xfs_inode.h"
52#include "xfs_inode_item.h"
53#include "xfs_alloc.h"
54#include "xfs_btree.h"
62#include "xfs_bmap.h" 55#include "xfs_bmap.h"
63#include "xfs_da_btree.h"
64#include "xfs_dir_leaf.h" 56#include "xfs_dir_leaf.h"
65#include "xfs_error.h" 57#include "xfs_error.h"
66 58
diff --git a/fs/xfs/xfs_dir_leaf.h b/fs/xfs/xfs_dir_leaf.h
index 480bffc1f29f..216d62693b72 100644
--- a/fs/xfs/xfs_dir_leaf.h
+++ b/fs/xfs/xfs_dir_leaf.h
@@ -152,30 +152,26 @@ typedef struct xfs_dir_put_args
152 struct uio *uio; /* uio control structure */ 152 struct uio *uio; /* uio control structure */
153} xfs_dir_put_args_t; 153} xfs_dir_put_args_t;
154 154
155#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_LEAF_ENTSIZE_BYNAME)
156int xfs_dir_leaf_entsize_byname(int len);
157#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) xfs_dir_leaf_entsize_byname(len) 155#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) xfs_dir_leaf_entsize_byname(len)
158#else 156static inline int xfs_dir_leaf_entsize_byname(int len)
159#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) /* space a name will use */ \ 157{
160 ((uint)sizeof(xfs_dir_leaf_name_t)-1 + len) 158 return (uint)sizeof(xfs_dir_leaf_name_t)-1 + len;
161#endif 159}
162#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_LEAF_ENTSIZE_BYENTRY) 160
163int xfs_dir_leaf_entsize_byentry(xfs_dir_leaf_entry_t *entry);
164#define XFS_DIR_LEAF_ENTSIZE_BYENTRY(entry) \ 161#define XFS_DIR_LEAF_ENTSIZE_BYENTRY(entry) \
165 xfs_dir_leaf_entsize_byentry(entry) 162 xfs_dir_leaf_entsize_byentry(entry)
166#else 163static inline int xfs_dir_leaf_entsize_byentry(xfs_dir_leaf_entry_t *entry)
167#define XFS_DIR_LEAF_ENTSIZE_BYENTRY(entry) /* space an entry will use */ \ 164{
168 ((uint)sizeof(xfs_dir_leaf_name_t)-1 + (entry)->namelen) 165 return (uint)sizeof(xfs_dir_leaf_name_t)-1 + (entry)->namelen;
169#endif 166}
170#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_LEAF_NAMESTRUCT) 167
171xfs_dir_leaf_name_t *
172xfs_dir_leaf_namestruct(xfs_dir_leafblock_t *leafp, int offset);
173#define XFS_DIR_LEAF_NAMESTRUCT(leafp,offset) \ 168#define XFS_DIR_LEAF_NAMESTRUCT(leafp,offset) \
174 xfs_dir_leaf_namestruct(leafp,offset) 169 xfs_dir_leaf_namestruct(leafp,offset)
175#else 170static inline xfs_dir_leaf_name_t *
176#define XFS_DIR_LEAF_NAMESTRUCT(leafp,offset) /* point to name struct */ \ 171xfs_dir_leaf_namestruct(xfs_dir_leafblock_t *leafp, int offset)
177 ((xfs_dir_leaf_name_t *)&((char *)(leafp))[offset]) 172{
178#endif 173 return (xfs_dir_leaf_name_t *)&((char *)(leafp))[offset];
174}
179 175
180/*======================================================================== 176/*========================================================================
181 * Function prototypes for the kernel. 177 * Function prototypes for the kernel.
@@ -190,7 +186,7 @@ int xfs_dir_shortform_lookup(struct xfs_da_args *args);
190int xfs_dir_shortform_to_leaf(struct xfs_da_args *args); 186int xfs_dir_shortform_to_leaf(struct xfs_da_args *args);
191int xfs_dir_shortform_removename(struct xfs_da_args *args); 187int xfs_dir_shortform_removename(struct xfs_da_args *args);
192int xfs_dir_shortform_getdents(struct xfs_inode *dp, struct uio *uio, int *eofp, 188int xfs_dir_shortform_getdents(struct xfs_inode *dp, struct uio *uio, int *eofp,
193 struct xfs_dirent *dbp, xfs_dir_put_t put); 189 struct xfs_dirent *dbp, xfs_dir_put_t put);
194int xfs_dir_shortform_replace(struct xfs_da_args *args); 190int xfs_dir_shortform_replace(struct xfs_da_args *args);
195 191
196/* 192/*
@@ -237,7 +233,6 @@ int xfs_dir_put_dirent64_direct(xfs_dir_put_args_t *pa);
237int xfs_dir_put_dirent64_uio(xfs_dir_put_args_t *pa); 233int xfs_dir_put_dirent64_uio(xfs_dir_put_args_t *pa);
238int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino); 234int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
239 235
240
241/* 236/*
242 * Global data. 237 * Global data.
243 */ 238 */
diff --git a/fs/xfs/xfs_dir_sf.h b/fs/xfs/xfs_dir_sf.h
index a61bcfc2a87d..2b75b767e152 100644
--- a/fs/xfs/xfs_dir_sf.h
+++ b/fs/xfs/xfs_dir_sf.h
@@ -76,49 +76,44 @@ typedef struct xfs_dir_sf_sort {
76 char *name; /* name value, pointer into buffer */ 76 char *name; /* name value, pointer into buffer */
77} xfs_dir_sf_sort_t; 77} xfs_dir_sf_sort_t;
78 78
79#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_GET_DIRINO) 79#define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to)
80void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to); 80static inline void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to)
81#define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to) 81{
82#else 82 *(to) = XFS_GET_DIR_INO8(*from);
83#define XFS_DIR_SF_GET_DIRINO(from,to) (*(to) = XFS_GET_DIR_INO8(*from)) 83}
84#endif 84
85#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_PUT_DIRINO) 85#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to)
86void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to); 86static inline void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to)
87#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to) 87{
88#else 88 XFS_PUT_DIR_INO8(*(from), *(to));
89#define XFS_DIR_SF_PUT_DIRINO(from,to) XFS_PUT_DIR_INO8(*(from), *(to)) 89}
90#endif 90
91#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYNAME) 91#define XFS_DIR_SF_ENTSIZE_BYNAME(len) xfs_dir_sf_entsize_byname(len)
92int xfs_dir_sf_entsize_byname(int len); 92static inline int xfs_dir_sf_entsize_byname(int len)
93#define XFS_DIR_SF_ENTSIZE_BYNAME(len) xfs_dir_sf_entsize_byname(len) 93{
94#else 94 return (uint)sizeof(xfs_dir_sf_entry_t)-1 + (len);
95#define XFS_DIR_SF_ENTSIZE_BYNAME(len) /* space a name uses */ \ 95}
96 ((uint)sizeof(xfs_dir_sf_entry_t)-1 + (len)) 96
97#endif
98#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYENTRY)
99int xfs_dir_sf_entsize_byentry(xfs_dir_sf_entry_t *sfep);
100#define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) xfs_dir_sf_entsize_byentry(sfep) 97#define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) xfs_dir_sf_entsize_byentry(sfep)
101#else 98static inline int xfs_dir_sf_entsize_byentry(xfs_dir_sf_entry_t *sfep)
102#define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) /* space an entry uses */ \ 99{
103 ((uint)sizeof(xfs_dir_sf_entry_t)-1 + (sfep)->namelen) 100 return (uint)sizeof(xfs_dir_sf_entry_t)-1 + (sfep)->namelen;
104#endif 101}
105#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_NEXTENTRY) 102
106xfs_dir_sf_entry_t *xfs_dir_sf_nextentry(xfs_dir_sf_entry_t *sfep);
107#define XFS_DIR_SF_NEXTENTRY(sfep) xfs_dir_sf_nextentry(sfep) 103#define XFS_DIR_SF_NEXTENTRY(sfep) xfs_dir_sf_nextentry(sfep)
108#else 104static inline xfs_dir_sf_entry_t *xfs_dir_sf_nextentry(xfs_dir_sf_entry_t *sfep)
109#define XFS_DIR_SF_NEXTENTRY(sfep) /* next entry in struct */ \ 105{
110 ((xfs_dir_sf_entry_t *) \ 106 return (xfs_dir_sf_entry_t *) \
111 ((char *)(sfep) + XFS_DIR_SF_ENTSIZE_BYENTRY(sfep))) 107 ((char *)(sfep) + XFS_DIR_SF_ENTSIZE_BYENTRY(sfep));
112#endif 108}
113#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ALLFIT) 109
114int xfs_dir_sf_allfit(int count, int totallen);
115#define XFS_DIR_SF_ALLFIT(count,totallen) \ 110#define XFS_DIR_SF_ALLFIT(count,totallen) \
116 xfs_dir_sf_allfit(count,totallen) 111 xfs_dir_sf_allfit(count,totallen)
117#else 112static inline int xfs_dir_sf_allfit(int count, int totallen)
118#define XFS_DIR_SF_ALLFIT(count,totallen) /* will all entries fit? */ \ 113{
119 ((uint)sizeof(xfs_dir_sf_hdr_t) + \ 114 return ((uint)sizeof(xfs_dir_sf_hdr_t) + \
120 ((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen)) 115 ((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen));
121#endif 116}
122 117
123#if defined(XFS_DIR_TRACE) 118#if defined(XFS_DIR_TRACE)
124 119
diff --git a/fs/xfs/xfs_dmops.c b/fs/xfs/xfs_dmops.c
index cec54ba800eb..1b99c4dfbab3 100644
--- a/fs/xfs/xfs_dmops.c
+++ b/fs/xfs/xfs_dmops.c
@@ -30,11 +30,10 @@
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32#include "xfs.h" 32#include "xfs.h"
33 33#include "xfs_fs.h"
34#include "xfs_macros.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h"
37#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
38#include "xfs_trans.h" 37#include "xfs_trans.h"
39#include "xfs_sb.h" 38#include "xfs_sb.h"
40#include "xfs_ag.h" 39#include "xfs_ag.h"
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index dcd3fdd5c1f7..5da2738b4538 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -29,23 +29,21 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34 33#include "xfs_fs.h"
35#include "xfs_macros.h"
36#include "xfs_types.h" 34#include "xfs_types.h"
37#include "xfs_inum.h"
38#include "xfs_log.h" 35#include "xfs_log.h"
39#include "xfs_sb.h" 36#include "xfs_inum.h"
40#include "xfs_trans.h" 37#include "xfs_trans.h"
38#include "xfs_sb.h"
41#include "xfs_dir.h" 39#include "xfs_dir.h"
42#include "xfs_dir2.h" 40#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 41#include "xfs_dmapi.h"
44#include "xfs_mount.h" 42#include "xfs_mount.h"
45#include "xfs_bmap_btree.h" 43#include "xfs_bmap_btree.h"
46#include "xfs_attr_sf.h"
47#include "xfs_dir_sf.h" 44#include "xfs_dir_sf.h"
48#include "xfs_dir2_sf.h" 45#include "xfs_dir2_sf.h"
46#include "xfs_attr_sf.h"
49#include "xfs_dinode.h" 47#include "xfs_dinode.h"
50#include "xfs_inode.h" 48#include "xfs_inode.h"
51#include "xfs_utils.h" 49#include "xfs_utils.h"
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 52ee2b90b5ed..66eef1beb0e5 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -54,24 +54,10 @@ extern int xfs_error_trap(int);
54 54
55struct xfs_mount; 55struct xfs_mount;
56 56
57extern void 57extern void xfs_error_report(char *tag, int level, struct xfs_mount *mp,
58xfs_error_report( 58 char *fname, int linenum, inst_t *ra);
59 char *tag, 59extern void xfs_corruption_error(char *tag, int level, struct xfs_mount *mp,
60 int level, 60 void *p, char *fname, int linenum, inst_t *ra);
61 struct xfs_mount *mp,
62 char *fname,
63 int linenum,
64 inst_t *ra);
65
66extern void
67xfs_corruption_error(
68 char *tag,
69 int level,
70 struct xfs_mount *mp,
71 void *p,
72 char *fname,
73 int linenum,
74 inst_t *ra);
75 61
76#define XFS_ERROR_REPORT(e, lvl, mp) \ 62#define XFS_ERROR_REPORT(e, lvl, mp) \
77 xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address) 63 xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address)
@@ -84,6 +70,32 @@ xfs_corruption_error(
84#define XFS_ERRLEVEL_HIGH 5 70#define XFS_ERRLEVEL_HIGH 5
85 71
86/* 72/*
73 * Macros to set EFSCORRUPTED & return/branch.
74 */
75#define XFS_WANT_CORRUPTED_GOTO(x,l) \
76 { \
77 int fs_is_ok = (x); \
78 ASSERT(fs_is_ok); \
79 if (unlikely(!fs_is_ok)) { \
80 XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_GOTO", \
81 XFS_ERRLEVEL_LOW, NULL); \
82 error = XFS_ERROR(EFSCORRUPTED); \
83 goto l; \
84 } \
85 }
86
87#define XFS_WANT_CORRUPTED_RETURN(x) \
88 { \
89 int fs_is_ok = (x); \
90 ASSERT(fs_is_ok); \
91 if (unlikely(!fs_is_ok)) { \
92 XFS_ERROR_REPORT("XFS_WANT_CORRUPTED_RETURN", \
93 XFS_ERRLEVEL_LOW, NULL); \
94 return XFS_ERROR(EFSCORRUPTED); \
95 } \
96 }
97
98/*
87 * error injection tags - the labels can be anything you want 99 * error injection tags - the labels can be anything you want
88 * but each tag should have its own unique number 100 * but each tag should have its own unique number
89 */ 101 */
@@ -139,8 +151,8 @@ xfs_corruption_error(
139#define XFS_RANDOM_BMAPIFORMAT XFS_RANDOM_DEFAULT 151#define XFS_RANDOM_BMAPIFORMAT XFS_RANDOM_DEFAULT
140 152
141#if (defined(DEBUG) || defined(INDUCE_IO_ERROR)) 153#if (defined(DEBUG) || defined(INDUCE_IO_ERROR))
142extern int xfs_error_test(int, int *, char *, int, char *, unsigned long); 154extern int xfs_error_test(int, int *, char *, int, char *, unsigned long);
143void xfs_error_test_init(void); 155extern void xfs_error_test_init(void);
144 156
145#define XFS_NUM_INJECT_ERROR 10 157#define XFS_NUM_INJECT_ERROR 10
146 158
@@ -156,12 +168,10 @@ void xfs_error_test_init(void);
156 (rf))) 168 (rf)))
157#endif /* __ANSI_CPP__ */ 169#endif /* __ANSI_CPP__ */
158 170
159int xfs_errortag_add(int error_tag, xfs_mount_t *mp); 171extern int xfs_errortag_add(int error_tag, xfs_mount_t *mp);
160int xfs_errortag_clear(int error_tag, xfs_mount_t *mp); 172extern int xfs_errortag_clear(int error_tag, xfs_mount_t *mp);
161 173extern int xfs_errortag_clearall(xfs_mount_t *mp);
162int xfs_errortag_clearall(xfs_mount_t *mp); 174extern int xfs_errortag_clearall_umount(int64_t fsid, char *fsname, int loud);
163int xfs_errortag_clearall_umount(int64_t fsid, char *fsname,
164 int loud);
165#else 175#else
166#define XFS_TEST_ERROR(expr, mp, tag, rf) (expr) 176#define XFS_TEST_ERROR(expr, mp, tag, rf) (expr)
167#define xfs_errortag_add(tag, mp) (ENOSYS) 177#define xfs_errortag_add(tag, mp) (ENOSYS)
@@ -185,9 +195,9 @@ int xfs_errortag_clearall_umount(int64_t fsid, char *fsname,
185 195
186struct xfs_mount; 196struct xfs_mount;
187/* PRINTFLIKE4 */ 197/* PRINTFLIKE4 */
188void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp, 198extern void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp,
189 char *fmt, ...); 199 char *fmt, ...);
190/* PRINTFLIKE3 */ 200/* PRINTFLIKE3 */
191void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...); 201extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...);
192 202
193#endif /* __XFS_ERROR_H__ */ 203#endif /* __XFS_ERROR_H__ */
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index cc7d1494a45d..f48cc9a7cd5a 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -29,18 +29,11 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * This file contains the implementation of the xfs_efi_log_item
35 * and xfs_efd_log_item items.
36 */
37
38#include "xfs.h" 32#include "xfs.h"
39 33#include "xfs_fs.h"
40#include "xfs_macros.h"
41#include "xfs_types.h" 34#include "xfs_types.h"
42#include "xfs_inum.h"
43#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
44#include "xfs_trans.h" 37#include "xfs_trans.h"
45#include "xfs_buf_item.h" 38#include "xfs_buf_item.h"
46#include "xfs_sb.h" 39#include "xfs_sb.h"
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 67522f2bcee8..411081c0fd7c 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -29,38 +29,37 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
35#include "xfs_bit.h"
36#include "xfs_inum.h" 36#include "xfs_inum.h"
37#include "xfs_log.h" 37#include "xfs_log.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h"
40#include "xfs_dir.h" 41#include "xfs_dir.h"
42#include "xfs_dir2.h"
41#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
42#include "xfs_mount.h" 44#include "xfs_mount.h"
43#include "xfs_ag.h"
44#include "xfs_alloc_btree.h"
45#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
46#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
48#include "xfs_dir_sf.h"
49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dinode.h"
52#include "xfs_inode.h"
53#include "xfs_inode_item.h"
47#include "xfs_btree.h" 54#include "xfs_btree.h"
48#include "xfs_error.h" 55#include "xfs_error.h"
49#include "xfs_alloc.h" 56#include "xfs_alloc.h"
50#include "xfs_ialloc.h" 57#include "xfs_ialloc.h"
51#include "xfs_fsops.h" 58#include "xfs_fsops.h"
52#include "xfs_itable.h" 59#include "xfs_itable.h"
53#include "xfs_rw.h"
54#include "xfs_refcache.h"
55#include "xfs_trans_space.h" 60#include "xfs_trans_space.h"
56#include "xfs_rtalloc.h" 61#include "xfs_rtalloc.h"
57#include "xfs_dir2.h" 62#include "xfs_rw.h"
58#include "xfs_attr_sf.h"
59#include "xfs_dir_sf.h"
60#include "xfs_dir2_sf.h"
61#include "xfs_dinode.h"
62#include "xfs_inode.h"
63#include "xfs_inode_item.h"
64 63
65/* 64/*
66 * File system operations 65 * File system operations
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 02989691e4ab..4fc0e73fd18f 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -29,13 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34 33#include "xfs_fs.h"
35#include "xfs_macros.h"
36#include "xfs_types.h" 34#include "xfs_types.h"
37#include "xfs_inum.h" 35#include "xfs_bit.h"
38#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
39#include "xfs_trans.h" 38#include "xfs_trans.h"
40#include "xfs_sb.h" 39#include "xfs_sb.h"
41#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -43,18 +42,17 @@
43#include "xfs_dir2.h" 42#include "xfs_dir2.h"
44#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
45#include "xfs_mount.h" 44#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 51#include "xfs_dinode.h"
55#include "xfs_inode.h" 52#include "xfs_inode.h"
53#include "xfs_btree.h"
54#include "xfs_ialloc.h"
56#include "xfs_alloc.h" 55#include "xfs_alloc.h"
57#include "xfs_bit.h"
58#include "xfs_rtalloc.h" 56#include "xfs_rtalloc.h"
59#include "xfs_error.h" 57#include "xfs_error.h"
60#include "xfs_bmap.h" 58#include "xfs_bmap.h"
diff --git a/fs/xfs/xfs_ialloc.h b/fs/xfs/xfs_ialloc.h
index db6d0015cecf..fab660dd6d1b 100644
--- a/fs/xfs/xfs_ialloc.h
+++ b/fs/xfs/xfs_ialloc.h
@@ -40,18 +40,8 @@ struct xfs_trans;
40/* 40/*
41 * Allocation parameters for inode allocation. 41 * Allocation parameters for inode allocation.
42 */ 42 */
43#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_INODES) 43#define XFS_IALLOC_INODES(mp) (mp)->m_ialloc_inos
44int xfs_ialloc_inodes(struct xfs_mount *mp); 44#define XFS_IALLOC_BLOCKS(mp) (mp)->m_ialloc_blks
45#define XFS_IALLOC_INODES(mp) xfs_ialloc_inodes(mp)
46#else
47#define XFS_IALLOC_INODES(mp) ((mp)->m_ialloc_inos)
48#endif
49#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_BLOCKS)
50xfs_extlen_t xfs_ialloc_blocks(struct xfs_mount *mp);
51#define XFS_IALLOC_BLOCKS(mp) xfs_ialloc_blocks(mp)
52#else
53#define XFS_IALLOC_BLOCKS(mp) ((mp)->m_ialloc_blks)
54#endif
55 45
56/* 46/*
57 * For small block file systems, move inodes in clusters of this size. 47 * For small block file systems, move inodes in clusters of this size.
@@ -67,31 +57,25 @@ xfs_extlen_t xfs_ialloc_blocks(struct xfs_mount *mp);
67/* 57/*
68 * Make an inode pointer out of the buffer/offset. 58 * Make an inode pointer out of the buffer/offset.
69 */ 59 */
70#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MAKE_IPTR)
71struct xfs_dinode *xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o);
72#define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o) 60#define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o)
73#else 61static inline struct xfs_dinode *
74#define XFS_MAKE_IPTR(mp,b,o) \ 62xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
75 ((xfs_dinode_t *)(xfs_buf_offset(b, (o) << (mp)->m_sb.sb_inodelog))) 63{
76#endif 64 return (xfs_dinode_t *)
65 (xfs_buf_offset(b, o << (mp)->m_sb.sb_inodelog));
66}
77 67
78/* 68/*
79 * Find a free (set) bit in the inode bitmask. 69 * Find a free (set) bit in the inode bitmask.
80 */ 70 */
81#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_FIND_FREE)
82int xfs_ialloc_find_free(xfs_inofree_t *fp);
83#define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp) 71#define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp)
84#else 72static inline int xfs_ialloc_find_free(xfs_inofree_t *fp)
85#define XFS_IALLOC_FIND_FREE(fp) xfs_lowbit64(*(fp)) 73{
86#endif 74 return xfs_lowbit64(*fp);
75}
87 76
88 77
89#ifdef __KERNEL__ 78#ifdef __KERNEL__
90
91/*
92 * Prototypes for visible xfs_ialloc.c routines.
93 */
94
95/* 79/*
96 * Allocate an inode on disk. 80 * Allocate an inode on disk.
97 * Mode is used to tell whether the new inode will need space, and whether 81 * Mode is used to tell whether the new inode will need space, and whether
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c
index 2d4daecec990..a49958d21e87 100644
--- a/fs/xfs/xfs_ialloc_btree.c
+++ b/fs/xfs/xfs_ialloc_btree.c
@@ -29,22 +29,27 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34 33#include "xfs_fs.h"
35#include "xfs_macros.h"
36#include "xfs_types.h" 34#include "xfs_types.h"
37#include "xfs_inum.h" 35#include "xfs_bit.h"
38#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
39#include "xfs_trans.h" 38#include "xfs_trans.h"
40#include "xfs_sb.h" 39#include "xfs_sb.h"
41#include "xfs_ag.h" 40#include "xfs_ag.h"
42#include "xfs_dir.h" 41#include "xfs_dir.h"
42#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
48#include "xfs_dir_sf.h"
49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dinode.h"
52#include "xfs_inode.h"
48#include "xfs_btree.h" 53#include "xfs_btree.h"
49#include "xfs_ialloc.h" 54#include "xfs_ialloc.h"
50#include "xfs_alloc.h" 55#include "xfs_alloc.h"
diff --git a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h
index 44be188674a6..b8c7e72ed837 100644
--- a/fs/xfs/xfs_ialloc_btree.h
+++ b/fs/xfs/xfs_ialloc_btree.h
@@ -51,14 +51,12 @@ typedef __uint64_t xfs_inofree_t;
51#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3) 51#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3)
52#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) 52#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1)
53 53
54#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_MASKN)
55xfs_inofree_t xfs_inobt_maskn(int i, int n);
56#define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n) 54#define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n)
57#else 55static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
58#define XFS_INOBT_MASKN(i,n) \ 56{
59 ((((n) >= XFS_INODES_PER_CHUNK ? \ 57 return (((n) >= XFS_INODES_PER_CHUNK ? \
60 (xfs_inofree_t)0 : ((xfs_inofree_t)1 << (n))) - 1) << (i)) 58 (xfs_inofree_t)0 : ((xfs_inofree_t)1 << (n))) - 1) << (i);
61#endif 59}
62 60
63/* 61/*
64 * Data record structure 62 * Data record structure
@@ -82,237 +80,110 @@ typedef xfs_agblock_t xfs_inobt_ptr_t; /* btree pointer type */
82 /* btree block header type */ 80 /* btree block header type */
83typedef struct xfs_btree_sblock xfs_inobt_block_t; 81typedef struct xfs_btree_sblock xfs_inobt_block_t;
84 82
85#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_INOBT_BLOCK) 83#define XFS_BUF_TO_INOBT_BLOCK(bp) ((xfs_inobt_block_t *)XFS_BUF_PTR(bp))
86xfs_inobt_block_t *xfs_buf_to_inobt_block(struct xfs_buf *bp);
87#define XFS_BUF_TO_INOBT_BLOCK(bp) xfs_buf_to_inobt_block(bp)
88#else
89#define XFS_BUF_TO_INOBT_BLOCK(bp) ((xfs_inobt_block_t *)(XFS_BUF_PTR(bp)))
90#endif
91 84
92/* 85/*
93 * Bit manipulations for ir_free. 86 * Bit manipulations for ir_free.
94 */ 87 */
95#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_MASK)
96xfs_inofree_t xfs_inobt_mask(int i);
97#define XFS_INOBT_MASK(i) xfs_inobt_mask(i)
98#else
99#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i)) 88#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i))
100#endif 89#define XFS_INOBT_IS_FREE(rp,i) \
101#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_FREE) 90 (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
102int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i); 91#define XFS_INOBT_IS_FREE_DISK(rp,i) \
103#define XFS_INOBT_IS_FREE(rp,i) xfs_inobt_is_free(rp,i) 92 ((INT_GET((rp)->ir_free,ARCH_CONVERT) & XFS_INOBT_MASK(i)) != 0)
104#define XFS_INOBT_IS_FREE_DISK(rp,i) xfs_inobt_is_free_disk(rp,i)
105#else
106#define XFS_INOBT_IS_FREE(rp,i) \
107 (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
108#define XFS_INOBT_IS_FREE_DISK(rp,i) \
109 ((INT_GET((rp)->ir_free, ARCH_CONVERT) & XFS_INOBT_MASK(i)) != 0)
110#endif
111#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_SET_FREE)
112void xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i);
113#define XFS_INOBT_SET_FREE(rp,i) xfs_inobt_set_free(rp,i)
114#else
115#define XFS_INOBT_SET_FREE(rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i)) 93#define XFS_INOBT_SET_FREE(rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i))
116#endif
117#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_CLR_FREE)
118void xfs_inobt_clr_free(xfs_inobt_rec_t *rp, int i);
119#define XFS_INOBT_CLR_FREE(rp,i) xfs_inobt_clr_free(rp,i)
120#else
121#define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i)) 94#define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i))
122#endif
123 95
124/* 96/*
125 * Real block structures have a size equal to the disk block size. 97 * Real block structures have a size equal to the disk block size.
126 */ 98 */
127#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_SIZE)
128int xfs_inobt_block_size(int lev, struct xfs_btree_cur *cur);
129#define XFS_INOBT_BLOCK_SIZE(lev,cur) xfs_inobt_block_size(lev,cur)
130#else
131#define XFS_INOBT_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog) 99#define XFS_INOBT_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
132#endif 100#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_inobt_mxr[lev != 0])
133 101#define XFS_INOBT_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_inobt_mnr[lev != 0])
134#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_MAXRECS)
135int xfs_inobt_block_maxrecs(int lev, struct xfs_btree_cur *cur);
136#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) xfs_inobt_block_maxrecs(lev,cur)
137#else
138#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) \
139 ((cur)->bc_mp->m_inobt_mxr[lev != 0])
140#endif
141#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_MINRECS)
142int xfs_inobt_block_minrecs(int lev, struct xfs_btree_cur *cur);
143#define XFS_INOBT_BLOCK_MINRECS(lev,cur) xfs_inobt_block_minrecs(lev,cur)
144#else
145#define XFS_INOBT_BLOCK_MINRECS(lev,cur) \
146 ((cur)->bc_mp->m_inobt_mnr[lev != 0])
147#endif
148
149#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_LAST_REC)
150int xfs_inobt_is_last_rec(struct xfs_btree_cur *cur);
151#define XFS_INOBT_IS_LAST_REC(cur) xfs_inobt_is_last_rec(cur)
152#else
153#define XFS_INOBT_IS_LAST_REC(cur) \ 102#define XFS_INOBT_IS_LAST_REC(cur) \
154 ((cur)->bc_ptrs[0] == \ 103 ((cur)->bc_ptrs[0] == INT_GET(XFS_BUF_TO_INOBT_BLOCK((cur)->bc_bufs[0])->bb_numrecs, ARCH_CONVERT))
155 INT_GET(XFS_BUF_TO_INOBT_BLOCK((cur)->bc_bufs[0])->bb_numrecs, ARCH_CONVERT))
156#endif
157 104
158/* 105/*
159 * Maximum number of inode btree levels. 106 * Maximum number of inode btree levels.
160 */ 107 */
161#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IN_MAXLEVELS)
162int xfs_in_maxlevels(struct xfs_mount *mp);
163#define XFS_IN_MAXLEVELS(mp) xfs_in_maxlevels(mp)
164#else
165#define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels) 108#define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels)
166#endif
167 109
168/* 110/*
169 * block numbers in the AG. 111 * block numbers in the AG.
170 */ 112 */
171#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IBT_BLOCK) 113#define XFS_IBT_BLOCK(mp) ((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1))
172xfs_agblock_t xfs_ibt_block(struct xfs_mount *mp); 114#define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1))
173#define XFS_IBT_BLOCK(mp) xfs_ibt_block(mp)
174#else
175#define XFS_IBT_BLOCK(mp) ((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1))
176#endif
177#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_PREALLOC_BLOCKS)
178xfs_agblock_t xfs_prealloc_blocks(struct xfs_mount *mp);
179#define XFS_PREALLOC_BLOCKS(mp) xfs_prealloc_blocks(mp)
180#else
181#define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1))
182#endif
183 115
184/* 116/*
185 * Record, key, and pointer address macros for btree blocks. 117 * Record, key, and pointer address macros for btree blocks.
186 */ 118 */
187#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_REC_ADDR) 119#define XFS_INOBT_REC_ADDR(bb,i,cur) \
188xfs_inobt_rec_t * 120 (XFS_BTREE_REC_ADDR(XFS_INOBT_BLOCK_SIZE(0,cur), xfs_inobt, bb, \
189xfs_inobt_rec_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur); 121 i, XFS_INOBT_BLOCK_MAXRECS(0, cur)))
190#define XFS_INOBT_REC_ADDR(bb,i,cur) xfs_inobt_rec_addr(bb,i,cur) 122#define XFS_INOBT_KEY_ADDR(bb,i,cur) \
191#else 123 (XFS_BTREE_KEY_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, \
192#define XFS_INOBT_REC_ADDR(bb,i,cur) \ 124 i, XFS_INOBT_BLOCK_MAXRECS(1, cur)))
193 XFS_BTREE_REC_ADDR(XFS_INOBT_BLOCK_SIZE(0,cur), xfs_inobt, bb, i, \
194 XFS_INOBT_BLOCK_MAXRECS(0, cur))
195#endif
196
197#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_KEY_ADDR)
198xfs_inobt_key_t *
199xfs_inobt_key_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur);
200#define XFS_INOBT_KEY_ADDR(bb,i,cur) xfs_inobt_key_addr(bb,i,cur)
201#else
202#define XFS_INOBT_KEY_ADDR(bb,i,cur) \
203 XFS_BTREE_KEY_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, i, \
204 XFS_INOBT_BLOCK_MAXRECS(1, cur))
205#endif
206 125
207#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_PTR_ADDR) 126#define XFS_INOBT_PTR_ADDR(bb,i,cur) \
208xfs_inobt_ptr_t * 127 (XFS_BTREE_PTR_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, \
209xfs_inobt_ptr_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur); 128 i, XFS_INOBT_BLOCK_MAXRECS(1, cur)))
210#define XFS_INOBT_PTR_ADDR(bb,i,cur) xfs_inobt_ptr_addr(bb,i,cur)
211#else
212#define XFS_INOBT_PTR_ADDR(bb,i,cur) \
213 XFS_BTREE_PTR_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, i, \
214 XFS_INOBT_BLOCK_MAXRECS(1, cur))
215#endif
216
217/*
218 * Prototypes for externally visible routines.
219 */
220 129
221/* 130/*
222 * Decrement cursor by one record at the level. 131 * Decrement cursor by one record at the level.
223 * For nonzero levels the leaf-ward information is untouched. 132 * For nonzero levels the leaf-ward information is untouched.
224 */ 133 */
225int /* error */ 134extern int xfs_inobt_decrement(struct xfs_btree_cur *cur, int level, int *stat);
226xfs_inobt_decrement(
227 struct xfs_btree_cur *cur, /* btree cursor */
228 int level, /* level in btree, 0 is leaf */
229 int *stat); /* success/failure */
230 135
231/* 136/*
232 * Delete the record pointed to by cur. 137 * Delete the record pointed to by cur.
233 * The cursor refers to the place where the record was (could be inserted) 138 * The cursor refers to the place where the record was (could be inserted)
234 * when the operation returns. 139 * when the operation returns.
235 */ 140 */
236int /* error */ 141extern int xfs_inobt_delete(struct xfs_btree_cur *cur, int *stat);
237xfs_inobt_delete(
238 struct xfs_btree_cur *cur, /* btree cursor */
239 int *stat); /* success/failure */
240 142
241/* 143/*
242 * Get the data from the pointed-to record. 144 * Get the data from the pointed-to record.
243 */ 145 */
244int /* error */ 146extern int xfs_inobt_get_rec(struct xfs_btree_cur *cur, xfs_agino_t *ino,
245xfs_inobt_get_rec( 147 __int32_t *fcnt, xfs_inofree_t *free, int *stat);
246 struct xfs_btree_cur *cur, /* btree cursor */
247 xfs_agino_t *ino, /* output: starting inode of chunk */
248 __int32_t *fcnt, /* output: number of free inodes */
249 xfs_inofree_t *free, /* output: free inode mask */
250 int *stat); /* output: success/failure */
251 148
252/* 149/*
253 * Increment cursor by one record at the level. 150 * Increment cursor by one record at the level.
254 * For nonzero levels the leaf-ward information is untouched. 151 * For nonzero levels the leaf-ward information is untouched.
255 */ 152 */
256int /* error */ 153extern int xfs_inobt_increment(struct xfs_btree_cur *cur, int level, int *stat);
257xfs_inobt_increment(
258 struct xfs_btree_cur *cur, /* btree cursor */
259 int level, /* level in btree, 0 is leaf */
260 int *stat); /* success/failure */
261 154
262/* 155/*
263 * Insert the current record at the point referenced by cur. 156 * Insert the current record at the point referenced by cur.
264 * The cursor may be inconsistent on return if splits have been done. 157 * The cursor may be inconsistent on return if splits have been done.
265 */ 158 */
266int /* error */ 159extern int xfs_inobt_insert(struct xfs_btree_cur *cur, int *stat);
267xfs_inobt_insert(
268 struct xfs_btree_cur *cur, /* btree cursor */
269 int *stat); /* success/failure */
270 160
271/* 161/*
272 * Lookup the record equal to ino in the btree given by cur. 162 * Lookup the record equal to ino in the btree given by cur.
273 */ 163 */
274int /* error */ 164extern int xfs_inobt_lookup_eq(struct xfs_btree_cur *cur, xfs_agino_t ino,
275xfs_inobt_lookup_eq( 165 __int32_t fcnt, xfs_inofree_t free, int *stat);
276 struct xfs_btree_cur *cur, /* btree cursor */
277 xfs_agino_t ino, /* starting inode of chunk */
278 __int32_t fcnt, /* free inode count */
279 xfs_inofree_t free, /* free inode mask */
280 int *stat); /* success/failure */
281 166
282/* 167/*
283 * Lookup the first record greater than or equal to ino 168 * Lookup the first record greater than or equal to ino
284 * in the btree given by cur. 169 * in the btree given by cur.
285 */ 170 */
286int /* error */ 171extern int xfs_inobt_lookup_ge(struct xfs_btree_cur *cur, xfs_agino_t ino,
287xfs_inobt_lookup_ge( 172 __int32_t fcnt, xfs_inofree_t free, int *stat);
288 struct xfs_btree_cur *cur, /* btree cursor */
289 xfs_agino_t ino, /* starting inode of chunk */
290 __int32_t fcnt, /* free inode count */
291 xfs_inofree_t free, /* free inode mask */
292 int *stat); /* success/failure */
293 173
294/* 174/*
295 * Lookup the first record less than or equal to ino 175 * Lookup the first record less than or equal to ino
296 * in the btree given by cur. 176 * in the btree given by cur.
297 */ 177 */
298int /* error */ 178extern int xfs_inobt_lookup_le(struct xfs_btree_cur *cur, xfs_agino_t ino,
299xfs_inobt_lookup_le( 179 __int32_t fcnt, xfs_inofree_t free, int *stat);
300 struct xfs_btree_cur *cur, /* btree cursor */
301 xfs_agino_t ino, /* starting inode of chunk */
302 __int32_t fcnt, /* free inode count */
303 xfs_inofree_t free, /* free inode mask */
304 int *stat); /* success/failure */
305 180
306/* 181/*
307 * Update the record referred to by cur, to the value given 182 * Update the record referred to by cur, to the value given
308 * by [ino, fcnt, free]. 183 * by [ino, fcnt, free].
309 * This either works (return 0) or gets an EFSCORRUPTED error. 184 * This either works (return 0) or gets an EFSCORRUPTED error.
310 */ 185 */
311int /* error */ 186extern int xfs_inobt_update(struct xfs_btree_cur *cur, xfs_agino_t ino,
312xfs_inobt_update( 187 __int32_t fcnt, xfs_inofree_t free);
313 struct xfs_btree_cur *cur, /* btree cursor */
314 xfs_agino_t ino, /* starting inode of chunk */
315 __int32_t fcnt, /* free inode count */
316 xfs_inofree_t free); /* free inode mask */
317 188
318#endif /* __XFS_IALLOC_BTREE_H__ */ 189#endif /* __XFS_IALLOC_BTREE_H__ */
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index 0d9ae8fb4138..f925335e4553 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -29,15 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include <linux/delay.h>
34
35#include "xfs.h" 32#include "xfs.h"
36 33#include "xfs_fs.h"
37#include "xfs_macros.h"
38#include "xfs_types.h" 34#include "xfs_types.h"
39#include "xfs_inum.h" 35#include "xfs_bit.h"
40#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
41#include "xfs_trans.h" 38#include "xfs_trans.h"
42#include "xfs_sb.h" 39#include "xfs_sb.h"
43#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -45,19 +42,18 @@
45#include "xfs_dir2.h" 42#include "xfs_dir2.h"
46#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
47#include "xfs_mount.h" 44#include "xfs_mount.h"
48#include "xfs_alloc_btree.h"
49#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
50#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
51#include "xfs_btree.h"
52#include "xfs_ialloc.h"
53#include "xfs_attr_sf.h"
54#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
55#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
56#include "xfs_dinode.h" 51#include "xfs_dinode.h"
57#include "xfs_inode.h" 52#include "xfs_inode.h"
53#include "xfs_btree.h"
54#include "xfs_ialloc.h"
58#include "xfs_quota.h" 55#include "xfs_quota.h"
59#include "xfs_utils.h" 56#include "xfs_utils.h"
60#include "xfs_bit.h"
61 57
62/* 58/*
63 * Initialize the inode hash table for the newly mounted file system. 59 * Initialize the inode hash table for the newly mounted file system.
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index a648cc8ce96b..edf50b5409fc 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -29,12 +29,13 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_imap.h"
38#include "xfs_trans.h" 39#include "xfs_trans.h"
39#include "xfs_trans_priv.h" 40#include "xfs_trans_priv.h"
40#include "xfs_sb.h" 41#include "xfs_sb.h"
@@ -43,24 +44,22 @@
43#include "xfs_dir2.h" 44#include "xfs_dir2.h"
44#include "xfs_dmapi.h" 45#include "xfs_dmapi.h"
45#include "xfs_mount.h" 46#include "xfs_mount.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 47#include "xfs_bmap_btree.h"
48#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 49#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_imap.h"
51#include "xfs_alloc.h"
52#include "xfs_ialloc.h"
53#include "xfs_attr_sf.h"
54#include "xfs_dir_sf.h" 50#include "xfs_dir_sf.h"
55#include "xfs_dir2_sf.h" 51#include "xfs_dir2_sf.h"
52#include "xfs_attr_sf.h"
56#include "xfs_dinode.h" 53#include "xfs_dinode.h"
57#include "xfs_inode_item.h"
58#include "xfs_inode.h" 54#include "xfs_inode.h"
59#include "xfs_bmap.h"
60#include "xfs_buf_item.h" 55#include "xfs_buf_item.h"
56#include "xfs_inode_item.h"
57#include "xfs_btree.h"
58#include "xfs_alloc.h"
59#include "xfs_ialloc.h"
60#include "xfs_bmap.h"
61#include "xfs_rw.h" 61#include "xfs_rw.h"
62#include "xfs_error.h" 62#include "xfs_error.h"
63#include "xfs_bit.h"
64#include "xfs_utils.h" 63#include "xfs_utils.h"
65#include "xfs_dir2_trace.h" 64#include "xfs_dir2_trace.h"
66#include "xfs_quota.h" 65#include "xfs_quota.h"
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 6ec8a0dd84a8..11be922698af 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -33,6 +33,12 @@
33#define __XFS_INODE_H__ 33#define __XFS_INODE_H__
34 34
35/* 35/*
36 * Fork identifiers.
37 */
38#define XFS_DATA_FORK 0
39#define XFS_ATTR_FORK 1
40
41/*
36 * File incore extent information, present for each of data & attr forks. 42 * File incore extent information, present for each of data & attr forks.
37 */ 43 */
38#define XFS_INLINE_EXTS 2 44#define XFS_INLINE_EXTS 2
@@ -311,60 +317,16 @@ typedef struct xfs_inode {
311/* 317/*
312 * Fork handling. 318 * Fork handling.
313 */ 319 */
314#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_PTR) 320#define XFS_IFORK_PTR(ip,w) \
315xfs_ifork_t *xfs_ifork_ptr(xfs_inode_t *ip, int w); 321 ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp)
316#define XFS_IFORK_PTR(ip,w) xfs_ifork_ptr(ip,w)
317#else
318#define XFS_IFORK_PTR(ip,w) ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp)
319#endif
320#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_Q)
321int xfs_ifork_q(xfs_inode_t *ip);
322#define XFS_IFORK_Q(ip) xfs_ifork_q(ip)
323#else
324#define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d) 322#define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d)
325#endif
326#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_DSIZE)
327int xfs_ifork_dsize(xfs_inode_t *ip);
328#define XFS_IFORK_DSIZE(ip) xfs_ifork_dsize(ip)
329#else
330#define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount) 323#define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount)
331#endif
332#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_ASIZE)
333int xfs_ifork_asize(xfs_inode_t *ip);
334#define XFS_IFORK_ASIZE(ip) xfs_ifork_asize(ip)
335#else
336#define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount) 324#define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount)
337#endif
338#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_SIZE)
339int xfs_ifork_size(xfs_inode_t *ip, int w);
340#define XFS_IFORK_SIZE(ip,w) xfs_ifork_size(ip,w)
341#else
342#define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w) 325#define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w)
343#endif
344#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FORMAT)
345int xfs_ifork_format(xfs_inode_t *ip, int w);
346#define XFS_IFORK_FORMAT(ip,w) xfs_ifork_format(ip,w)
347#else
348#define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w) 326#define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w)
349#endif
350#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FMT_SET)
351void xfs_ifork_fmt_set(xfs_inode_t *ip, int w, int n);
352#define XFS_IFORK_FMT_SET(ip,w,n) xfs_ifork_fmt_set(ip,w,n)
353#else
354#define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n) 327#define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n)
355#endif
356#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXTENTS)
357int xfs_ifork_nextents(xfs_inode_t *ip, int w);
358#define XFS_IFORK_NEXTENTS(ip,w) xfs_ifork_nextents(ip,w)
359#else
360#define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w) 328#define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w)
361#endif
362#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXT_SET)
363void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n);
364#define XFS_IFORK_NEXT_SET(ip,w,n) xfs_ifork_next_set(ip,w,n)
365#else
366#define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n) 329#define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n)
367#endif
368 330
369 331
370#ifdef __KERNEL__ 332#ifdef __KERNEL__
@@ -418,28 +380,11 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n);
418#define XFS_ITRUNC_DEFINITE 0x1 380#define XFS_ITRUNC_DEFINITE 0x1
419#define XFS_ITRUNC_MAYBE 0x2 381#define XFS_ITRUNC_MAYBE 0x2
420 382
421#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOV)
422struct vnode *xfs_itov(xfs_inode_t *ip);
423#define XFS_ITOV(ip) xfs_itov(ip)
424#else
425#define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip)) 383#define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip))
426#endif
427#define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip)) 384#define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip))
428#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOBHV)
429struct bhv_desc *xfs_itobhv(xfs_inode_t *ip);
430#define XFS_ITOBHV(ip) xfs_itobhv(ip)
431#else
432#define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc))) 385#define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc)))
433#endif 386#define XFS_BHVTOI(bhvp) ((xfs_inode_t *)((char *)(bhvp) - \
434#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOI) 387 (char *)&(((xfs_inode_t *)0)->i_bhv_desc)))
435xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp);
436#define XFS_BHVTOI(bhvp) xfs_bhvtoi(bhvp)
437#else
438#define XFS_BHVTOI(bhvp) \
439 ((xfs_inode_t *)((char *)(bhvp) - \
440 (char *)&(((xfs_inode_t *)0)->i_bhv_desc)))
441#endif
442
443#define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops) 388#define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops)
444 389
445/* 390/*
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 50e2cadf9091..cebcc2781bbb 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -29,38 +29,32 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * This file contains the implementation of the xfs_inode_log_item.
35 * It contains the item operations used to manipulate the inode log
36 * items as well as utility routines used by the inode specific
37 * transaction routines.
38 */
39#include "xfs.h" 32#include "xfs.h"
40#include "xfs_macros.h" 33#include "xfs_fs.h"
41#include "xfs_types.h" 34#include "xfs_types.h"
42#include "xfs_inum.h" 35#include "xfs_bit.h"
43#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
44#include "xfs_trans.h" 38#include "xfs_trans.h"
45#include "xfs_buf_item.h" 39#include "xfs_buf_item.h"
46#include "xfs_sb.h" 40#include "xfs_sb.h"
41#include "xfs_ag.h"
47#include "xfs_dir.h" 42#include "xfs_dir.h"
48#include "xfs_dir2.h" 43#include "xfs_dir2.h"
49#include "xfs_dmapi.h" 44#include "xfs_dmapi.h"
50#include "xfs_mount.h" 45#include "xfs_mount.h"
51#include "xfs_trans_priv.h" 46#include "xfs_trans_priv.h"
52#include "xfs_ag.h"
53#include "xfs_alloc_btree.h"
54#include "xfs_bmap_btree.h" 47#include "xfs_bmap_btree.h"
48#include "xfs_alloc_btree.h"
55#include "xfs_ialloc_btree.h" 49#include "xfs_ialloc_btree.h"
56#include "xfs_btree.h"
57#include "xfs_ialloc.h"
58#include "xfs_attr_sf.h"
59#include "xfs_dir_sf.h" 50#include "xfs_dir_sf.h"
60#include "xfs_dir2_sf.h" 51#include "xfs_dir2_sf.h"
52#include "xfs_attr_sf.h"
61#include "xfs_dinode.h" 53#include "xfs_dinode.h"
62#include "xfs_inode_item.h"
63#include "xfs_inode.h" 54#include "xfs_inode.h"
55#include "xfs_inode_item.h"
56#include "xfs_btree.h"
57#include "xfs_ialloc.h"
64#include "xfs_rw.h" 58#include "xfs_rw.h"
65 59
66 60
diff --git a/fs/xfs/xfs_inode_item.h b/fs/xfs/xfs_inode_item.h
index d8775e0d6291..61a806ba8fdd 100644
--- a/fs/xfs/xfs_inode_item.h
+++ b/fs/xfs/xfs_inode_item.h
@@ -159,38 +159,33 @@ typedef struct xfs_inode_log_item {
159} xfs_inode_log_item_t; 159} xfs_inode_log_item_t;
160 160
161 161
162#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FDATA)
163int xfs_ilog_fdata(int w);
164#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w) 162#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
165#else 163static inline int xfs_ilog_fdata(int w)
166#define XFS_ILOG_FDATA(w) \ 164{
167 ((w) == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA) 165 return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA);
168#endif 166}
169 167
170#endif /* __KERNEL__ */ 168#endif /* __KERNEL__ */
171 169
172#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FBROOT)
173int xfs_ilog_fbroot(int w);
174#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w) 170#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
175#else 171static inline int xfs_ilog_fbroot(int w)
176#define XFS_ILOG_FBROOT(w) \ 172{
177 ((w) == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT) 173 return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT);
178#endif 174}
179#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FEXT) 175
180int xfs_ilog_fext(int w);
181#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w) 176#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
182#else 177static inline int xfs_ilog_fext(int w)
183#define XFS_ILOG_FEXT(w) \ 178{
184 ((w) == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT) 179 return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
185#endif 180}
186 181
187#ifdef __KERNEL__ 182#ifdef __KERNEL__
188 183
189void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *); 184extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
190void xfs_inode_item_destroy(struct xfs_inode *); 185extern void xfs_inode_item_destroy(struct xfs_inode *);
191void xfs_iflush_done(struct xfs_buf *, xfs_inode_log_item_t *); 186extern void xfs_iflush_done(struct xfs_buf *, xfs_inode_log_item_t *);
192void xfs_istale_done(struct xfs_buf *, xfs_inode_log_item_t *); 187extern void xfs_istale_done(struct xfs_buf *, xfs_inode_log_item_t *);
193void xfs_iflush_abort(struct xfs_inode *); 188extern void xfs_iflush_abort(struct xfs_inode *);
194 189
195#endif /* __KERNEL__ */ 190#endif /* __KERNEL__ */
196 191
diff --git a/fs/xfs/xfs_inum.h b/fs/xfs/xfs_inum.h
index a3af2d5a6eb7..8f70a12d56bc 100644
--- a/fs/xfs/xfs_inum.h
+++ b/fs/xfs/xfs_inum.h
@@ -58,109 +58,31 @@ typedef __uint32_t xfs_intino_t;
58 58
59struct xfs_mount; 59struct xfs_mount;
60 60
61#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_MASK) 61#define XFS_INO_MASK(k) (__uint32_t)((1ULL << (k)) - 1)
62__uint32_t xfs_ino_mask(int k); 62#define XFS_INO_OFFSET_BITS(mp) (mp)->m_sb.sb_inopblog
63#define XFS_INO_MASK(k) xfs_ino_mask(k) 63#define XFS_INO_AGBNO_BITS(mp) (mp)->m_sb.sb_agblklog
64#else 64#define XFS_INO_AGINO_BITS(mp) (mp)->m_agino_log
65#define XFS_INO_MASK(k) ((__uint32_t)((1ULL << (k)) - 1)) 65#define XFS_INO_AGNO_BITS(mp) (mp)->m_agno_log
66#endif 66#define XFS_INO_BITS(mp) \
67#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_OFFSET_BITS) 67 XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)
68int xfs_ino_offset_bits(struct xfs_mount *mp); 68#define XFS_INO_TO_AGNO(mp,i) \
69#define XFS_INO_OFFSET_BITS(mp) xfs_ino_offset_bits(mp)
70#else
71#define XFS_INO_OFFSET_BITS(mp) ((mp)->m_sb.sb_inopblog)
72#endif
73#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGBNO_BITS)
74int xfs_ino_agbno_bits(struct xfs_mount *mp);
75#define XFS_INO_AGBNO_BITS(mp) xfs_ino_agbno_bits(mp)
76#else
77#define XFS_INO_AGBNO_BITS(mp) ((mp)->m_sb.sb_agblklog)
78#endif
79#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGINO_BITS)
80int xfs_ino_agino_bits(struct xfs_mount *mp);
81#define XFS_INO_AGINO_BITS(mp) xfs_ino_agino_bits(mp)
82#else
83#define XFS_INO_AGINO_BITS(mp) ((mp)->m_agino_log)
84#endif
85#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGNO_BITS)
86int xfs_ino_agno_bits(struct xfs_mount *mp);
87#define XFS_INO_AGNO_BITS(mp) xfs_ino_agno_bits(mp)
88#else
89#define XFS_INO_AGNO_BITS(mp) ((mp)->m_agno_log)
90#endif
91#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_BITS)
92int xfs_ino_bits(struct xfs_mount *mp);
93#define XFS_INO_BITS(mp) xfs_ino_bits(mp)
94#else
95#define XFS_INO_BITS(mp) (XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp))
96#endif
97
98#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGNO)
99xfs_agnumber_t xfs_ino_to_agno(struct xfs_mount *mp, xfs_ino_t i);
100#define XFS_INO_TO_AGNO(mp,i) xfs_ino_to_agno(mp,i)
101#else
102#define XFS_INO_TO_AGNO(mp,i) \
103 ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp))) 69 ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))
104#endif 70#define XFS_INO_TO_AGINO(mp,i) \
105#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGINO)
106xfs_agino_t xfs_ino_to_agino(struct xfs_mount *mp, xfs_ino_t i);
107#define XFS_INO_TO_AGINO(mp,i) xfs_ino_to_agino(mp,i)
108#else
109#define XFS_INO_TO_AGINO(mp,i) \
110 ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp))) 71 ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))
111#endif 72#define XFS_INO_TO_AGBNO(mp,i) \
112#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGBNO)
113xfs_agblock_t xfs_ino_to_agbno(struct xfs_mount *mp, xfs_ino_t i);
114#define XFS_INO_TO_AGBNO(mp,i) xfs_ino_to_agbno(mp,i)
115#else
116#define XFS_INO_TO_AGBNO(mp,i) \
117 (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \ 73 (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \
118 XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp))) 74 XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
119#endif 75#define XFS_INO_TO_OFFSET(mp,i) \
120#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_OFFSET)
121int xfs_ino_to_offset(struct xfs_mount *mp, xfs_ino_t i);
122#define XFS_INO_TO_OFFSET(mp,i) xfs_ino_to_offset(mp,i)
123#else
124#define XFS_INO_TO_OFFSET(mp,i) \
125 ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) 76 ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
126#endif 77#define XFS_INO_TO_FSB(mp,i) \
127#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_FSB)
128xfs_fsblock_t xfs_ino_to_fsb(struct xfs_mount *mp, xfs_ino_t i);
129#define XFS_INO_TO_FSB(mp,i) xfs_ino_to_fsb(mp,i)
130#else
131#define XFS_INO_TO_FSB(mp,i) \
132 XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i)) 78 XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
133#endif
134
135#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_INO)
136xfs_ino_t
137xfs_agino_to_ino(struct xfs_mount *mp, xfs_agnumber_t a, xfs_agino_t i);
138#define XFS_AGINO_TO_INO(mp,a,i) xfs_agino_to_ino(mp,a,i)
139#else
140#define XFS_AGINO_TO_INO(mp,a,i) \ 79#define XFS_AGINO_TO_INO(mp,a,i) \
141 (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i)) 80 (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
142#endif
143#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_AGBNO)
144xfs_agblock_t xfs_agino_to_agbno(struct xfs_mount *mp, xfs_agino_t i);
145#define XFS_AGINO_TO_AGBNO(mp,i) xfs_agino_to_agbno(mp,i)
146#else
147#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp)) 81#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp))
148#endif
149#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_OFFSET)
150int xfs_agino_to_offset(struct xfs_mount *mp, xfs_agino_t i);
151#define XFS_AGINO_TO_OFFSET(mp,i) xfs_agino_to_offset(mp,i)
152#else
153#define XFS_AGINO_TO_OFFSET(mp,i) \ 82#define XFS_AGINO_TO_OFFSET(mp,i) \
154 ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) 83 ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
155#endif
156
157#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_OFFBNO_TO_AGINO)
158xfs_agino_t xfs_offbno_to_agino(struct xfs_mount *mp, xfs_agblock_t b, int o);
159#define XFS_OFFBNO_TO_AGINO(mp,b,o) xfs_offbno_to_agino(mp,b,o)
160#else
161#define XFS_OFFBNO_TO_AGINO(mp,b,o) \ 84#define XFS_OFFBNO_TO_AGINO(mp,b,o) \
162 ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o))) 85 ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
163#endif
164 86
165#if XFS_BIG_INUMS 87#if XFS_BIG_INUMS
166#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL)) 88#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL))
diff --git a/fs/xfs/xfs_iocore.c b/fs/xfs/xfs_iocore.c
index 414ec496845f..6bdd0dcbe398 100644
--- a/fs/xfs/xfs_iocore.c
+++ b/fs/xfs/xfs_iocore.c
@@ -29,12 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -42,22 +42,21 @@
42#include "xfs_dir2.h" 42#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
48#include "xfs_itable.h"
49#include "xfs_btree.h"
50#include "xfs_alloc.h"
51#include "xfs_ialloc.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 51#include "xfs_dinode.h"
56#include "xfs_inode_item.h"
57#include "xfs_inode.h" 52#include "xfs_inode.h"
53#include "xfs_inode_item.h"
54#include "xfs_itable.h"
55#include "xfs_btree.h"
56#include "xfs_alloc.h"
57#include "xfs_ialloc.h"
58#include "xfs_bmap.h" 58#include "xfs_bmap.h"
59#include "xfs_error.h" 59#include "xfs_error.h"
60#include "xfs_bit.h"
61#include "xfs_rw.h" 60#include "xfs_rw.h"
62#include "xfs_quota.h" 61#include "xfs_quota.h"
63#include "xfs_trans_space.h" 62#include "xfs_trans_space.h"
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index d0f5be63cddb..1ba0d71349c8 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -29,12 +29,11 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34
35#include "xfs_fs.h" 33#include "xfs_fs.h"
36#include "xfs_inum.h" 34#include "xfs_bit.h"
37#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
38#include "xfs_trans.h" 37#include "xfs_trans.h"
39#include "xfs_sb.h" 38#include "xfs_sb.h"
40#include "xfs_ag.h" 39#include "xfs_ag.h"
@@ -44,16 +43,16 @@
44#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
45#include "xfs_quota.h" 44#include "xfs_quota.h"
46#include "xfs_mount.h" 45#include "xfs_mount.h"
47#include "xfs_alloc_btree.h"
48#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
47#include "xfs_alloc_btree.h"
49#include "xfs_ialloc_btree.h" 48#include "xfs_ialloc_btree.h"
50#include "xfs_btree.h"
51#include "xfs_ialloc.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 49#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 50#include "xfs_dir2_sf.h"
51#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 52#include "xfs_dinode.h"
56#include "xfs_inode.h" 53#include "xfs_inode.h"
54#include "xfs_ialloc.h"
55#include "xfs_btree.h"
57#include "xfs_bmap.h" 56#include "xfs_bmap.h"
58#include "xfs_bit.h" 57#include "xfs_bit.h"
59#include "xfs_rtalloc.h" 58#include "xfs_rtalloc.h"
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 8fbc8d378188..abac0399ca4b 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -29,31 +29,31 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h"
40#include "xfs_dir.h" 41#include "xfs_dir.h"
41#include "xfs_dir2.h" 42#include "xfs_dir2.h"
42#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
43#include "xfs_mount.h" 44#include "xfs_mount.h"
44#include "xfs_ag.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
48#include "xfs_btree.h"
49#include "xfs_attr_sf.h"
50#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
51#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
52#include "xfs_dinode.h" 51#include "xfs_dinode.h"
53#include "xfs_inode.h" 52#include "xfs_inode.h"
54#include "xfs_ialloc.h" 53#include "xfs_ialloc.h"
55#include "xfs_itable.h" 54#include "xfs_itable.h"
56#include "xfs_error.h" 55#include "xfs_error.h"
56#include "xfs_btree.h"
57 57
58#ifndef HAVE_USERACC 58#ifndef HAVE_USERACC
59#define useracc(ubuffer, size, flags, foo) (0) 59#define useracc(ubuffer, size, flags, foo) (0)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index fcde2a2fc457..97e2a3b0ca1f 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -29,30 +29,33 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * High level interface routines for log manager
35 */
36
37#include "xfs.h" 32#include "xfs.h"
38#include "xfs_macros.h" 33#include "xfs_fs.h"
39#include "xfs_types.h" 34#include "xfs_types.h"
40#include "xfs_inum.h" 35#include "xfs_bit.h"
41#include "xfs_ag.h"
42#include "xfs_sb.h"
43#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
44#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h"
40#include "xfs_ag.h"
45#include "xfs_dir.h" 41#include "xfs_dir.h"
42#include "xfs_dir2.h"
46#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
47#include "xfs_mount.h" 44#include "xfs_mount.h"
48#include "xfs_error.h" 45#include "xfs_error.h"
49#include "xfs_log_priv.h" 46#include "xfs_log_priv.h"
50#include "xfs_buf_item.h" 47#include "xfs_buf_item.h"
48#include "xfs_bmap_btree.h"
51#include "xfs_alloc_btree.h" 49#include "xfs_alloc_btree.h"
50#include "xfs_ialloc_btree.h"
52#include "xfs_log_recover.h" 51#include "xfs_log_recover.h"
53#include "xfs_bit.h"
54#include "xfs_rw.h"
55#include "xfs_trans_priv.h" 52#include "xfs_trans_priv.h"
53#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h"
55#include "xfs_attr_sf.h"
56#include "xfs_dinode.h"
57#include "xfs_inode.h"
58#include "xfs_rw.h"
56 59
57 60
58#define xlog_write_adv_cnt(ptr, len, off, bytes) \ 61#define xlog_write_adv_cnt(ptr, len, off, bytes) \
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index a884cea82fca..bec421a735f3 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -35,6 +35,7 @@
35struct xfs_buf; 35struct xfs_buf;
36struct ktrace; 36struct ktrace;
37struct log; 37struct log;
38struct xlog_ticket;
38struct xfs_buf_cancel; 39struct xfs_buf_cancel;
39struct xfs_mount; 40struct xfs_mount;
40 41
@@ -120,77 +121,6 @@ struct xfs_mount;
120 ((i) >> 24) 121 ((i) >> 24)
121#endif 122#endif
122 123
123#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XLOG_GRANT_SUB_SPACE)
124void xlog_grant_sub_space(struct log *log, int bytes, int type);
125#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \
126 xlog_grant_sub_space(log,bytes,type)
127#else
128#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \
129 { \
130 if (type == 'w') { \
131 (log)->l_grant_write_bytes -= (bytes); \
132 if ((log)->l_grant_write_bytes < 0) { \
133 (log)->l_grant_write_bytes += (log)->l_logsize; \
134 (log)->l_grant_write_cycle--; \
135 } \
136 } else { \
137 (log)->l_grant_reserve_bytes -= (bytes); \
138 if ((log)->l_grant_reserve_bytes < 0) { \
139 (log)->l_grant_reserve_bytes += (log)->l_logsize;\
140 (log)->l_grant_reserve_cycle--; \
141 } \
142 } \
143 }
144#endif
145#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XLOG_GRANT_ADD_SPACE)
146void xlog_grant_add_space(struct log *log, int bytes, int type);
147#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \
148 xlog_grant_add_space(log,bytes,type)
149#else
150#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \
151 { \
152 if (type == 'w') { \
153 (log)->l_grant_write_bytes += (bytes); \
154 if ((log)->l_grant_write_bytes > (log)->l_logsize) { \
155 (log)->l_grant_write_bytes -= (log)->l_logsize; \
156 (log)->l_grant_write_cycle++; \
157 } \
158 } else { \
159 (log)->l_grant_reserve_bytes += (bytes); \
160 if ((log)->l_grant_reserve_bytes > (log)->l_logsize) { \
161 (log)->l_grant_reserve_bytes -= (log)->l_logsize;\
162 (log)->l_grant_reserve_cycle++; \
163 } \
164 } \
165 }
166#endif
167#define XLOG_INS_TICKETQ(q,tic) \
168 { \
169 if (q) { \
170 (tic)->t_next = (q); \
171 (tic)->t_prev = (q)->t_prev; \
172 (q)->t_prev->t_next = (tic); \
173 (q)->t_prev = (tic); \
174 } else { \
175 (tic)->t_prev = (tic)->t_next = (tic); \
176 (q) = (tic); \
177 } \
178 (tic)->t_flags |= XLOG_TIC_IN_Q; \
179 }
180#define XLOG_DEL_TICKETQ(q,tic) \
181 { \
182 if ((tic) == (tic)->t_next) { \
183 (q) = NULL; \
184 } else { \
185 (q) = (tic)->t_next; \
186 (tic)->t_next->t_prev = (tic)->t_prev; \
187 (tic)->t_prev->t_next = (tic)->t_next; \
188 } \
189 (tic)->t_next = (tic)->t_prev = NULL; \
190 (tic)->t_flags &= ~XLOG_TIC_IN_Q; \
191 }
192
193
194#define GRANT_LOCK(log) mutex_spinlock(&(log)->l_grant_lock) 124#define GRANT_LOCK(log) mutex_spinlock(&(log)->l_grant_lock)
195#define GRANT_UNLOCK(log, s) mutex_spinunlock(&(log)->l_grant_lock, s) 125#define GRANT_UNLOCK(log, s) mutex_spinunlock(&(log)->l_grant_lock, s)
196#define LOG_LOCK(log) mutex_spinlock(&(log)->l_icloglock) 126#define LOG_LOCK(log) mutex_spinlock(&(log)->l_icloglock)
@@ -576,6 +506,75 @@ typedef struct log {
576 * alignment mask */ 506 * alignment mask */
577} xlog_t; 507} xlog_t;
578 508
509#define XLOG_GRANT_SUB_SPACE(log,bytes,type) \
510 xlog_grant_sub_space(log,bytes,type)
511static inline void xlog_grant_sub_space(struct log *log, int bytes, int type)
512{
513 if (type == 'w') { \
514 (log)->l_grant_write_bytes -= (bytes); \
515 if ((log)->l_grant_write_bytes < 0) { \
516 (log)->l_grant_write_bytes += (log)->l_logsize; \
517 (log)->l_grant_write_cycle--; \
518 } \
519 } else { \
520 (log)->l_grant_reserve_bytes -= (bytes); \
521 if ((log)->l_grant_reserve_bytes < 0) { \
522 (log)->l_grant_reserve_bytes += (log)->l_logsize;\
523 (log)->l_grant_reserve_cycle--; \
524 } \
525 } \
526}
527
528#define XLOG_GRANT_ADD_SPACE(log,bytes,type) \
529 xlog_grant_add_space(log,bytes,type)
530static inline void
531xlog_grant_add_space(struct log *log, int bytes, int type)
532{
533 if (type == 'w') { \
534 (log)->l_grant_write_bytes += (bytes); \
535 if ((log)->l_grant_write_bytes > (log)->l_logsize) { \
536 (log)->l_grant_write_bytes -= (log)->l_logsize; \
537 (log)->l_grant_write_cycle++; \
538 } \
539 } else { \
540 (log)->l_grant_reserve_bytes += (bytes); \
541 if ((log)->l_grant_reserve_bytes > (log)->l_logsize) { \
542 (log)->l_grant_reserve_bytes -= (log)->l_logsize;\
543 (log)->l_grant_reserve_cycle++; \
544 } \
545 } \
546}
547
548#define XLOG_INS_TICKETQ(q, tic) xlog_ins_ticketq(q, tic)
549static inline void
550xlog_ins_ticketq(struct xlog_ticket *q, struct xlog_ticket *tic)
551{ \
552 if (q) { \
553 (tic)->t_next = (q); \
554 (tic)->t_prev = (q)->t_prev; \
555 (q)->t_prev->t_next = (tic); \
556 (q)->t_prev = (tic); \
557 } else { \
558 (tic)->t_prev = (tic)->t_next = (tic); \
559 (q) = (tic); \
560 } \
561 (tic)->t_flags |= XLOG_TIC_IN_Q; \
562}
563
564#define XLOG_DEL_TICKETQ(q, tic) xlog_del_ticketq(q, tic)
565static inline void
566xlog_del_ticketq(struct xlog_ticket *q, struct xlog_ticket *tic)
567{ \
568 if ((tic) == (tic)->t_next) { \
569 (q) = NULL; \
570 } else { \
571 (q) = (tic)->t_next; \
572 (tic)->t_next->t_prev = (tic)->t_prev; \
573 (tic)->t_prev->t_next = (tic)->t_next; \
574 } \
575 (tic)->t_next = (tic)->t_prev = NULL; \
576 (tic)->t_flags &= ~XLOG_TIC_IN_Q; \
577}
579 578
580/* common routines */ 579/* common routines */
581extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp); 580extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp);
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 212c5411595e..f61dcd1b8e3b 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -29,38 +29,37 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
38#include "xfs_ag.h" 37#include "xfs_inum.h"
39#include "xfs_sb.h"
40#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h"
40#include "xfs_ag.h"
41#include "xfs_dir.h" 41#include "xfs_dir.h"
42#include "xfs_dir2.h" 42#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_error.h" 45#include "xfs_error.h"
46#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
47#include "xfs_alloc.h" 47#include "xfs_alloc_btree.h"
48#include "xfs_attr_sf.h" 48#include "xfs_ialloc_btree.h"
49#include "xfs_dir_sf.h" 49#include "xfs_dir_sf.h"
50#include "xfs_dir2_sf.h" 50#include "xfs_dir2_sf.h"
51#include "xfs_attr_sf.h"
51#include "xfs_dinode.h" 52#include "xfs_dinode.h"
52#include "xfs_imap.h"
53#include "xfs_inode_item.h"
54#include "xfs_inode.h" 53#include "xfs_inode.h"
55#include "xfs_ialloc_btree.h" 54#include "xfs_inode_item.h"
55#include "xfs_imap.h"
56#include "xfs_alloc.h"
56#include "xfs_ialloc.h" 57#include "xfs_ialloc.h"
57#include "xfs_log_priv.h" 58#include "xfs_log_priv.h"
58#include "xfs_buf_item.h" 59#include "xfs_buf_item.h"
59#include "xfs_alloc_btree.h"
60#include "xfs_log_recover.h" 60#include "xfs_log_recover.h"
61#include "xfs_extfree_item.h" 61#include "xfs_extfree_item.h"
62#include "xfs_trans_priv.h" 62#include "xfs_trans_priv.h"
63#include "xfs_bit.h"
64#include "xfs_quota.h" 63#include "xfs_quota.h"
65#include "xfs_rw.h" 64#include "xfs_rw.h"
66 65
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 4f26172a163e..52542c5d7a32 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -29,12 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -42,21 +42,20 @@
42#include "xfs_dir2.h" 42#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
48#include "xfs_btree.h"
49#include "xfs_ialloc.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
52#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
53#include "xfs_dinode.h" 51#include "xfs_dinode.h"
54#include "xfs_inode.h" 52#include "xfs_inode.h"
53#include "xfs_btree.h"
54#include "xfs_ialloc.h"
55#include "xfs_alloc.h" 55#include "xfs_alloc.h"
56#include "xfs_rtalloc.h" 56#include "xfs_rtalloc.h"
57#include "xfs_bmap.h" 57#include "xfs_bmap.h"
58#include "xfs_error.h" 58#include "xfs_error.h"
59#include "xfs_bit.h"
60#include "xfs_rw.h" 59#include "xfs_rw.h"
61#include "xfs_quota.h" 60#include "xfs_quota.h"
62#include "xfs_fsops.h" 61#include "xfs_fsops.h"
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 7341f4984c08..0567ee2164fa 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -80,6 +80,9 @@ struct xfs_iocore;
80struct xfs_bmbt_irec; 80struct xfs_bmbt_irec;
81struct xfs_bmap_free; 81struct xfs_bmap_free;
82 82
83extern struct vfsops xfs_vfsops;
84extern struct vnodeops xfs_vnodeops;
85
83#define AIL_LOCK_T lock_t 86#define AIL_LOCK_T lock_t
84#define AIL_LOCKINIT(x,y) spinlock_init(x,y) 87#define AIL_LOCKINIT(x,y) spinlock_init(x,y)
85#define AIL_LOCK_DESTROY(x) spinlock_destroy(x) 88#define AIL_LOCK_DESTROY(x) spinlock_destroy(x)
@@ -503,57 +506,41 @@ xfs_preferred_iosize(xfs_mount_t *mp)
503/* 506/*
504 * Macros for getting from mount to vfs and back. 507 * Macros for getting from mount to vfs and back.
505 */ 508 */
506#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MTOVFS)
507struct vfs *xfs_mtovfs(xfs_mount_t *mp);
508#define XFS_MTOVFS(mp) xfs_mtovfs(mp) 509#define XFS_MTOVFS(mp) xfs_mtovfs(mp)
509#else 510static inline struct vfs *xfs_mtovfs(xfs_mount_t *mp)
510#define XFS_MTOVFS(mp) (bhvtovfs(&(mp)->m_bhv)) 511{
511#endif 512 return bhvtovfs(&mp->m_bhv);
512#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOM) 513}
513xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp);
514#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp)
515#else
516#define XFS_BHVTOM(bdp) ((xfs_mount_t *)BHV_PDATA(bdp))
517#endif
518#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_VFSTOM)
519xfs_mount_t *xfs_vfstom(vfs_t *vfs);
520#define XFS_VFSTOM(vfs) xfs_vfstom(vfs)
521#else
522#define XFS_VFSTOM(vfs) \
523 (XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfs), &xfs_vfsops)))
524#endif
525 514
515#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp)
516static inline xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp)
517{
518 return (xfs_mount_t *)BHV_PDATA(bdp);
519}
526 520
527/* 521#define XFS_VFSTOM(vfs) xfs_vfstom(vfs)
528 * Moved here from xfs_ag.h to avoid reordering header files 522static inline xfs_mount_t *xfs_vfstom(vfs_t *vfs)
529 */ 523{
524 return XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfs), &xfs_vfsops));
525}
530 526
531#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGNO)
532xfs_agnumber_t xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d);
533#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d) 527#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d)
534#else 528static inline xfs_agnumber_t
535 529xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d)
536static inline xfs_agnumber_t XFS_DADDR_TO_AGNO(xfs_mount_t *mp, xfs_daddr_t d)
537{ 530{
538 d = XFS_BB_TO_FSBT(mp, d); 531 xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d);
539 do_div(d, mp->m_sb.sb_agblocks); 532 do_div(ld, mp->m_sb.sb_agblocks);
540 return (xfs_agnumber_t) d; 533 return (xfs_agnumber_t) ld;
541} 534}
542 535
543#endif
544#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGBNO)
545xfs_agblock_t xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d);
546#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d) 536#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d)
547#else 537static inline xfs_agblock_t
548 538xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
549static inline xfs_agblock_t XFS_DADDR_TO_AGBNO(xfs_mount_t *mp, xfs_daddr_t d)
550{ 539{
551 d = XFS_BB_TO_FSBT(mp, d); 540 xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d);
552 return (xfs_agblock_t) do_div(d, mp->m_sb.sb_agblocks); 541 return (xfs_agblock_t) do_div(ld, mp->m_sb.sb_agblocks);
553} 542}
554 543
555#endif
556
557/* 544/*
558 * This structure is for use by the xfs_mod_incore_sb_batch() routine. 545 * This structure is for use by the xfs_mod_incore_sb_batch() routine.
559 */ 546 */
@@ -589,9 +576,6 @@ extern int xfs_sync_inodes(xfs_mount_t *, int, int, int *);
589extern xfs_agnumber_t xfs_initialize_perag(xfs_mount_t *, xfs_agnumber_t); 576extern xfs_agnumber_t xfs_initialize_perag(xfs_mount_t *, xfs_agnumber_t);
590extern void xfs_xlatesb(void *, struct xfs_sb *, int, __int64_t); 577extern void xfs_xlatesb(void *, struct xfs_sb *, int, __int64_t);
591 578
592extern struct vfsops xfs_vfsops;
593extern struct vnodeops xfs_vnodeops;
594
595extern struct xfs_dmops xfs_dmcore_stub; 579extern struct xfs_dmops xfs_dmcore_stub;
596extern struct xfs_qmops xfs_qmcore_stub; 580extern struct xfs_qmops xfs_qmcore_stub;
597extern struct xfs_ioops xfs_iocore_xfs; 581extern struct xfs_ioops xfs_iocore_xfs;
diff --git a/fs/xfs/xfs_qmops.c b/fs/xfs/xfs_qmops.c
index a6cd6324e946..ac14d26fa9c4 100644
--- a/fs/xfs/xfs_qmops.c
+++ b/fs/xfs/xfs_qmops.c
@@ -30,11 +30,10 @@
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32#include "xfs.h" 32#include "xfs.h"
33 33#include "xfs_fs.h"
34#include "xfs_macros.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h"
37#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
38#include "xfs_trans.h" 37#include "xfs_trans.h"
39#include "xfs_sb.h" 38#include "xfs_sb.h"
40#include "xfs_ag.h" 39#include "xfs_ag.h"
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c
index 1c3599df0cc1..135172414582 100644
--- a/fs/xfs/xfs_rename.c
+++ b/fs/xfs/xfs_rename.c
@@ -29,32 +29,31 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h"
37#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
38#include "xfs_trans.h" 37#include "xfs_trans.h"
39#include "xfs_sb.h" 38#include "xfs_sb.h"
40#include "xfs_dir.h" 39#include "xfs_dir.h"
41#include "xfs_dir2.h" 40#include "xfs_dir2.h"
42#include "xfs_dmapi.h" 41#include "xfs_dmapi.h"
43#include "xfs_mount.h" 42#include "xfs_mount.h"
43#include "xfs_da_btree.h"
44#include "xfs_bmap_btree.h" 44#include "xfs_bmap_btree.h"
45#include "xfs_attr_sf.h"
46#include "xfs_dir_sf.h" 45#include "xfs_dir_sf.h"
47#include "xfs_dir2_sf.h" 46#include "xfs_dir2_sf.h"
47#include "xfs_attr_sf.h"
48#include "xfs_dinode.h" 48#include "xfs_dinode.h"
49#include "xfs_inode_item.h"
50#include "xfs_inode.h" 49#include "xfs_inode.h"
50#include "xfs_inode_item.h"
51#include "xfs_bmap.h" 51#include "xfs_bmap.h"
52#include "xfs_error.h" 52#include "xfs_error.h"
53#include "xfs_quota.h" 53#include "xfs_quota.h"
54#include "xfs_refcache.h" 54#include "xfs_refcache.h"
55#include "xfs_utils.h" 55#include "xfs_utils.h"
56#include "xfs_trans_space.h" 56#include "xfs_trans_space.h"
57#include "xfs_da_btree.h"
58#include "xfs_dir_leaf.h" 57#include "xfs_dir_leaf.h"
59 58
60 59
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 2c37822d1012..145f916538a1 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -29,16 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33/*
34 * Free realtime space allocation for XFS.
35 */
36
37#include "xfs.h" 32#include "xfs.h"
38#include "xfs_macros.h" 33#include "xfs_fs.h"
39#include "xfs_types.h" 34#include "xfs_types.h"
40#include "xfs_inum.h" 35#include "xfs_bit.h"
41#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
42#include "xfs_trans.h" 38#include "xfs_trans.h"
43#include "xfs_sb.h" 39#include "xfs_sb.h"
44#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -46,19 +42,18 @@
46#include "xfs_dir2.h" 42#include "xfs_dir2.h"
47#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
48#include "xfs_mount.h" 44#include "xfs_mount.h"
49#include "xfs_alloc_btree.h"
50#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
51#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
52#include "xfs_btree.h"
53#include "xfs_ialloc.h"
54#include "xfs_attr_sf.h"
55#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
56#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
57#include "xfs_dinode.h" 51#include "xfs_dinode.h"
58#include "xfs_inode.h" 52#include "xfs_inode.h"
53#include "xfs_btree.h"
54#include "xfs_ialloc.h"
59#include "xfs_alloc.h" 55#include "xfs_alloc.h"
60#include "xfs_bmap.h" 56#include "xfs_bmap.h"
61#include "xfs_bit.h"
62#include "xfs_rtalloc.h" 57#include "xfs_rtalloc.h"
63#include "xfs_fsops.h" 58#include "xfs_fsops.h"
64#include "xfs_error.h" 59#include "xfs_error.h"
diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c
index 31f68cc637b0..075850c999f4 100644
--- a/fs/xfs/xfs_rw.c
+++ b/fs/xfs/xfs_rw.c
@@ -29,12 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -42,20 +42,20 @@
42#include "xfs_dir2.h" 42#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
48#include "xfs_dir_sf.h"
49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dinode.h"
52#include "xfs_inode.h"
53#include "xfs_inode_item.h"
48#include "xfs_itable.h" 54#include "xfs_itable.h"
49#include "xfs_btree.h" 55#include "xfs_btree.h"
50#include "xfs_alloc.h" 56#include "xfs_alloc.h"
51#include "xfs_ialloc.h" 57#include "xfs_ialloc.h"
52#include "xfs_attr.h" 58#include "xfs_attr.h"
53#include "xfs_attr_sf.h"
54#include "xfs_dir_sf.h"
55#include "xfs_dir2_sf.h"
56#include "xfs_dinode.h"
57#include "xfs_inode_item.h"
58#include "xfs_inode.h"
59#include "xfs_bmap.h" 59#include "xfs_bmap.h"
60#include "xfs_acl.h" 60#include "xfs_acl.h"
61#include "xfs_mac.h" 61#include "xfs_mac.h"
diff --git a/fs/xfs/xfs_rw.h b/fs/xfs/xfs_rw.h
index c8b10bf8f530..90233037fab1 100644
--- a/fs/xfs/xfs_rw.h
+++ b/fs/xfs/xfs_rw.h
@@ -68,87 +68,44 @@ struct xfs_mount;
68 * file is a real time file or not, because the bmap code 68 * file is a real time file or not, because the bmap code
69 * does. 69 * does.
70 */ 70 */
71#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_DB)
72xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
73#define XFS_FSB_TO_DB(ip,fsb) xfs_fsb_to_db(ip,fsb) 71#define XFS_FSB_TO_DB(ip,fsb) xfs_fsb_to_db(ip,fsb)
74#else 72static inline xfs_daddr_t
75#define XFS_FSB_TO_DB(ip,fsb) \ 73xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
76 (((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) ? \ 74{
75 return (((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) ? \
77 (xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \ 76 (xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \
78 XFS_FSB_TO_DADDR((ip)->i_mount, (fsb))) 77 XFS_FSB_TO_DADDR((ip)->i_mount, (fsb)));
79#endif 78}
80 79#define XFS_FSB_TO_DB_IO(io,fsb) xfs_fsb_to_db_io(io,fsb)
81#define XFS_FSB_TO_DB_IO(io,fsb) \ 80static inline xfs_daddr_t
82 (((io)->io_flags & XFS_IOCORE_RT) ? \ 81xfs_fsb_to_db_io(struct xfs_iocore *io, xfs_fsblock_t fsb)
82{
83 return (((io)->io_flags & XFS_IOCORE_RT) ? \
83 XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \ 84 XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
84 XFS_FSB_TO_DADDR((io)->io_mount, (fsb))) 85 XFS_FSB_TO_DADDR((io)->io_mount, (fsb)));
86}
85 87
86/* 88/*
87 * Prototypes for functions in xfs_rw.c. 89 * Prototypes for functions in xfs_rw.c.
88 */ 90 */
89 91extern int xfs_write_clear_setuid(struct xfs_inode *ip);
90int 92extern int xfs_bwrite(struct xfs_mount *mp, struct xfs_buf *bp);
91xfs_write_clear_setuid( 93extern int xfs_bioerror(struct xfs_buf *bp);
92 struct xfs_inode *ip); 94extern int xfs_bioerror_relse(struct xfs_buf *bp);
93 95extern int xfs_read_buf(struct xfs_mount *mp, xfs_buftarg_t *btp,
94int 96 xfs_daddr_t blkno, int len, uint flags,
95xfs_bwrite( 97 struct xfs_buf **bpp);
96 struct xfs_mount *mp, 98extern void xfs_ioerror_alert(char *func, struct xfs_mount *mp,
97 struct xfs_buf *bp); 99 xfs_buf_t *bp, xfs_daddr_t blkno);
98
99int
100xfs_bioerror(
101 struct xfs_buf *b);
102
103int
104xfs_bioerror_relse(
105 struct xfs_buf *b);
106
107int
108xfs_read_buf(
109 struct xfs_mount *mp,
110 xfs_buftarg_t *target,
111 xfs_daddr_t blkno,
112 int len,
113 uint flags,
114 struct xfs_buf **bpp);
115
116void
117xfs_ioerror_alert(
118 char *func,
119 struct xfs_mount *mp,
120 xfs_buf_t *bp,
121 xfs_daddr_t blkno);
122
123 100
124/* 101/*
125 * Prototypes for functions in xfs_vnodeops.c. 102 * Prototypes for functions in xfs_vnodeops.c.
126 */ 103 */
127 104extern int xfs_rwlock(bhv_desc_t *bdp, vrwlock_t write_lock);
128int 105extern void xfs_rwunlock(bhv_desc_t *bdp, vrwlock_t write_lock);
129xfs_rwlock( 106extern int xfs_change_file_space(bhv_desc_t *bdp, int cmd, xfs_flock64_t *bf,
130 bhv_desc_t *bdp, 107 xfs_off_t offset, cred_t *credp, int flags);
131 vrwlock_t write_lock); 108extern int xfs_set_dmattrs(bhv_desc_t *bdp, u_int evmask, u_int16_t state,
132 109 cred_t *credp);
133void
134xfs_rwunlock(
135 bhv_desc_t *bdp,
136 vrwlock_t write_lock);
137
138int
139xfs_change_file_space(
140 bhv_desc_t *bdp,
141 int cmd,
142 xfs_flock64_t *bf,
143 xfs_off_t offset,
144 cred_t *credp,
145 int flags);
146
147int
148xfs_set_dmattrs(
149 bhv_desc_t *bdp,
150 u_int evmask,
151 u_int16_t state,
152 cred_t *credp);
153 110
154#endif /* __XFS_RW_H__ */ 111#endif /* __XFS_RW_H__ */
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h
index 01c5a5ff230e..a7b2542fd7ba 100644
--- a/fs/xfs/xfs_sb.h
+++ b/fs/xfs/xfs_sb.h
@@ -241,42 +241,33 @@ typedef enum {
241 */ 241 */
242#define XFS_SB_MAX_SHARED_VN 0 242#define XFS_SB_MAX_SHARED_VN 0
243 243
244#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_NUM)
245int xfs_sb_version_num(xfs_sb_t *sbp);
246#define XFS_SB_VERSION_NUM(sbp) xfs_sb_version_num(sbp)
247#else
248#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) 244#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
249#endif
250 245
251#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_GOOD_VERSION)
252int xfs_sb_good_version(xfs_sb_t *sbp);
253#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp) 246#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp)
254#else
255#define XFS_SB_GOOD_VERSION_INT(sbp) \
256 ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \
257 ((sbp)->sb_versionnum <= XFS_SB_VERSION_3)) || \
258 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
259 !(((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
260 (((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
261 ((sbp)->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))
262
263#ifdef __KERNEL__ 247#ifdef __KERNEL__
264#define XFS_SB_GOOD_VERSION(sbp) \ 248static inline int xfs_sb_good_version(xfs_sb_t *sbp)
265 (XFS_SB_GOOD_VERSION_INT(sbp) && \ 249{
266 (sbp)->sb_shared_vn <= XFS_SB_MAX_SHARED_VN) )) 250 return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \
267#else 251 (sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \
268/* 252 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
269 * extra 2 paren's here (( to unconfuse paren-matching editors 253 !((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
270 * like vi because XFS_SB_GOOD_VERSION_INT is a partial expression 254 ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
271 * and the two XFS_SB_GOOD_VERSION's each 2 more close paren's to 255 (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) && \
272 * complete the expression. 256 (sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN)));
273 */ 257}
274#define XFS_SB_GOOD_VERSION(sbp) \ 258#else
275 (XFS_SB_GOOD_VERSION_INT(sbp) && \ 259static inline int xfs_sb_good_version(xfs_sb_t *sbp)
276 (!((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) || \ 260{
277 (sbp)->sb_shared_vn <= XFS_SB_MAX_SHARED_VN)) )) 261 return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \
262 (sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \
263 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
264 !((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
265 ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
266 (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) && \
267 (!(sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) || \
268 (sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN))));
269}
278#endif /* __KERNEL__ */ 270#endif /* __KERNEL__ */
279#endif
280 271
281#define XFS_SB_GOOD_SASH_VERSION(sbp) \ 272#define XFS_SB_GOOD_SASH_VERSION(sbp) \
282 ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \ 273 ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \
@@ -284,224 +275,178 @@ int xfs_sb_good_version(xfs_sb_t *sbp);
284 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 275 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
285 !((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKSASHBITS))) 276 !((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKSASHBITS)))
286 277
287#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TONEW)
288unsigned xfs_sb_version_tonew(unsigned v);
289#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v) 278#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v)
290#else 279static inline unsigned xfs_sb_version_tonew(unsigned v)
291#define XFS_SB_VERSION_TONEW(v) \ 280{
292 ((((v) == XFS_SB_VERSION_1) ? \ 281 return ((((v) == XFS_SB_VERSION_1) ? \
293 0 : \ 282 0 : \
294 (((v) == XFS_SB_VERSION_2) ? \ 283 (((v) == XFS_SB_VERSION_2) ? \
295 XFS_SB_VERSION_ATTRBIT : \ 284 XFS_SB_VERSION_ATTRBIT : \
296 (XFS_SB_VERSION_ATTRBIT | XFS_SB_VERSION_NLINKBIT))) | \ 285 (XFS_SB_VERSION_ATTRBIT | XFS_SB_VERSION_NLINKBIT))) | \
297 XFS_SB_VERSION_4) 286 XFS_SB_VERSION_4);
298#endif 287}
299 288
300#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TOOLD)
301unsigned xfs_sb_version_toold(unsigned v);
302#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v) 289#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v)
303#else 290static inline unsigned xfs_sb_version_toold(unsigned v)
304#define XFS_SB_VERSION_TOOLD(v) \ 291{
305 (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \ 292 return (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \
306 0 : \ 293 0 : \
307 (((v) & XFS_SB_VERSION_NLINKBIT) ? \ 294 (((v) & XFS_SB_VERSION_NLINKBIT) ? \
308 XFS_SB_VERSION_3 : \ 295 XFS_SB_VERSION_3 : \
309 (((v) & XFS_SB_VERSION_ATTRBIT) ? \ 296 (((v) & XFS_SB_VERSION_ATTRBIT) ? \
310 XFS_SB_VERSION_2 : \ 297 XFS_SB_VERSION_2 : \
311 XFS_SB_VERSION_1))) 298 XFS_SB_VERSION_1)));
312#endif 299}
313 300
314#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASATTR)
315int xfs_sb_version_hasattr(xfs_sb_t *sbp);
316#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp) 301#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp)
317#else 302static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp)
318#define XFS_SB_VERSION_HASATTR(sbp) \ 303{
319 (((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \ 304 return ((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \
320 ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ 305 ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
321 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 306 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
322 ((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT))) 307 ((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT));
323#endif 308}
324 309
325#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDATTR)
326void xfs_sb_version_addattr(xfs_sb_t *sbp);
327#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp) 310#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp)
328#else 311static inline void xfs_sb_version_addattr(xfs_sb_t *sbp)
329#define XFS_SB_VERSION_ADDATTR(sbp) \ 312{
330 ((sbp)->sb_versionnum = \ 313 (sbp)->sb_versionnum = (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
331 (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
332 XFS_SB_VERSION_2 : \ 314 XFS_SB_VERSION_2 : \
333 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) ? \ 315 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) ? \
334 ((sbp)->sb_versionnum | XFS_SB_VERSION_ATTRBIT) : \ 316 ((sbp)->sb_versionnum | XFS_SB_VERSION_ATTRBIT) : \
335 (XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT)))) 317 (XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT)));
336#endif 318}
337 319
338#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASNLINK)
339int xfs_sb_version_hasnlink(xfs_sb_t *sbp);
340#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp) 320#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp)
341#else 321static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp)
342#define XFS_SB_VERSION_HASNLINK(sbp) \ 322{
343 (((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ 323 return ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
344 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 324 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
345 ((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT))) 325 ((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT));
346#endif 326}
347 327
348#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDNLINK)
349void xfs_sb_version_addnlink(xfs_sb_t *sbp);
350#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp) 328#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp)
351#else 329static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp)
352#define XFS_SB_VERSION_ADDNLINK(sbp) \ 330{
353 ((sbp)->sb_versionnum = \ 331 (sbp)->sb_versionnum = ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
354 ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
355 XFS_SB_VERSION_3 : \ 332 XFS_SB_VERSION_3 : \
356 ((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT))) 333 ((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT));
357#endif 334}
358 335
359#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASQUOTA)
360int xfs_sb_version_hasquota(xfs_sb_t *sbp);
361#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp) 336#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp)
362#else 337static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp)
363#define XFS_SB_VERSION_HASQUOTA(sbp) \ 338{
364 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 339 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
365 ((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT)) 340 ((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
366#endif 341}
367 342
368#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDQUOTA)
369void xfs_sb_version_addquota(xfs_sb_t *sbp);
370#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp) 343#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp)
371#else 344static inline void xfs_sb_version_addquota(xfs_sb_t *sbp)
372#define XFS_SB_VERSION_ADDQUOTA(sbp) \ 345{
373 ((sbp)->sb_versionnum = \ 346 (sbp)->sb_versionnum = \
374 (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \ 347 (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \
375 ((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \ 348 ((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \
376 (XFS_SB_VERSION_TONEW((sbp)->sb_versionnum) | \ 349 (XFS_SB_VERSION_TONEW((sbp)->sb_versionnum) | \
377 XFS_SB_VERSION_QUOTABIT))) 350 XFS_SB_VERSION_QUOTABIT));
378#endif 351}
379 352
380#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASALIGN)
381int xfs_sb_version_hasalign(xfs_sb_t *sbp);
382#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp) 353#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp)
383#else 354static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp)
384#define XFS_SB_VERSION_HASALIGN(sbp) \ 355{
385 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 356 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
386 ((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT)) 357 ((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT);
387#endif 358}
388 359
389#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBALIGN)
390void xfs_sb_version_subalign(xfs_sb_t *sbp);
391#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp) 360#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp)
392#else 361static inline void xfs_sb_version_subalign(xfs_sb_t *sbp)
393#define XFS_SB_VERSION_SUBALIGN(sbp) \ 362{
394 ((sbp)->sb_versionnum = \ 363 (sbp)->sb_versionnum = \
395 XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT)) 364 XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT);
396#endif 365}
397 366
398#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASDALIGN)
399int xfs_sb_version_hasdalign(xfs_sb_t *sbp);
400#define XFS_SB_VERSION_HASDALIGN(sbp) xfs_sb_version_hasdalign(sbp) 367#define XFS_SB_VERSION_HASDALIGN(sbp) xfs_sb_version_hasdalign(sbp)
401#else 368static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp)
402#define XFS_SB_VERSION_HASDALIGN(sbp) \ 369{
403 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 370 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
404 ((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT)) 371 ((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
405#endif 372}
406 373
407#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDDALIGN)
408int xfs_sb_version_adddalign(xfs_sb_t *sbp);
409#define XFS_SB_VERSION_ADDDALIGN(sbp) xfs_sb_version_adddalign(sbp) 374#define XFS_SB_VERSION_ADDDALIGN(sbp) xfs_sb_version_adddalign(sbp)
410#else 375static inline int xfs_sb_version_adddalign(xfs_sb_t *sbp)
411#define XFS_SB_VERSION_ADDDALIGN(sbp) \ 376{
412 ((sbp)->sb_versionnum = \ 377 return (sbp)->sb_versionnum = \
413 ((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT)) 378 ((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT);
414#endif 379}
415 380
416#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASSHARED)
417int xfs_sb_version_hasshared(xfs_sb_t *sbp);
418#define XFS_SB_VERSION_HASSHARED(sbp) xfs_sb_version_hasshared(sbp) 381#define XFS_SB_VERSION_HASSHARED(sbp) xfs_sb_version_hasshared(sbp)
419#else 382static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp)
420#define XFS_SB_VERSION_HASSHARED(sbp) \ 383{
421 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 384 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
422 ((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT)) 385 ((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT);
423#endif 386}
424 387
425#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDSHARED)
426int xfs_sb_version_addshared(xfs_sb_t *sbp);
427#define XFS_SB_VERSION_ADDSHARED(sbp) xfs_sb_version_addshared(sbp) 388#define XFS_SB_VERSION_ADDSHARED(sbp) xfs_sb_version_addshared(sbp)
428#else 389static inline int xfs_sb_version_addshared(xfs_sb_t *sbp)
429#define XFS_SB_VERSION_ADDSHARED(sbp) \ 390{
430 ((sbp)->sb_versionnum = \ 391 return (sbp)->sb_versionnum = \
431 ((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT)) 392 ((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT);
432#endif 393}
433 394
434#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBSHARED)
435int xfs_sb_version_subshared(xfs_sb_t *sbp);
436#define XFS_SB_VERSION_SUBSHARED(sbp) xfs_sb_version_subshared(sbp) 395#define XFS_SB_VERSION_SUBSHARED(sbp) xfs_sb_version_subshared(sbp)
437#else 396static inline int xfs_sb_version_subshared(xfs_sb_t *sbp)
438#define XFS_SB_VERSION_SUBSHARED(sbp) \ 397{
439 ((sbp)->sb_versionnum = \ 398 return (sbp)->sb_versionnum = \
440 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT)) 399 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT);
441#endif 400}
442 401
443#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASDIRV2)
444int xfs_sb_version_hasdirv2(xfs_sb_t *sbp);
445#define XFS_SB_VERSION_HASDIRV2(sbp) xfs_sb_version_hasdirv2(sbp) 402#define XFS_SB_VERSION_HASDIRV2(sbp) xfs_sb_version_hasdirv2(sbp)
446#else 403static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp)
447#define XFS_SB_VERSION_HASDIRV2(sbp) \ 404{
448 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 405 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
449 ((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT)) 406 ((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT);
450#endif 407}
451 408
452#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASLOGV2)
453int xfs_sb_version_haslogv2(xfs_sb_t *sbp);
454#define XFS_SB_VERSION_HASLOGV2(sbp) xfs_sb_version_haslogv2(sbp) 409#define XFS_SB_VERSION_HASLOGV2(sbp) xfs_sb_version_haslogv2(sbp)
455#else 410static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp)
456#define XFS_SB_VERSION_HASLOGV2(sbp) \ 411{
457 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 412 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
458 ((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT)) 413 ((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
459#endif 414}
460 415
461#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASEXTFLGBIT)
462int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp);
463#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) xfs_sb_version_hasextflgbit(sbp) 416#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) xfs_sb_version_hasextflgbit(sbp)
464#else 417static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp)
465#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) \ 418{
466 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 419 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
467 ((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT)) 420 ((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
468#endif 421}
469 422
470#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDEXTFLGBIT)
471int xfs_sb_version_addextflgbit(xfs_sb_t *sbp);
472#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) xfs_sb_version_addextflgbit(sbp) 423#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) xfs_sb_version_addextflgbit(sbp)
473#else 424static inline int xfs_sb_version_addextflgbit(xfs_sb_t *sbp)
474#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) \ 425{
475 ((sbp)->sb_versionnum = \ 426 return (sbp)->sb_versionnum = \
476 ((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT)) 427 ((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT);
477#endif 428}
478 429
479#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBEXTFLGBIT)
480int xfs_sb_version_subextflgbit(xfs_sb_t *sbp);
481#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) xfs_sb_version_subextflgbit(sbp) 430#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) xfs_sb_version_subextflgbit(sbp)
482#else 431static inline int xfs_sb_version_subextflgbit(xfs_sb_t *sbp)
483#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) \ 432{
484 ((sbp)->sb_versionnum = \ 433 return (sbp)->sb_versionnum = \
485 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT)) 434 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT);
486#endif 435}
487 436
488#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASSECTOR)
489int xfs_sb_version_hassector(xfs_sb_t *sbp);
490#define XFS_SB_VERSION_HASSECTOR(sbp) xfs_sb_version_hassector(sbp) 437#define XFS_SB_VERSION_HASSECTOR(sbp) xfs_sb_version_hassector(sbp)
491#else 438static inline int xfs_sb_version_hassector(xfs_sb_t *sbp)
492#define XFS_SB_VERSION_HASSECTOR(sbp) \ 439{
493 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 440 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
494 ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT)) 441 ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
495#endif 442}
496 443
497#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASMOREBITSBIT)
498int xfs_sb_version_hasmorebits(xfs_sb_t *sbp);
499#define XFS_SB_VERSION_HASMOREBITS(sbp) xfs_sb_version_hasmorebits(sbp) 444#define XFS_SB_VERSION_HASMOREBITS(sbp) xfs_sb_version_hasmorebits(sbp)
500#else 445static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp)
501#define XFS_SB_VERSION_HASMOREBITS(sbp) \ 446{
502 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 447 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
503 ((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT)) 448 ((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT);
504#endif 449}
505 450
506/* 451/*
507 * sb_features2 bit version macros. 452 * sb_features2 bit version macros.
@@ -512,65 +457,36 @@ int xfs_sb_version_hasmorebits(xfs_sb_t *sbp);
512 * ((XFS_SB_VERSION_HASMOREBITS(sbp) && 457 * ((XFS_SB_VERSION_HASMOREBITS(sbp) &&
513 * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT) 458 * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT)
514 */ 459 */
515#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASATTR2) 460
516int xfs_sb_version_hasattr2(xfs_sb_t *sbp);
517#define XFS_SB_VERSION_HASATTR2(sbp) xfs_sb_version_hasattr2(sbp) 461#define XFS_SB_VERSION_HASATTR2(sbp) xfs_sb_version_hasattr2(sbp)
518#else 462static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp)
519#define XFS_SB_VERSION_HASATTR2(sbp) \ 463{
520 ((XFS_SB_VERSION_HASMOREBITS(sbp)) && \ 464 return (XFS_SB_VERSION_HASMOREBITS(sbp)) && \
521 ((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT)) 465 ((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT);
522#endif 466}
523 467
524#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDATTR2)
525void xfs_sb_version_addattr2(xfs_sb_t *sbp);
526#define XFS_SB_VERSION_ADDATTR2(sbp) xfs_sb_version_addattr2(sbp) 468#define XFS_SB_VERSION_ADDATTR2(sbp) xfs_sb_version_addattr2(sbp)
527#else 469static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp)
528#define XFS_SB_VERSION_ADDATTR2(sbp) \ 470{
529 ((sbp)->sb_versionnum = \ 471 ((sbp)->sb_versionnum = \
530 ((sbp)->sb_versionnum | XFS_SB_VERSION_MOREBITSBIT), \ 472 ((sbp)->sb_versionnum | XFS_SB_VERSION_MOREBITSBIT), \
531 ((sbp)->sb_features2 = \ 473 ((sbp)->sb_features2 = \
532 ((sbp)->sb_features2 | XFS_SB_VERSION2_ATTR2BIT))) 474 ((sbp)->sb_features2 | XFS_SB_VERSION2_ATTR2BIT)));
533#endif 475}
476
534/* 477/*
535 * end of superblock version macros 478 * end of superblock version macros
536 */ 479 */
537 480
538#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */ 481#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
539#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_BLOCK)
540xfs_agblock_t xfs_sb_block(struct xfs_mount *mp);
541#define XFS_SB_BLOCK(mp) xfs_sb_block(mp)
542#else
543#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) 482#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
544#endif
545
546#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_HDR_BLOCK)
547xfs_agblock_t xfs_hdr_block(struct xfs_mount *mp, xfs_daddr_t d);
548#define XFS_HDR_BLOCK(mp,d) xfs_hdr_block(mp,d)
549#else
550#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp,d)))
551#endif
552#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_FSB)
553xfs_fsblock_t xfs_daddr_to_fsb(struct xfs_mount *mp, xfs_daddr_t d);
554#define XFS_DADDR_TO_FSB(mp,d) xfs_daddr_to_fsb(mp,d)
555#else
556#define XFS_DADDR_TO_FSB(mp,d) \
557 XFS_AGB_TO_FSB(mp, XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d))
558#endif
559#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_DADDR)
560xfs_daddr_t xfs_fsb_to_daddr(struct xfs_mount *mp, xfs_fsblock_t fsbno);
561#define XFS_FSB_TO_DADDR(mp,fsbno) xfs_fsb_to_daddr(mp,fsbno)
562#else
563#define XFS_FSB_TO_DADDR(mp,fsbno) \
564 XFS_AGB_TO_DADDR(mp, XFS_FSB_TO_AGNO(mp,fsbno), \
565 XFS_FSB_TO_AGBNO(mp,fsbno))
566#endif
567
568#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBP)
569xfs_sb_t *xfs_buf_to_sbp(struct xfs_buf *bp);
570#define XFS_BUF_TO_SBP(bp) xfs_buf_to_sbp(bp)
571#else
572#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp)) 483#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp))
573#endif 484
485#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
486#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
487 XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d))
488#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \
489 XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
574 490
575/* 491/*
576 * File system sector to basic block conversions. 492 * File system sector to basic block conversions.
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 5e33891b8049..d14adef65a26 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -29,12 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -43,21 +43,21 @@
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_error.h" 45#include "xfs_error.h"
46#include "xfs_trans_priv.h" 46#include "xfs_da_btree.h"
47#include "xfs_alloc_btree.h"
48#include "xfs_bmap_btree.h" 47#include "xfs_bmap_btree.h"
48#include "xfs_alloc_btree.h"
49#include "xfs_ialloc_btree.h" 49#include "xfs_ialloc_btree.h"
50#include "xfs_btree.h"
51#include "xfs_ialloc.h"
52#include "xfs_alloc.h"
53#include "xfs_attr_sf.h"
54#include "xfs_dir_sf.h" 50#include "xfs_dir_sf.h"
55#include "xfs_dir2_sf.h" 51#include "xfs_dir2_sf.h"
52#include "xfs_attr_sf.h"
56#include "xfs_dinode.h" 53#include "xfs_dinode.h"
57#include "xfs_inode.h" 54#include "xfs_inode.h"
55#include "xfs_btree.h"
56#include "xfs_ialloc.h"
57#include "xfs_alloc.h"
58#include "xfs_bmap.h" 58#include "xfs_bmap.h"
59#include "xfs_da_btree.h"
60#include "xfs_quota.h" 59#include "xfs_quota.h"
60#include "xfs_trans_priv.h"
61#include "xfs_trans_space.h" 61#include "xfs_trans_space.h"
62 62
63 63
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index 0f333fba187c..6381669a34ac 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -234,68 +234,67 @@ typedef struct xfs_log_item_chunk {
234 * lic_unused to the right value (0 matches all free). The 234 * lic_unused to the right value (0 matches all free). The
235 * lic_descs.lid_index values are set up as each desc is allocated. 235 * lic_descs.lid_index values are set up as each desc is allocated.
236 */ 236 */
237#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT)
238void xfs_lic_init(xfs_log_item_chunk_t *cp);
239#define XFS_LIC_INIT(cp) xfs_lic_init(cp) 237#define XFS_LIC_INIT(cp) xfs_lic_init(cp)
240#else 238static inline void xfs_lic_init(xfs_log_item_chunk_t *cp)
241#define XFS_LIC_INIT(cp) ((cp)->lic_free = XFS_LIC_FREEMASK) 239{
242#endif 240 cp->lic_free = XFS_LIC_FREEMASK;
243#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT_SLOT) 241}
244void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot); 242
245#define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot) 243#define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot)
246#else 244static inline void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot)
247#define XFS_LIC_INIT_SLOT(cp,slot) \ 245{
248 ((cp)->lic_descs[slot].lid_index = (unsigned char)(slot)) 246 cp->lic_descs[slot].lid_index = (unsigned char)(slot);
249#endif 247}
250#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_VACANCY) 248
251int xfs_lic_vacancy(xfs_log_item_chunk_t *cp);
252#define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp) 249#define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp)
253#else 250static inline int xfs_lic_vacancy(xfs_log_item_chunk_t *cp)
254#define XFS_LIC_VACANCY(cp) (((cp)->lic_free) & XFS_LIC_FREEMASK) 251{
255#endif 252 return cp->lic_free & XFS_LIC_FREEMASK;
256#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ALL_FREE) 253}
257void xfs_lic_all_free(xfs_log_item_chunk_t *cp); 254
258#define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp) 255#define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp)
259#else 256static inline void xfs_lic_all_free(xfs_log_item_chunk_t *cp)
260#define XFS_LIC_ALL_FREE(cp) ((cp)->lic_free = XFS_LIC_FREEMASK) 257{
261#endif 258 cp->lic_free = XFS_LIC_FREEMASK;
262#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ARE_ALL_FREE) 259}
263int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp); 260
264#define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp) 261#define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp)
265#else 262static inline int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp)
266#define XFS_LIC_ARE_ALL_FREE(cp) (((cp)->lic_free & XFS_LIC_FREEMASK) ==\ 263{
267 XFS_LIC_FREEMASK) 264 return ((cp->lic_free & XFS_LIC_FREEMASK) == XFS_LIC_FREEMASK);
268#endif 265}
269#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ISFREE) 266
270int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot);
271#define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot) 267#define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot)
272#else 268static inline int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot)
273#define XFS_LIC_ISFREE(cp,slot) ((cp)->lic_free & (1 << (slot))) 269{
274#endif 270 return (cp->lic_free & (1 << slot));
275#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_CLAIM) 271}
276void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot); 272
277#define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot) 273#define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot)
278#else 274static inline void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot)
279#define XFS_LIC_CLAIM(cp,slot) ((cp)->lic_free &= ~(1 << (slot))) 275{
280#endif 276 cp->lic_free &= ~(1 << slot);
281#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_RELSE) 277}
282void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot); 278
283#define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot) 279#define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot)
284#else 280static inline void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot)
285#define XFS_LIC_RELSE(cp,slot) ((cp)->lic_free |= 1 << (slot)) 281{
286#endif 282 cp->lic_free |= 1 << slot;
287#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_SLOT) 283}
288xfs_log_item_desc_t *xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot); 284
289#define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot) 285#define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot)
290#else 286static inline xfs_log_item_desc_t *
291#define XFS_LIC_SLOT(cp,slot) (&((cp)->lic_descs[slot])) 287xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot)
292#endif 288{
293#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_SLOT) 289 return &(cp->lic_descs[slot]);
294int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp); 290}
291
295#define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp) 292#define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp)
296#else 293static inline int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp)
297#define XFS_LIC_DESC_TO_SLOT(dp) ((uint)((dp)->lid_index)) 294{
298#endif 295 return (uint)dp->lid_index;
296}
297
299/* 298/*
300 * Calculate the address of a chunk given a descriptor pointer: 299 * Calculate the address of a chunk given a descriptor pointer:
301 * dp - dp->lid_index give the address of the start of the lic_descs array. 300 * dp - dp->lid_index give the address of the start of the lic_descs array.
@@ -303,15 +302,14 @@ int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp);
303 * All of this yields the address of the chunk, which is 302 * All of this yields the address of the chunk, which is
304 * cast to a chunk pointer. 303 * cast to a chunk pointer.
305 */ 304 */
306#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_CHUNK)
307xfs_log_item_chunk_t *xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp);
308#define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp) 305#define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp)
309#else 306static inline xfs_log_item_chunk_t *
310#define XFS_LIC_DESC_TO_CHUNK(dp) ((xfs_log_item_chunk_t*) \ 307xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp)
311 (((xfs_caddr_t)((dp) - (dp)->lid_index)) -\ 308{
312 (xfs_caddr_t)(((xfs_log_item_chunk_t*) \ 309 return (xfs_log_item_chunk_t*) \
313 0)->lic_descs))) 310 (((xfs_caddr_t)((dp) - (dp)->lid_index)) - \
314#endif 311 (xfs_caddr_t)(((xfs_log_item_chunk_t*)0)->lic_descs));
312}
315 313
316#ifdef __KERNEL__ 314#ifdef __KERNEL__
317/* 315/*
@@ -328,7 +326,7 @@ typedef struct xfs_log_busy_slot {
328#define XFS_LBC_NUM_SLOTS 31 326#define XFS_LBC_NUM_SLOTS 31
329typedef struct xfs_log_busy_chunk { 327typedef struct xfs_log_busy_chunk {
330 struct xfs_log_busy_chunk *lbc_next; 328 struct xfs_log_busy_chunk *lbc_next;
331 uint lbc_free; /* bitmask of free slots */ 329 uint lbc_free; /* free slots bitmask */
332 ushort lbc_unused; /* first unused */ 330 ushort lbc_unused; /* first unused */
333 xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS]; 331 xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS];
334} xfs_log_busy_chunk_t; 332} xfs_log_busy_chunk_t;
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 2a71b4f91bfa..f248cb60ff7c 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -29,12 +29,11 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h"
37#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
38#include "xfs_trans.h" 37#include "xfs_trans.h"
39#include "xfs_sb.h" 38#include "xfs_sb.h"
40#include "xfs_dir.h" 39#include "xfs_dir.h"
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index e733293dd7f4..24630da76a29 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -29,19 +29,28 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_buf_item.h"
40#include "xfs_sb.h" 39#include "xfs_sb.h"
41#include "xfs_ag.h" 40#include "xfs_ag.h"
42#include "xfs_dir.h" 41#include "xfs_dir.h"
42#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h"
48#include "xfs_dir_sf.h"
49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dinode.h"
52#include "xfs_inode.h"
53#include "xfs_buf_item.h"
45#include "xfs_trans_priv.h" 54#include "xfs_trans_priv.h"
46#include "xfs_error.h" 55#include "xfs_error.h"
47#include "xfs_rw.h" 56#include "xfs_rw.h"
diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c
index 93259a15f983..1f6b17777f2d 100644
--- a/fs/xfs/xfs_trans_extfree.c
+++ b/fs/xfs/xfs_trans_extfree.c
@@ -29,12 +29,11 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h"
37#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
38#include "xfs_trans.h" 37#include "xfs_trans.h"
39#include "xfs_sb.h" 38#include "xfs_sb.h"
40#include "xfs_dir.h" 39#include "xfs_dir.h"
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
index 7e7631ca4979..060b1a72eef1 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -29,12 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -42,18 +42,18 @@
42#include "xfs_dir2.h" 42#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_trans_priv.h"
46#include "xfs_alloc_btree.h"
47#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
46#include "xfs_alloc_btree.h"
48#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_attr_sf.h"
52#include "xfs_dir_sf.h" 48#include "xfs_dir_sf.h"
53#include "xfs_dir2_sf.h" 49#include "xfs_dir2_sf.h"
50#include "xfs_attr_sf.h"
54#include "xfs_dinode.h" 51#include "xfs_dinode.h"
55#include "xfs_inode_item.h"
56#include "xfs_inode.h" 52#include "xfs_inode.h"
53#include "xfs_btree.h"
54#include "xfs_ialloc.h"
55#include "xfs_trans_priv.h"
56#include "xfs_inode_item.h"
57 57
58#ifdef XFS_TRANS_DEBUG 58#ifdef XFS_TRANS_DEBUG
59STATIC void 59STATIC void
diff --git a/fs/xfs/xfs_trans_item.c b/fs/xfs/xfs_trans_item.c
index 1b8a756d80ed..8edfb151df10 100644
--- a/fs/xfs/xfs_trans_item.c
+++ b/fs/xfs/xfs_trans_item.c
@@ -29,12 +29,11 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h"
37#include "xfs_log.h" 35#include "xfs_log.h"
36#include "xfs_inum.h"
38#include "xfs_trans.h" 37#include "xfs_trans.h"
39 38
40STATIC int xfs_trans_unlock_chunk(xfs_log_item_chunk_t *, 39STATIC int xfs_trans_unlock_chunk(xfs_log_item_chunk_t *,
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c
index 11351f08d438..c6459514fadb 100644
--- a/fs/xfs/xfs_utils.c
+++ b/fs/xfs/xfs_utils.c
@@ -29,25 +29,26 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h"
40#include "xfs_dir.h" 41#include "xfs_dir.h"
41#include "xfs_dir2.h" 42#include "xfs_dir2.h"
42#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
43#include "xfs_mount.h" 44#include "xfs_mount.h"
44#include "xfs_bmap_btree.h" 45#include "xfs_bmap_btree.h"
45#include "xfs_attr_sf.h"
46#include "xfs_dir_sf.h" 46#include "xfs_dir_sf.h"
47#include "xfs_dir2_sf.h" 47#include "xfs_dir2_sf.h"
48#include "xfs_attr_sf.h"
48#include "xfs_dinode.h" 49#include "xfs_dinode.h"
49#include "xfs_inode_item.h"
50#include "xfs_inode.h" 50#include "xfs_inode.h"
51#include "xfs_inode_item.h"
51#include "xfs_bmap.h" 52#include "xfs_bmap.h"
52#include "xfs_error.h" 53#include "xfs_error.h"
53#include "xfs_quota.h" 54#include "xfs_quota.h"
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index 200e0c50acf2..9ea201762a9c 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * XFS filesystem operations.
3 *
4 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
5 * 3 *
6 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
@@ -31,44 +29,44 @@
31 * 29 *
32 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
33 */ 31 */
34
35#include "xfs.h" 32#include "xfs.h"
36#include "xfs_macros.h" 33#include "xfs_fs.h"
37#include "xfs_types.h" 34#include "xfs_types.h"
38#include "xfs_inum.h" 35#include "xfs_bit.h"
39#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
40#include "xfs_trans.h" 38#include "xfs_trans.h"
41#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h"
42#include "xfs_dir.h" 41#include "xfs_dir.h"
43#include "xfs_dir2.h" 42#include "xfs_dir2.h"
44#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
45#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_da_btree.h"
46#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
47#include "xfs_ialloc_btree.h" 47#include "xfs_ialloc_btree.h"
48#include "xfs_alloc_btree.h" 48#include "xfs_alloc_btree.h"
49#include "xfs_btree.h"
50#include "xfs_alloc.h"
51#include "xfs_ialloc.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 49#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 50#include "xfs_dir2_sf.h"
51#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 52#include "xfs_dinode.h"
56#include "xfs_inode_item.h"
57#include "xfs_inode.h" 53#include "xfs_inode.h"
58#include "xfs_ag.h" 54#include "xfs_inode_item.h"
55#include "xfs_btree.h"
56#include "xfs_alloc.h"
57#include "xfs_ialloc.h"
58#include "xfs_quota.h"
59#include "xfs_error.h" 59#include "xfs_error.h"
60#include "xfs_bmap.h" 60#include "xfs_bmap.h"
61#include "xfs_da_btree.h"
62#include "xfs_rw.h" 61#include "xfs_rw.h"
63#include "xfs_refcache.h" 62#include "xfs_refcache.h"
64#include "xfs_buf_item.h" 63#include "xfs_buf_item.h"
65#include "xfs_extfree_item.h" 64#include "xfs_log_priv.h"
66#include "xfs_quota.h"
67#include "xfs_dir2_trace.h" 65#include "xfs_dir2_trace.h"
66#include "xfs_extfree_item.h"
68#include "xfs_acl.h" 67#include "xfs_acl.h"
69#include "xfs_attr.h" 68#include "xfs_attr.h"
70#include "xfs_clnt.h" 69#include "xfs_clnt.h"
71#include "xfs_log_priv.h"
72 70
73STATIC int xfs_sync(bhv_desc_t *, int, cred_t *); 71STATIC int xfs_sync(bhv_desc_t *, int, cred_t *);
74 72
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 8221b11a48c0..443ec6a0b2b8 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -29,12 +29,12 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33#include "xfs.h" 32#include "xfs.h"
34#include "xfs_macros.h" 33#include "xfs_fs.h"
35#include "xfs_types.h" 34#include "xfs_types.h"
36#include "xfs_inum.h" 35#include "xfs_bit.h"
37#include "xfs_log.h" 36#include "xfs_log.h"
37#include "xfs_inum.h"
38#include "xfs_trans.h" 38#include "xfs_trans.h"
39#include "xfs_sb.h" 39#include "xfs_sb.h"
40#include "xfs_ag.h" 40#include "xfs_ag.h"
@@ -42,33 +42,32 @@
42#include "xfs_dir2.h" 42#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 43#include "xfs_dmapi.h"
44#include "xfs_mount.h" 44#include "xfs_mount.h"
45#include "xfs_alloc_btree.h" 45#include "xfs_da_btree.h"
46#include "xfs_bmap_btree.h" 46#include "xfs_bmap_btree.h"
47#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 48#include "xfs_ialloc_btree.h"
48#include "xfs_itable.h"
49#include "xfs_btree.h"
50#include "xfs_ialloc.h"
51#include "xfs_alloc.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 49#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 50#include "xfs_dir2_sf.h"
51#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 52#include "xfs_dinode.h"
56#include "xfs_inode_item.h"
57#include "xfs_inode.h" 53#include "xfs_inode.h"
54#include "xfs_inode_item.h"
55#include "xfs_dir_leaf.h"
56#include "xfs_itable.h"
57#include "xfs_btree.h"
58#include "xfs_ialloc.h"
59#include "xfs_alloc.h"
58#include "xfs_bmap.h" 60#include "xfs_bmap.h"
59#include "xfs_da_btree.h"
60#include "xfs_attr.h" 61#include "xfs_attr.h"
61#include "xfs_rw.h" 62#include "xfs_rw.h"
62#include "xfs_refcache.h"
63#include "xfs_error.h" 63#include "xfs_error.h"
64#include "xfs_bit.h"
65#include "xfs_rtalloc.h"
66#include "xfs_quota.h" 64#include "xfs_quota.h"
67#include "xfs_utils.h" 65#include "xfs_utils.h"
66#include "xfs_rtalloc.h"
67#include "xfs_refcache.h"
68#include "xfs_trans_space.h" 68#include "xfs_trans_space.h"
69#include "xfs_dir_leaf.h"
70#include "xfs_mac.h"
71#include "xfs_log_priv.h" 69#include "xfs_log_priv.h"
70#include "xfs_mac.h"
72 71
73 72
74/* 73/*