aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/Makefile119
-rw-r--r--fs/xfs/kmem.c (renamed from fs/xfs/linux-2.6/kmem.c)0
-rw-r--r--fs/xfs/kmem.h (renamed from fs/xfs/linux-2.6/kmem.h)0
-rw-r--r--fs/xfs/mrlock.h (renamed from fs/xfs/linux-2.6/mrlock.h)0
-rw-r--r--fs/xfs/time.h (renamed from fs/xfs/linux-2.6/time.h)0
-rw-r--r--fs/xfs/uuid.c (renamed from fs/xfs/support/uuid.c)0
-rw-r--r--fs/xfs/uuid.h (renamed from fs/xfs/support/uuid.h)0
-rw-r--r--fs/xfs/xfs.h3
-rw-r--r--fs/xfs/xfs_acl.c (renamed from fs/xfs/linux-2.6/xfs_acl.c)0
-rw-r--r--fs/xfs/xfs_ag.h6
-rw-r--r--fs/xfs/xfs_alloc.c7
-rw-r--r--fs/xfs/xfs_aops.c (renamed from fs/xfs/linux-2.6/xfs_aops.c)3
-rw-r--r--fs/xfs/xfs_aops.h (renamed from fs/xfs/linux-2.6/xfs_aops.h)0
-rw-r--r--fs/xfs/xfs_attr.c3
-rw-r--r--fs/xfs/xfs_bmap.c3
-rw-r--r--fs/xfs/xfs_btree.c17
-rw-r--r--fs/xfs/xfs_btree.h2
-rw-r--r--fs/xfs/xfs_buf.c (renamed from fs/xfs/linux-2.6/xfs_buf.c)15
-rw-r--r--fs/xfs/xfs_buf.h (renamed from fs/xfs/linux-2.6/xfs_buf.h)32
-rw-r--r--fs/xfs/xfs_buf_item.c27
-rw-r--r--fs/xfs/xfs_da_btree.c12
-rw-r--r--fs/xfs/xfs_dinode.h2
-rw-r--r--fs/xfs/xfs_discard.c (renamed from fs/xfs/linux-2.6/xfs_discard.c)0
-rw-r--r--fs/xfs/xfs_discard.h (renamed from fs/xfs/linux-2.6/xfs_discard.h)0
-rw-r--r--fs/xfs/xfs_dquot.c (renamed from fs/xfs/quota/xfs_dquot.c)16
-rw-r--r--fs/xfs/xfs_dquot.h (renamed from fs/xfs/quota/xfs_dquot.h)0
-rw-r--r--fs/xfs/xfs_dquot_item.c (renamed from fs/xfs/quota/xfs_dquot_item.c)10
-rw-r--r--fs/xfs/xfs_dquot_item.h (renamed from fs/xfs/quota/xfs_dquot_item.h)0
-rw-r--r--fs/xfs/xfs_export.c (renamed from fs/xfs/linux-2.6/xfs_export.c)0
-rw-r--r--fs/xfs/xfs_export.h (renamed from fs/xfs/linux-2.6/xfs_export.h)0
-rw-r--r--fs/xfs/xfs_file.c (renamed from fs/xfs/linux-2.6/xfs_file.c)0
-rw-r--r--fs/xfs/xfs_fs_subr.c (renamed from fs/xfs/linux-2.6/xfs_fs_subr.c)0
-rw-r--r--fs/xfs/xfs_globals.c (renamed from fs/xfs/linux-2.6/xfs_globals.c)0
-rw-r--r--fs/xfs/xfs_ialloc.c5
-rw-r--r--fs/xfs/xfs_inode.c4
-rw-r--r--fs/xfs/xfs_inode_item.c10
-rw-r--r--fs/xfs/xfs_ioctl.c (renamed from fs/xfs/linux-2.6/xfs_ioctl.c)0
-rw-r--r--fs/xfs/xfs_ioctl.h (renamed from fs/xfs/linux-2.6/xfs_ioctl.h)0
-rw-r--r--fs/xfs/xfs_ioctl32.c (renamed from fs/xfs/linux-2.6/xfs_ioctl32.c)0
-rw-r--r--fs/xfs/xfs_ioctl32.h (renamed from fs/xfs/linux-2.6/xfs_ioctl32.h)0
-rw-r--r--fs/xfs/xfs_iops.c (renamed from fs/xfs/linux-2.6/xfs_iops.c)14
-rw-r--r--fs/xfs/xfs_iops.h (renamed from fs/xfs/linux-2.6/xfs_iops.h)0
-rw-r--r--fs/xfs/xfs_linux.h (renamed from fs/xfs/linux-2.6/xfs_linux.h)29
-rw-r--r--fs/xfs/xfs_log.c14
-rw-r--r--fs/xfs/xfs_log_recover.c38
-rw-r--r--fs/xfs/xfs_message.c (renamed from fs/xfs/linux-2.6/xfs_message.c)0
-rw-r--r--fs/xfs/xfs_message.h (renamed from fs/xfs/linux-2.6/xfs_message.h)0
-rw-r--r--fs/xfs/xfs_mount.c4
-rw-r--r--fs/xfs/xfs_qm.c (renamed from fs/xfs/quota/xfs_qm.c)2
-rw-r--r--fs/xfs/xfs_qm.h (renamed from fs/xfs/quota/xfs_qm.h)0
-rw-r--r--fs/xfs/xfs_qm_bhv.c (renamed from fs/xfs/quota/xfs_qm_bhv.c)0
-rw-r--r--fs/xfs/xfs_qm_stats.c (renamed from fs/xfs/quota/xfs_qm_stats.c)0
-rw-r--r--fs/xfs/xfs_qm_stats.h (renamed from fs/xfs/quota/xfs_qm_stats.h)0
-rw-r--r--fs/xfs/xfs_qm_syscalls.c (renamed from fs/xfs/quota/xfs_qm_syscalls.c)0
-rw-r--r--fs/xfs/xfs_quota_priv.h (renamed from fs/xfs/quota/xfs_quota_priv.h)0
-rw-r--r--fs/xfs/xfs_quotaops.c (renamed from fs/xfs/linux-2.6/xfs_quotaops.c)2
-rw-r--r--fs/xfs/xfs_rtalloc.c32
-rw-r--r--fs/xfs/xfs_rtalloc.h2
-rw-r--r--fs/xfs/xfs_rw.c8
-rw-r--r--fs/xfs/xfs_sb.h2
-rw-r--r--fs/xfs/xfs_stats.c (renamed from fs/xfs/linux-2.6/xfs_stats.c)0
-rw-r--r--fs/xfs/xfs_stats.h (renamed from fs/xfs/linux-2.6/xfs_stats.h)0
-rw-r--r--fs/xfs/xfs_super.c (renamed from fs/xfs/linux-2.6/xfs_super.c)49
-rw-r--r--fs/xfs/xfs_super.h (renamed from fs/xfs/linux-2.6/xfs_super.h)0
-rw-r--r--fs/xfs/xfs_sync.c (renamed from fs/xfs/linux-2.6/xfs_sync.c)2
-rw-r--r--fs/xfs/xfs_sync.h (renamed from fs/xfs/linux-2.6/xfs_sync.h)0
-rw-r--r--fs/xfs/xfs_sysctl.c (renamed from fs/xfs/linux-2.6/xfs_sysctl.c)0
-rw-r--r--fs/xfs/xfs_sysctl.h (renamed from fs/xfs/linux-2.6/xfs_sysctl.h)0
-rw-r--r--fs/xfs/xfs_trace.c (renamed from fs/xfs/linux-2.6/xfs_trace.c)4
-rw-r--r--fs/xfs/xfs_trace.h (renamed from fs/xfs/linux-2.6/xfs_trace.h)0
-rw-r--r--fs/xfs/xfs_trans.h2
-rw-r--r--fs/xfs/xfs_trans_ail.c150
-rw-r--r--fs/xfs/xfs_trans_buf.c28
-rw-r--r--fs/xfs/xfs_trans_dquot.c (renamed from fs/xfs/quota/xfs_trans_dquot.c)0
-rw-r--r--fs/xfs/xfs_trans_priv.h8
-rw-r--r--fs/xfs/xfs_vnode.h (renamed from fs/xfs/linux-2.6/xfs_vnode.h)0
-rw-r--r--fs/xfs/xfs_vnodeops.c12
-rw-r--r--fs/xfs/xfs_xattr.c (renamed from fs/xfs/linux-2.6/xfs_xattr.c)0
78 files changed, 324 insertions, 374 deletions
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 75bb316529dd..427a4e82a588 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -16,44 +16,53 @@
16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17# 17#
18 18
19ccflags-y := -I$(src) -I$(src)/linux-2.6 19ccflags-y += -I$(src) # needed for trace events
20ccflags-$(CONFIG_XFS_DEBUG) += -g
21 20
22XFS_LINUX := linux-2.6 21ccflags-$(CONFIG_XFS_DEBUG) += -g
23 22
24obj-$(CONFIG_XFS_FS) += xfs.o 23obj-$(CONFIG_XFS_FS) += xfs.o
25 24
26xfs-y += linux-2.6/xfs_trace.o 25# this one should be compiled first, as the tracing macros can easily blow up
27 26xfs-y += xfs_trace.o
28xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \
29 xfs_dquot.o \
30 xfs_dquot_item.o \
31 xfs_trans_dquot.o \
32 xfs_qm_syscalls.o \
33 xfs_qm_bhv.o \
34 xfs_qm.o)
35xfs-$(CONFIG_XFS_QUOTA) += linux-2.6/xfs_quotaops.o
36
37ifeq ($(CONFIG_XFS_QUOTA),y)
38xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o
39endif
40
41xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o
42xfs-$(CONFIG_XFS_POSIX_ACL) += $(XFS_LINUX)/xfs_acl.o
43xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o
44xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o
45xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o
46 27
28# highlevel code
29xfs-y += xfs_aops.o \
30 xfs_bit.o \
31 xfs_buf.o \
32 xfs_dfrag.o \
33 xfs_discard.o \
34 xfs_error.o \
35 xfs_export.o \
36 xfs_file.o \
37 xfs_filestream.o \
38 xfs_fsops.o \
39 xfs_fs_subr.o \
40 xfs_globals.o \
41 xfs_iget.o \
42 xfs_ioctl.o \
43 xfs_iomap.o \
44 xfs_iops.o \
45 xfs_itable.o \
46 xfs_message.o \
47 xfs_mru_cache.o \
48 xfs_super.o \
49 xfs_sync.o \
50 xfs_xattr.o \
51 xfs_rename.o \
52 xfs_rw.o \
53 xfs_utils.o \
54 xfs_vnodeops.o \
55 kmem.o \
56 uuid.o
47 57
58# code shared with libxfs
48xfs-y += xfs_alloc.o \ 59xfs-y += xfs_alloc.o \
49 xfs_alloc_btree.o \ 60 xfs_alloc_btree.o \
50 xfs_attr.o \ 61 xfs_attr.o \
51 xfs_attr_leaf.o \ 62 xfs_attr_leaf.o \
52 xfs_bit.o \
53 xfs_bmap.o \ 63 xfs_bmap.o \
54 xfs_bmap_btree.o \ 64 xfs_bmap_btree.o \
55 xfs_btree.o \ 65 xfs_btree.o \
56 xfs_buf_item.o \
57 xfs_da_btree.o \ 66 xfs_da_btree.o \
58 xfs_dir2.o \ 67 xfs_dir2.o \
59 xfs_dir2_block.o \ 68 xfs_dir2_block.o \
@@ -61,49 +70,37 @@ xfs-y += xfs_alloc.o \
61 xfs_dir2_leaf.o \ 70 xfs_dir2_leaf.o \
62 xfs_dir2_node.o \ 71 xfs_dir2_node.o \
63 xfs_dir2_sf.o \ 72 xfs_dir2_sf.o \
64 xfs_error.o \
65 xfs_extfree_item.o \
66 xfs_filestream.o \
67 xfs_fsops.o \
68 xfs_ialloc.o \ 73 xfs_ialloc.o \
69 xfs_ialloc_btree.o \ 74 xfs_ialloc_btree.o \
70 xfs_iget.o \
71 xfs_inode.o \ 75 xfs_inode.o \
72 xfs_inode_item.o \
73 xfs_iomap.o \
74 xfs_itable.o \
75 xfs_dfrag.o \
76 xfs_log.o \
77 xfs_log_cil.o \
78 xfs_log_recover.o \ 76 xfs_log_recover.o \
79 xfs_mount.o \ 77 xfs_mount.o \
80 xfs_mru_cache.o \ 78 xfs_trans.o
81 xfs_rename.o \ 79
82 xfs_trans.o \ 80# low-level transaction/log code
81xfs-y += xfs_log.o \
82 xfs_log_cil.o \
83 xfs_buf_item.o \
84 xfs_extfree_item.o \
85 xfs_inode_item.o \
83 xfs_trans_ail.o \ 86 xfs_trans_ail.o \
84 xfs_trans_buf.o \ 87 xfs_trans_buf.o \
85 xfs_trans_extfree.o \ 88 xfs_trans_extfree.o \
86 xfs_trans_inode.o \ 89 xfs_trans_inode.o \
87 xfs_utils.o \
88 xfs_vnodeops.o \
89 xfs_rw.o
90
91# Objects in linux/
92xfs-y += $(addprefix $(XFS_LINUX)/, \
93 kmem.o \
94 xfs_aops.o \
95 xfs_buf.o \
96 xfs_discard.o \
97 xfs_export.o \
98 xfs_file.o \
99 xfs_fs_subr.o \
100 xfs_globals.o \
101 xfs_ioctl.o \
102 xfs_iops.o \
103 xfs_message.o \
104 xfs_super.o \
105 xfs_sync.o \
106 xfs_xattr.o)
107 90
108# Objects in support/ 91# optional features
109xfs-y += support/uuid.o 92xfs-$(CONFIG_XFS_QUOTA) += xfs_dquot.o \
93 xfs_dquot_item.o \
94 xfs_trans_dquot.o \
95 xfs_qm_syscalls.o \
96 xfs_qm_bhv.o \
97 xfs_qm.o \
98 xfs_quotaops.o
99ifeq ($(CONFIG_XFS_QUOTA),y)
100xfs-$(CONFIG_PROC_FS) += xfs_qm_stats.o
101endif
102xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o
103xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o
104xfs-$(CONFIG_PROC_FS) += xfs_stats.o
105xfs-$(CONFIG_SYSCTL) += xfs_sysctl.o
106xfs-$(CONFIG_COMPAT) += xfs_ioctl32.o
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/kmem.c
index a907de565db3..a907de565db3 100644
--- a/fs/xfs/linux-2.6/kmem.c
+++ b/fs/xfs/kmem.c
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/kmem.h
index f7c8f7a9ea6d..f7c8f7a9ea6d 100644
--- a/fs/xfs/linux-2.6/kmem.h
+++ b/fs/xfs/kmem.h
diff --git a/fs/xfs/linux-2.6/mrlock.h b/fs/xfs/mrlock.h
index ff6a19873e5c..ff6a19873e5c 100644
--- a/fs/xfs/linux-2.6/mrlock.h
+++ b/fs/xfs/mrlock.h
diff --git a/fs/xfs/linux-2.6/time.h b/fs/xfs/time.h
index 387e695a184c..387e695a184c 100644
--- a/fs/xfs/linux-2.6/time.h
+++ b/fs/xfs/time.h
diff --git a/fs/xfs/support/uuid.c b/fs/xfs/uuid.c
index b83f76b6d410..b83f76b6d410 100644
--- a/fs/xfs/support/uuid.c
+++ b/fs/xfs/uuid.c
diff --git a/fs/xfs/support/uuid.h b/fs/xfs/uuid.h
index 4732d71262cc..4732d71262cc 100644
--- a/fs/xfs/support/uuid.h
+++ b/fs/xfs/uuid.h
diff --git a/fs/xfs/xfs.h b/fs/xfs/xfs.h
index 53ec3ea9a625..d8b11b7f94aa 100644
--- a/fs/xfs/xfs.h
+++ b/fs/xfs/xfs.h
@@ -24,5 +24,6 @@
24#define XFS_BUF_LOCK_TRACKING 1 24#define XFS_BUF_LOCK_TRACKING 1
25#endif 25#endif
26 26
27#include <linux-2.6/xfs_linux.h> 27#include "xfs_linux.h"
28
28#endif /* __XFS_H__ */ 29#endif /* __XFS_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/xfs_acl.c
index b6c4b3795c4a..b6c4b3795c4a 100644
--- a/fs/xfs/linux-2.6/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
index 6530769a999b..4805f009f923 100644
--- a/fs/xfs/xfs_ag.h
+++ b/fs/xfs/xfs_ag.h
@@ -103,7 +103,7 @@ typedef struct xfs_agf {
103/* disk block (xfs_daddr_t) in the AG */ 103/* disk block (xfs_daddr_t) in the AG */
104#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log)) 104#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))
105#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp)) 105#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
106#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp)) 106#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)((bp)->b_addr))
107 107
108extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp, 108extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
109 xfs_agnumber_t agno, int flags, struct xfs_buf **bpp); 109 xfs_agnumber_t agno, int flags, struct xfs_buf **bpp);
@@ -156,7 +156,7 @@ typedef struct xfs_agi {
156/* disk block (xfs_daddr_t) in the AG */ 156/* disk block (xfs_daddr_t) in the AG */
157#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log)) 157#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))
158#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp)) 158#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
159#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp)) 159#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)((bp)->b_addr))
160 160
161extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp, 161extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
162 xfs_agnumber_t agno, struct xfs_buf **bpp); 162 xfs_agnumber_t agno, struct xfs_buf **bpp);
@@ -168,7 +168,7 @@ extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
168#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) 168#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
169#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp)) 169#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
170#define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t)) 170#define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t))
171#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp)) 171#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr))
172 172
173typedef struct xfs_agfl { 173typedef struct xfs_agfl {
174 __be32 agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */ 174 __be32 agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 1e00b3ef6274..bdd9cb54d63b 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -451,8 +451,7 @@ xfs_alloc_read_agfl(
451 XFS_FSS_TO_BB(mp, 1), 0, &bp); 451 XFS_FSS_TO_BB(mp, 1), 0, &bp);
452 if (error) 452 if (error)
453 return error; 453 return error;
454 ASSERT(bp); 454 ASSERT(!xfs_buf_geterror(bp));
455 ASSERT(!XFS_BUF_GETERROR(bp));
456 XFS_BUF_SET_VTYPE_REF(bp, B_FS_AGFL, XFS_AGFL_REF); 455 XFS_BUF_SET_VTYPE_REF(bp, B_FS_AGFL, XFS_AGFL_REF);
457 *bpp = bp; 456 *bpp = bp;
458 return 0; 457 return 0;
@@ -2116,7 +2115,7 @@ xfs_read_agf(
2116 if (!*bpp) 2115 if (!*bpp)
2117 return 0; 2116 return 0;
2118 2117
2119 ASSERT(!XFS_BUF_GETERROR(*bpp)); 2118 ASSERT(!(*bpp)->b_error);
2120 agf = XFS_BUF_TO_AGF(*bpp); 2119 agf = XFS_BUF_TO_AGF(*bpp);
2121 2120
2122 /* 2121 /*
@@ -2168,7 +2167,7 @@ xfs_alloc_read_agf(
2168 return error; 2167 return error;
2169 if (!*bpp) 2168 if (!*bpp)
2170 return 0; 2169 return 0;
2171 ASSERT(!XFS_BUF_GETERROR(*bpp)); 2170 ASSERT(!(*bpp)->b_error);
2172 2171
2173 agf = XFS_BUF_TO_AGF(*bpp); 2172 agf = XFS_BUF_TO_AGF(*bpp);
2174 pag = xfs_perag_get(mp, agno); 2173 pag = xfs_perag_get(mp, agno);
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/xfs_aops.c
index 63e971e2b837..8c37dde4c521 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1300,6 +1300,7 @@ xfs_end_io_direct_write(
1300 bool is_async) 1300 bool is_async)
1301{ 1301{
1302 struct xfs_ioend *ioend = iocb->private; 1302 struct xfs_ioend *ioend = iocb->private;
1303 struct inode *inode = ioend->io_inode;
1303 1304
1304 /* 1305 /*
1305 * blockdev_direct_IO can return an error even after the I/O 1306 * blockdev_direct_IO can return an error even after the I/O
@@ -1331,7 +1332,7 @@ xfs_end_io_direct_write(
1331 } 1332 }
1332 1333
1333 /* XXX: probably should move into the real I/O completion handler */ 1334 /* XXX: probably should move into the real I/O completion handler */
1334 inode_dio_done(ioend->io_inode); 1335 inode_dio_done(inode);
1335} 1336}
1336 1337
1337STATIC ssize_t 1338STATIC ssize_t
diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/xfs_aops.h
index 71f721e1a71f..71f721e1a71f 100644
--- a/fs/xfs/linux-2.6/xfs_aops.h
+++ b/fs/xfs/xfs_aops.h
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index cbae424fe1ba..160bcdc34a6e 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -2121,8 +2121,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
2121 2121
2122 bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt, 2122 bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt,
2123 XBF_LOCK | XBF_DONT_BLOCK); 2123 XBF_LOCK | XBF_DONT_BLOCK);
2124 ASSERT(bp); 2124 ASSERT(!xfs_buf_geterror(bp));
2125 ASSERT(!XFS_BUF_GETERROR(bp));
2126 2125
2127 tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen : 2126 tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen :
2128 XFS_BUF_SIZE(bp); 2127 XFS_BUF_SIZE(bp);
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index ab3e5c6c4642..452a291383ab 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -3383,8 +3383,7 @@ xfs_bmap_local_to_extents(
3383 ASSERT(args.len == 1); 3383 ASSERT(args.len == 1);
3384 *firstblock = args.fsbno; 3384 *firstblock = args.fsbno;
3385 bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0); 3385 bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0);
3386 memcpy((char *)XFS_BUF_PTR(bp), ifp->if_u1.if_data, 3386 memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes);
3387 ifp->if_bytes);
3388 xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1); 3387 xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1);
3389 xfs_bmap_forkoff_reset(args.mp, ip, whichfork); 3388 xfs_bmap_forkoff_reset(args.mp, ip, whichfork);
3390 xfs_idata_realloc(ip, -ifp->if_bytes, whichfork); 3389 xfs_idata_realloc(ip, -ifp->if_bytes, whichfork);
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index cabf4b5604aa..2b9fd385e27d 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -275,8 +275,7 @@ xfs_btree_dup_cursor(
275 return error; 275 return error;
276 } 276 }
277 new->bc_bufs[i] = bp; 277 new->bc_bufs[i] = bp;
278 ASSERT(bp); 278 ASSERT(!xfs_buf_geterror(bp));
279 ASSERT(!XFS_BUF_GETERROR(bp));
280 } else 279 } else
281 new->bc_bufs[i] = NULL; 280 new->bc_bufs[i] = NULL;
282 } 281 }
@@ -467,8 +466,7 @@ xfs_btree_get_bufl(
467 ASSERT(fsbno != NULLFSBLOCK); 466 ASSERT(fsbno != NULLFSBLOCK);
468 d = XFS_FSB_TO_DADDR(mp, fsbno); 467 d = XFS_FSB_TO_DADDR(mp, fsbno);
469 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock); 468 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock);
470 ASSERT(bp); 469 ASSERT(!xfs_buf_geterror(bp));
471 ASSERT(!XFS_BUF_GETERROR(bp));
472 return bp; 470 return bp;
473} 471}
474 472
@@ -491,8 +489,7 @@ xfs_btree_get_bufs(
491 ASSERT(agbno != NULLAGBLOCK); 489 ASSERT(agbno != NULLAGBLOCK);
492 d = XFS_AGB_TO_DADDR(mp, agno, agbno); 490 d = XFS_AGB_TO_DADDR(mp, agno, agbno);
493 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock); 491 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock);
494 ASSERT(bp); 492 ASSERT(!xfs_buf_geterror(bp));
495 ASSERT(!XFS_BUF_GETERROR(bp));
496 return bp; 493 return bp;
497} 494}
498 495
@@ -632,7 +629,7 @@ xfs_btree_read_bufl(
632 mp->m_bsize, lock, &bp))) { 629 mp->m_bsize, lock, &bp))) {
633 return error; 630 return error;
634 } 631 }
635 ASSERT(!bp || !XFS_BUF_GETERROR(bp)); 632 ASSERT(!xfs_buf_geterror(bp));
636 if (bp) 633 if (bp)
637 XFS_BUF_SET_VTYPE_REF(bp, B_FS_MAP, refval); 634 XFS_BUF_SET_VTYPE_REF(bp, B_FS_MAP, refval);
638 *bpp = bp; 635 *bpp = bp;
@@ -973,8 +970,7 @@ xfs_btree_get_buf_block(
973 *bpp = xfs_trans_get_buf(cur->bc_tp, mp->m_ddev_targp, d, 970 *bpp = xfs_trans_get_buf(cur->bc_tp, mp->m_ddev_targp, d,
974 mp->m_bsize, flags); 971 mp->m_bsize, flags);
975 972
976 ASSERT(*bpp); 973 ASSERT(!xfs_buf_geterror(*bpp));
977 ASSERT(!XFS_BUF_GETERROR(*bpp));
978 974
979 *block = XFS_BUF_TO_BLOCK(*bpp); 975 *block = XFS_BUF_TO_BLOCK(*bpp);
980 return 0; 976 return 0;
@@ -1006,8 +1002,7 @@ xfs_btree_read_buf_block(
1006 if (error) 1002 if (error)
1007 return error; 1003 return error;
1008 1004
1009 ASSERT(*bpp != NULL); 1005 ASSERT(!xfs_buf_geterror(*bpp));
1010 ASSERT(!XFS_BUF_GETERROR(*bpp));
1011 1006
1012 xfs_btree_set_refs(cur, *bpp); 1007 xfs_btree_set_refs(cur, *bpp);
1013 *block = XFS_BUF_TO_BLOCK(*bpp); 1008 *block = XFS_BUF_TO_BLOCK(*bpp);
diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h
index 8d05a6a46ce3..5b240de104c0 100644
--- a/fs/xfs/xfs_btree.h
+++ b/fs/xfs/xfs_btree.h
@@ -262,7 +262,7 @@ typedef struct xfs_btree_cur
262/* 262/*
263 * Convert from buffer to btree block header. 263 * Convert from buffer to btree block header.
264 */ 264 */
265#define XFS_BUF_TO_BLOCK(bp) ((struct xfs_btree_block *)XFS_BUF_PTR(bp)) 265#define XFS_BUF_TO_BLOCK(bp) ((struct xfs_btree_block *)((bp)->b_addr))
266 266
267 267
268/* 268/*
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/xfs_buf.c
index d1fe74506c4c..c57836dc778f 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -596,7 +596,7 @@ _xfs_buf_read(
596 bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD); 596 bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD);
597 597
598 status = xfs_buf_iorequest(bp); 598 status = xfs_buf_iorequest(bp);
599 if (status || XFS_BUF_ISERROR(bp) || (flags & XBF_ASYNC)) 599 if (status || bp->b_error || (flags & XBF_ASYNC))
600 return status; 600 return status;
601 return xfs_buf_iowait(bp); 601 return xfs_buf_iowait(bp);
602} 602}
@@ -679,7 +679,6 @@ xfs_buf_read_uncached(
679 /* set up the buffer for a read IO */ 679 /* set up the buffer for a read IO */
680 XFS_BUF_SET_ADDR(bp, daddr); 680 XFS_BUF_SET_ADDR(bp, daddr);
681 XFS_BUF_READ(bp); 681 XFS_BUF_READ(bp);
682 XFS_BUF_BUSY(bp);
683 682
684 xfsbdstrat(mp, bp); 683 xfsbdstrat(mp, bp);
685 error = xfs_buf_iowait(bp); 684 error = xfs_buf_iowait(bp);
@@ -1069,7 +1068,7 @@ xfs_bioerror(
1069 /* 1068 /*
1070 * No need to wait until the buffer is unpinned, we aren't flushing it. 1069 * No need to wait until the buffer is unpinned, we aren't flushing it.
1071 */ 1070 */
1072 XFS_BUF_ERROR(bp, EIO); 1071 xfs_buf_ioerror(bp, EIO);
1073 1072
1074 /* 1073 /*
1075 * We're calling xfs_buf_ioend, so delete XBF_DONE flag. 1074 * We're calling xfs_buf_ioend, so delete XBF_DONE flag.
@@ -1094,7 +1093,7 @@ STATIC int
1094xfs_bioerror_relse( 1093xfs_bioerror_relse(
1095 struct xfs_buf *bp) 1094 struct xfs_buf *bp)
1096{ 1095{
1097 int64_t fl = XFS_BUF_BFLAGS(bp); 1096 int64_t fl = bp->b_flags;
1098 /* 1097 /*
1099 * No need to wait until the buffer is unpinned. 1098 * No need to wait until the buffer is unpinned.
1100 * We aren't flushing it. 1099 * We aren't flushing it.
@@ -1115,7 +1114,7 @@ xfs_bioerror_relse(
1115 * There's no reason to mark error for 1114 * There's no reason to mark error for
1116 * ASYNC buffers. 1115 * ASYNC buffers.
1117 */ 1116 */
1118 XFS_BUF_ERROR(bp, EIO); 1117 xfs_buf_ioerror(bp, EIO);
1119 XFS_BUF_FINISH_IOWAIT(bp); 1118 XFS_BUF_FINISH_IOWAIT(bp);
1120 } else { 1119 } else {
1121 xfs_buf_relse(bp); 1120 xfs_buf_relse(bp);
@@ -1324,7 +1323,7 @@ xfs_buf_offset(
1324 struct page *page; 1323 struct page *page;
1325 1324
1326 if (bp->b_flags & XBF_MAPPED) 1325 if (bp->b_flags & XBF_MAPPED)
1327 return XFS_BUF_PTR(bp) + offset; 1326 return bp->b_addr + offset;
1328 1327
1329 offset += bp->b_offset; 1328 offset += bp->b_offset;
1330 page = bp->b_pages[offset >> PAGE_SHIFT]; 1329 page = bp->b_pages[offset >> PAGE_SHIFT];
@@ -1484,7 +1483,7 @@ xfs_setsize_buftarg_flags(
1484 if (set_blocksize(btp->bt_bdev, sectorsize)) { 1483 if (set_blocksize(btp->bt_bdev, sectorsize)) {
1485 xfs_warn(btp->bt_mount, 1484 xfs_warn(btp->bt_mount,
1486 "Cannot set_blocksize to %u on device %s\n", 1485 "Cannot set_blocksize to %u on device %s\n",
1487 sectorsize, XFS_BUFTARG_NAME(btp)); 1486 sectorsize, xfs_buf_target_name(btp));
1488 return EINVAL; 1487 return EINVAL;
1489 } 1488 }
1490 1489
@@ -1681,7 +1680,7 @@ xfs_buf_delwri_split(
1681 list_for_each_entry_safe(bp, n, dwq, b_list) { 1680 list_for_each_entry_safe(bp, n, dwq, b_list) {
1682 ASSERT(bp->b_flags & XBF_DELWRI); 1681 ASSERT(bp->b_flags & XBF_DELWRI);
1683 1682
1684 if (!XFS_BUF_ISPINNED(bp) && xfs_buf_trylock(bp)) { 1683 if (!xfs_buf_ispinned(bp) && xfs_buf_trylock(bp)) {
1685 if (!force && 1684 if (!force &&
1686 time_before(jiffies, bp->b_queuetime + age)) { 1685 time_before(jiffies, bp->b_queuetime + age)) {
1687 xfs_buf_unlock(bp); 1686 xfs_buf_unlock(bp);
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/xfs_buf.h
index 6a83b46b4bcf..620972b8094d 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -228,11 +228,15 @@ extern void xfs_buf_delwri_promote(xfs_buf_t *);
228extern int xfs_buf_init(void); 228extern int xfs_buf_init(void);
229extern void xfs_buf_terminate(void); 229extern void xfs_buf_terminate(void);
230 230
231#define xfs_buf_target_name(target) \ 231static inline const char *
232 ({ char __b[BDEVNAME_SIZE]; bdevname((target)->bt_bdev, __b); __b; }) 232xfs_buf_target_name(struct xfs_buftarg *target)
233{
234 static char __b[BDEVNAME_SIZE];
235
236 return bdevname(target->bt_bdev, __b);
237}
233 238
234 239
235#define XFS_BUF_BFLAGS(bp) ((bp)->b_flags)
236#define XFS_BUF_ZEROFLAGS(bp) \ 240#define XFS_BUF_ZEROFLAGS(bp) \
237 ((bp)->b_flags &= ~(XBF_READ|XBF_WRITE|XBF_ASYNC|XBF_DELWRI| \ 241 ((bp)->b_flags &= ~(XBF_READ|XBF_WRITE|XBF_ASYNC|XBF_DELWRI| \
238 XBF_SYNCIO|XBF_FUA|XBF_FLUSH)) 242 XBF_SYNCIO|XBF_FUA|XBF_FLUSH))
@@ -251,23 +255,14 @@ void xfs_buf_stale(struct xfs_buf *bp);
251#define XFS_BUF_UNDELAYWRITE(bp) xfs_buf_delwri_dequeue(bp) 255#define XFS_BUF_UNDELAYWRITE(bp) xfs_buf_delwri_dequeue(bp)
252#define XFS_BUF_ISDELAYWRITE(bp) ((bp)->b_flags & XBF_DELWRI) 256#define XFS_BUF_ISDELAYWRITE(bp) ((bp)->b_flags & XBF_DELWRI)
253 257
254#define XFS_BUF_ERROR(bp,no) xfs_buf_ioerror(bp,no)
255#define XFS_BUF_GETERROR(bp) xfs_buf_geterror(bp)
256#define XFS_BUF_ISERROR(bp) (xfs_buf_geterror(bp) ? 1 : 0)
257
258#define XFS_BUF_DONE(bp) ((bp)->b_flags |= XBF_DONE) 258#define XFS_BUF_DONE(bp) ((bp)->b_flags |= XBF_DONE)
259#define XFS_BUF_UNDONE(bp) ((bp)->b_flags &= ~XBF_DONE) 259#define XFS_BUF_UNDONE(bp) ((bp)->b_flags &= ~XBF_DONE)
260#define XFS_BUF_ISDONE(bp) ((bp)->b_flags & XBF_DONE) 260#define XFS_BUF_ISDONE(bp) ((bp)->b_flags & XBF_DONE)
261 261
262#define XFS_BUF_BUSY(bp) do { } while (0)
263#define XFS_BUF_UNBUSY(bp) do { } while (0)
264#define XFS_BUF_ISBUSY(bp) (1)
265
266#define XFS_BUF_ASYNC(bp) ((bp)->b_flags |= XBF_ASYNC) 262#define XFS_BUF_ASYNC(bp) ((bp)->b_flags |= XBF_ASYNC)
267#define XFS_BUF_UNASYNC(bp) ((bp)->b_flags &= ~XBF_ASYNC) 263#define XFS_BUF_UNASYNC(bp) ((bp)->b_flags &= ~XBF_ASYNC)
268#define XFS_BUF_ISASYNC(bp) ((bp)->b_flags & XBF_ASYNC) 264#define XFS_BUF_ISASYNC(bp) ((bp)->b_flags & XBF_ASYNC)
269 265
270#define XFS_BUF_HOLD(bp) xfs_buf_hold(bp)
271#define XFS_BUF_READ(bp) ((bp)->b_flags |= XBF_READ) 266#define XFS_BUF_READ(bp) ((bp)->b_flags |= XBF_READ)
272#define XFS_BUF_UNREAD(bp) ((bp)->b_flags &= ~XBF_READ) 267#define XFS_BUF_UNREAD(bp) ((bp)->b_flags &= ~XBF_READ)
273#define XFS_BUF_ISREAD(bp) ((bp)->b_flags & XBF_READ) 268#define XFS_BUF_ISREAD(bp) ((bp)->b_flags & XBF_READ)
@@ -276,10 +271,6 @@ void xfs_buf_stale(struct xfs_buf *bp);
276#define XFS_BUF_UNWRITE(bp) ((bp)->b_flags &= ~XBF_WRITE) 271#define XFS_BUF_UNWRITE(bp) ((bp)->b_flags &= ~XBF_WRITE)
277#define XFS_BUF_ISWRITE(bp) ((bp)->b_flags & XBF_WRITE) 272#define XFS_BUF_ISWRITE(bp) ((bp)->b_flags & XBF_WRITE)
278 273
279#define XFS_BUF_SET_START(bp) do { } while (0)
280
281#define XFS_BUF_PTR(bp) (xfs_caddr_t)((bp)->b_addr)
282#define XFS_BUF_SET_PTR(bp, val, cnt) xfs_buf_associate_memory(bp, val, cnt)
283#define XFS_BUF_ADDR(bp) ((bp)->b_bn) 274#define XFS_BUF_ADDR(bp) ((bp)->b_bn)
284#define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_bn = (xfs_daddr_t)(bno)) 275#define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_bn = (xfs_daddr_t)(bno))
285#define XFS_BUF_OFFSET(bp) ((bp)->b_file_offset) 276#define XFS_BUF_OFFSET(bp) ((bp)->b_file_offset)
@@ -299,14 +290,13 @@ xfs_buf_set_ref(
299#define XFS_BUF_SET_VTYPE_REF(bp, type, ref) xfs_buf_set_ref(bp, ref) 290#define XFS_BUF_SET_VTYPE_REF(bp, type, ref) xfs_buf_set_ref(bp, ref)
300#define XFS_BUF_SET_VTYPE(bp, type) do { } while (0) 291#define XFS_BUF_SET_VTYPE(bp, type) do { } while (0)
301 292
302#define XFS_BUF_ISPINNED(bp) atomic_read(&((bp)->b_pin_count)) 293static inline int xfs_buf_ispinned(struct xfs_buf *bp)
294{
295 return atomic_read(&bp->b_pin_count);
296}
303 297
304#define XFS_BUF_FINISH_IOWAIT(bp) complete(&bp->b_iowait); 298#define XFS_BUF_FINISH_IOWAIT(bp) complete(&bp->b_iowait);
305 299
306#define XFS_BUF_SET_TARGET(bp, target) ((bp)->b_target = (target))
307#define XFS_BUF_TARGET(bp) ((bp)->b_target)
308#define XFS_BUFTARG_NAME(target) xfs_buf_target_name(target)
309
310static inline void xfs_buf_relse(xfs_buf_t *bp) 300static inline void xfs_buf_relse(xfs_buf_t *bp)
311{ 301{
312 xfs_buf_unlock(bp); 302 xfs_buf_unlock(bp);
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 88492916c3dc..ef43fce519a1 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -124,9 +124,9 @@ xfs_buf_item_log_check(
124 124
125 bp = bip->bli_buf; 125 bp = bip->bli_buf;
126 ASSERT(XFS_BUF_COUNT(bp) > 0); 126 ASSERT(XFS_BUF_COUNT(bp) > 0);
127 ASSERT(XFS_BUF_PTR(bp) != NULL); 127 ASSERT(bp->b_addr != NULL);
128 orig = bip->bli_orig; 128 orig = bip->bli_orig;
129 buffer = XFS_BUF_PTR(bp); 129 buffer = bp->b_addr;
130 for (x = 0; x < XFS_BUF_COUNT(bp); x++) { 130 for (x = 0; x < XFS_BUF_COUNT(bp); x++) {
131 if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) { 131 if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) {
132 xfs_emerg(bp->b_mount, 132 xfs_emerg(bp->b_mount,
@@ -371,7 +371,6 @@ xfs_buf_item_pin(
371{ 371{
372 struct xfs_buf_log_item *bip = BUF_ITEM(lip); 372 struct xfs_buf_log_item *bip = BUF_ITEM(lip);
373 373
374 ASSERT(XFS_BUF_ISBUSY(bip->bli_buf));
375 ASSERT(atomic_read(&bip->bli_refcount) > 0); 374 ASSERT(atomic_read(&bip->bli_refcount) > 0);
376 ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || 375 ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
377 (bip->bli_flags & XFS_BLI_STALE)); 376 (bip->bli_flags & XFS_BLI_STALE));
@@ -479,13 +478,13 @@ xfs_buf_item_trylock(
479 struct xfs_buf_log_item *bip = BUF_ITEM(lip); 478 struct xfs_buf_log_item *bip = BUF_ITEM(lip);
480 struct xfs_buf *bp = bip->bli_buf; 479 struct xfs_buf *bp = bip->bli_buf;
481 480
482 if (XFS_BUF_ISPINNED(bp)) 481 if (xfs_buf_ispinned(bp))
483 return XFS_ITEM_PINNED; 482 return XFS_ITEM_PINNED;
484 if (!xfs_buf_trylock(bp)) 483 if (!xfs_buf_trylock(bp))
485 return XFS_ITEM_LOCKED; 484 return XFS_ITEM_LOCKED;
486 485
487 /* take a reference to the buffer. */ 486 /* take a reference to the buffer. */
488 XFS_BUF_HOLD(bp); 487 xfs_buf_hold(bp);
489 488
490 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 489 ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
491 trace_xfs_buf_item_trylock(bip); 490 trace_xfs_buf_item_trylock(bip);
@@ -630,7 +629,7 @@ xfs_buf_item_push(
630 * the xfsbufd to get this buffer written. We have to unlock the buffer 629 * the xfsbufd to get this buffer written. We have to unlock the buffer
631 * to allow the xfsbufd to write it, too. 630 * to allow the xfsbufd to write it, too.
632 */ 631 */
633STATIC void 632STATIC bool
634xfs_buf_item_pushbuf( 633xfs_buf_item_pushbuf(
635 struct xfs_log_item *lip) 634 struct xfs_log_item *lip)
636{ 635{
@@ -644,6 +643,7 @@ xfs_buf_item_pushbuf(
644 643
645 xfs_buf_delwri_promote(bp); 644 xfs_buf_delwri_promote(bp);
646 xfs_buf_relse(bp); 645 xfs_buf_relse(bp);
646 return true;
647} 647}
648 648
649STATIC void 649STATIC void
@@ -726,7 +726,7 @@ xfs_buf_item_init(
726 * to have logged. 726 * to have logged.
727 */ 727 */
728 bip->bli_orig = (char *)kmem_alloc(XFS_BUF_COUNT(bp), KM_SLEEP); 728 bip->bli_orig = (char *)kmem_alloc(XFS_BUF_COUNT(bp), KM_SLEEP);
729 memcpy(bip->bli_orig, XFS_BUF_PTR(bp), XFS_BUF_COUNT(bp)); 729 memcpy(bip->bli_orig, bp->b_addr, XFS_BUF_COUNT(bp));
730 bip->bli_logged = (char *)kmem_zalloc(XFS_BUF_COUNT(bp) / NBBY, KM_SLEEP); 730 bip->bli_logged = (char *)kmem_zalloc(XFS_BUF_COUNT(bp) / NBBY, KM_SLEEP);
731#endif 731#endif
732 732
@@ -895,7 +895,6 @@ xfs_buf_attach_iodone(
895{ 895{
896 xfs_log_item_t *head_lip; 896 xfs_log_item_t *head_lip;
897 897
898 ASSERT(XFS_BUF_ISBUSY(bp));
899 ASSERT(xfs_buf_islocked(bp)); 898 ASSERT(xfs_buf_islocked(bp));
900 899
901 lip->li_cb = cb; 900 lip->li_cb = cb;
@@ -960,7 +959,7 @@ xfs_buf_iodone_callbacks(
960 static ulong lasttime; 959 static ulong lasttime;
961 static xfs_buftarg_t *lasttarg; 960 static xfs_buftarg_t *lasttarg;
962 961
963 if (likely(!XFS_BUF_GETERROR(bp))) 962 if (likely(!xfs_buf_geterror(bp)))
964 goto do_callbacks; 963 goto do_callbacks;
965 964
966 /* 965 /*
@@ -973,14 +972,14 @@ xfs_buf_iodone_callbacks(
973 goto do_callbacks; 972 goto do_callbacks;
974 } 973 }
975 974
976 if (XFS_BUF_TARGET(bp) != lasttarg || 975 if (bp->b_target != lasttarg ||
977 time_after(jiffies, (lasttime + 5*HZ))) { 976 time_after(jiffies, (lasttime + 5*HZ))) {
978 lasttime = jiffies; 977 lasttime = jiffies;
979 xfs_alert(mp, "Device %s: metadata write error block 0x%llx", 978 xfs_alert(mp, "Device %s: metadata write error block 0x%llx",
980 XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)), 979 xfs_buf_target_name(bp->b_target),
981 (__uint64_t)XFS_BUF_ADDR(bp)); 980 (__uint64_t)XFS_BUF_ADDR(bp));
982 } 981 }
983 lasttarg = XFS_BUF_TARGET(bp); 982 lasttarg = bp->b_target;
984 983
985 /* 984 /*
986 * If the write was asynchronous then no one will be looking for the 985 * If the write was asynchronous then no one will be looking for the
@@ -991,12 +990,11 @@ xfs_buf_iodone_callbacks(
991 * around. 990 * around.
992 */ 991 */
993 if (XFS_BUF_ISASYNC(bp)) { 992 if (XFS_BUF_ISASYNC(bp)) {
994 XFS_BUF_ERROR(bp, 0); /* errno of 0 unsets the flag */ 993 xfs_buf_ioerror(bp, 0); /* errno of 0 unsets the flag */
995 994
996 if (!XFS_BUF_ISSTALE(bp)) { 995 if (!XFS_BUF_ISSTALE(bp)) {
997 XFS_BUF_DELAYWRITE(bp); 996 XFS_BUF_DELAYWRITE(bp);
998 XFS_BUF_DONE(bp); 997 XFS_BUF_DONE(bp);
999 XFS_BUF_SET_START(bp);
1000 } 998 }
1001 ASSERT(bp->b_iodone != NULL); 999 ASSERT(bp->b_iodone != NULL);
1002 trace_xfs_buf_item_iodone_async(bp, _RET_IP_); 1000 trace_xfs_buf_item_iodone_async(bp, _RET_IP_);
@@ -1013,7 +1011,6 @@ xfs_buf_iodone_callbacks(
1013 XFS_BUF_UNDELAYWRITE(bp); 1011 XFS_BUF_UNDELAYWRITE(bp);
1014 1012
1015 trace_xfs_buf_error_relse(bp, _RET_IP_); 1013 trace_xfs_buf_error_relse(bp, _RET_IP_);
1016 xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
1017 1014
1018do_callbacks: 1015do_callbacks:
1019 xfs_buf_do_callbacks(bp); 1016 xfs_buf_do_callbacks(bp);
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 5bfcb8779f9f..ee9d5427fcd4 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -2050,7 +2050,7 @@ xfs_da_do_buf(
2050 case 0: 2050 case 0:
2051 bp = xfs_trans_get_buf(trans, mp->m_ddev_targp, 2051 bp = xfs_trans_get_buf(trans, mp->m_ddev_targp,
2052 mappedbno, nmapped, 0); 2052 mappedbno, nmapped, 0);
2053 error = bp ? XFS_BUF_GETERROR(bp) : XFS_ERROR(EIO); 2053 error = bp ? bp->b_error : XFS_ERROR(EIO);
2054 break; 2054 break;
2055 case 1: 2055 case 1:
2056 case 2: 2056 case 2:
@@ -2268,7 +2268,7 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps)
2268 dabuf->nbuf = 1; 2268 dabuf->nbuf = 1;
2269 bp = bps[0]; 2269 bp = bps[0];
2270 dabuf->bbcount = (short)BTOBB(XFS_BUF_COUNT(bp)); 2270 dabuf->bbcount = (short)BTOBB(XFS_BUF_COUNT(bp));
2271 dabuf->data = XFS_BUF_PTR(bp); 2271 dabuf->data = bp->b_addr;
2272 dabuf->bps[0] = bp; 2272 dabuf->bps[0] = bp;
2273 } else { 2273 } else {
2274 dabuf->nbuf = nbuf; 2274 dabuf->nbuf = nbuf;
@@ -2279,7 +2279,7 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps)
2279 dabuf->data = kmem_alloc(BBTOB(dabuf->bbcount), KM_SLEEP); 2279 dabuf->data = kmem_alloc(BBTOB(dabuf->bbcount), KM_SLEEP);
2280 for (i = off = 0; i < nbuf; i++, off += XFS_BUF_COUNT(bp)) { 2280 for (i = off = 0; i < nbuf; i++, off += XFS_BUF_COUNT(bp)) {
2281 bp = bps[i]; 2281 bp = bps[i];
2282 memcpy((char *)dabuf->data + off, XFS_BUF_PTR(bp), 2282 memcpy((char *)dabuf->data + off, bp->b_addr,
2283 XFS_BUF_COUNT(bp)); 2283 XFS_BUF_COUNT(bp));
2284 } 2284 }
2285 } 2285 }
@@ -2302,8 +2302,8 @@ xfs_da_buf_clean(xfs_dabuf_t *dabuf)
2302 for (i = off = 0; i < dabuf->nbuf; 2302 for (i = off = 0; i < dabuf->nbuf;
2303 i++, off += XFS_BUF_COUNT(bp)) { 2303 i++, off += XFS_BUF_COUNT(bp)) {
2304 bp = dabuf->bps[i]; 2304 bp = dabuf->bps[i];
2305 memcpy(XFS_BUF_PTR(bp), (char *)dabuf->data + off, 2305 memcpy(bp->b_addr, dabuf->data + off,
2306 XFS_BUF_COUNT(bp)); 2306 XFS_BUF_COUNT(bp));
2307 } 2307 }
2308 } 2308 }
2309} 2309}
@@ -2340,7 +2340,7 @@ xfs_da_log_buf(xfs_trans_t *tp, xfs_dabuf_t *dabuf, uint first, uint last)
2340 2340
2341 ASSERT(dabuf->nbuf && dabuf->data && dabuf->bbcount && dabuf->bps[0]); 2341 ASSERT(dabuf->nbuf && dabuf->data && dabuf->bbcount && dabuf->bps[0]);
2342 if (dabuf->nbuf == 1) { 2342 if (dabuf->nbuf == 1) {
2343 ASSERT(dabuf->data == (void *)XFS_BUF_PTR(dabuf->bps[0])); 2343 ASSERT(dabuf->data == dabuf->bps[0]->b_addr);
2344 xfs_trans_log_buf(tp, dabuf->bps[0], first, last); 2344 xfs_trans_log_buf(tp, dabuf->bps[0], first, last);
2345 return; 2345 return;
2346 } 2346 }
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h
index dffba9ba0db6..a3721633abc8 100644
--- a/fs/xfs/xfs_dinode.h
+++ b/fs/xfs/xfs_dinode.h
@@ -148,7 +148,7 @@ typedef enum xfs_dinode_fmt {
148 be32_to_cpu((dip)->di_nextents) : \ 148 be32_to_cpu((dip)->di_nextents) : \
149 be16_to_cpu((dip)->di_anextents)) 149 be16_to_cpu((dip)->di_anextents))
150 150
151#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp)) 151#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)((bp)->b_addr))
152 152
153/* 153/*
154 * For block and character special files the 32bit dev_t is stored at the 154 * For block and character special files the 32bit dev_t is stored at the
diff --git a/fs/xfs/linux-2.6/xfs_discard.c b/fs/xfs/xfs_discard.c
index 244e797dae32..244e797dae32 100644
--- a/fs/xfs/linux-2.6/xfs_discard.c
+++ b/fs/xfs/xfs_discard.c
diff --git a/fs/xfs/linux-2.6/xfs_discard.h b/fs/xfs/xfs_discard.h
index 344879aea646..344879aea646 100644
--- a/fs/xfs/linux-2.6/xfs_discard.h
+++ b/fs/xfs/xfs_discard.h
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 837f31158d43..db62959bed13 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -318,10 +318,9 @@ xfs_qm_init_dquot_blk(
318 int curid, i; 318 int curid, i;
319 319
320 ASSERT(tp); 320 ASSERT(tp);
321 ASSERT(XFS_BUF_ISBUSY(bp));
322 ASSERT(xfs_buf_islocked(bp)); 321 ASSERT(xfs_buf_islocked(bp));
323 322
324 d = (xfs_dqblk_t *)XFS_BUF_PTR(bp); 323 d = bp->b_addr;
325 324
326 /* 325 /*
327 * ID of the first dquot in the block - id's are zero based. 326 * ID of the first dquot in the block - id's are zero based.
@@ -403,7 +402,7 @@ xfs_qm_dqalloc(
403 dqp->q_blkno, 402 dqp->q_blkno,
404 mp->m_quotainfo->qi_dqchunklen, 403 mp->m_quotainfo->qi_dqchunklen,
405 0); 404 0);
406 if (!bp || (error = XFS_BUF_GETERROR(bp))) 405 if (!bp || (error = xfs_buf_geterror(bp)))
407 goto error1; 406 goto error1;
408 /* 407 /*
409 * Make a chunk of dquots out of this buffer and log 408 * Make a chunk of dquots out of this buffer and log
@@ -534,13 +533,12 @@ xfs_qm_dqtobp(
534 return XFS_ERROR(error); 533 return XFS_ERROR(error);
535 } 534 }
536 535
537 ASSERT(XFS_BUF_ISBUSY(bp));
538 ASSERT(xfs_buf_islocked(bp)); 536 ASSERT(xfs_buf_islocked(bp));
539 537
540 /* 538 /*
541 * calculate the location of the dquot inside the buffer. 539 * calculate the location of the dquot inside the buffer.
542 */ 540 */
543 ddq = (struct xfs_disk_dquot *)(XFS_BUF_PTR(bp) + dqp->q_bufoffset); 541 ddq = bp->b_addr + dqp->q_bufoffset;
544 542
545 /* 543 /*
546 * A simple sanity check in case we got a corrupted dquot... 544 * A simple sanity check in case we got a corrupted dquot...
@@ -553,7 +551,6 @@ xfs_qm_dqtobp(
553 xfs_trans_brelse(tp, bp); 551 xfs_trans_brelse(tp, bp);
554 return XFS_ERROR(EIO); 552 return XFS_ERROR(EIO);
555 } 553 }
556 XFS_BUF_BUSY(bp); /* We dirtied this */
557 } 554 }
558 555
559 *O_bpp = bp; 556 *O_bpp = bp;
@@ -622,7 +619,6 @@ xfs_qm_dqread(
622 * this particular dquot was repaired. We still aren't afraid to 619 * this particular dquot was repaired. We still aren't afraid to
623 * brelse it because we have the changes incore. 620 * brelse it because we have the changes incore.
624 */ 621 */
625 ASSERT(XFS_BUF_ISBUSY(bp));
626 ASSERT(xfs_buf_islocked(bp)); 622 ASSERT(xfs_buf_islocked(bp));
627 xfs_trans_brelse(tp, bp); 623 xfs_trans_brelse(tp, bp);
628 624
@@ -1204,7 +1200,7 @@ xfs_qm_dqflush(
1204 /* 1200 /*
1205 * Calculate the location of the dquot inside the buffer. 1201 * Calculate the location of the dquot inside the buffer.
1206 */ 1202 */
1207 ddqp = (struct xfs_disk_dquot *)(XFS_BUF_PTR(bp) + dqp->q_bufoffset); 1203 ddqp = bp->b_addr + dqp->q_bufoffset;
1208 1204
1209 /* 1205 /*
1210 * A simple sanity check in case we got a corrupted dquot.. 1206 * A simple sanity check in case we got a corrupted dquot..
@@ -1240,7 +1236,7 @@ xfs_qm_dqflush(
1240 * If the buffer is pinned then push on the log so we won't 1236 * If the buffer is pinned then push on the log so we won't
1241 * get stuck waiting in the write for too long. 1237 * get stuck waiting in the write for too long.
1242 */ 1238 */
1243 if (XFS_BUF_ISPINNED(bp)) { 1239 if (xfs_buf_ispinned(bp)) {
1244 trace_xfs_dqflush_force(dqp); 1240 trace_xfs_dqflush_force(dqp);
1245 xfs_log_force(mp, 0); 1241 xfs_log_force(mp, 0);
1246 } 1242 }
@@ -1447,7 +1443,7 @@ xfs_qm_dqflock_pushbuf_wait(
1447 goto out_lock; 1443 goto out_lock;
1448 1444
1449 if (XFS_BUF_ISDELAYWRITE(bp)) { 1445 if (XFS_BUF_ISDELAYWRITE(bp)) {
1450 if (XFS_BUF_ISPINNED(bp)) 1446 if (xfs_buf_ispinned(bp))
1451 xfs_log_force(mp, 0); 1447 xfs_log_force(mp, 0);
1452 xfs_buf_delwri_promote(bp); 1448 xfs_buf_delwri_promote(bp);
1453 wake_up_process(bp->b_target->bt_task); 1449 wake_up_process(bp->b_target->bt_task);
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/xfs_dquot.h
index 34b7e945dbfa..34b7e945dbfa 100644
--- a/fs/xfs/quota/xfs_dquot.h
+++ b/fs/xfs/xfs_dquot.h
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/xfs_dquot_item.c
index 9e0e2fa3f2c8..bb3f71d236d2 100644
--- a/fs/xfs/quota/xfs_dquot_item.c
+++ b/fs/xfs/xfs_dquot_item.c
@@ -183,13 +183,14 @@ xfs_qm_dqunpin_wait(
183 * search the buffer cache can be a time consuming thing, and AIL lock is a 183 * search the buffer cache can be a time consuming thing, and AIL lock is a
184 * spinlock. 184 * spinlock.
185 */ 185 */
186STATIC void 186STATIC bool
187xfs_qm_dquot_logitem_pushbuf( 187xfs_qm_dquot_logitem_pushbuf(
188 struct xfs_log_item *lip) 188 struct xfs_log_item *lip)
189{ 189{
190 struct xfs_dq_logitem *qlip = DQUOT_ITEM(lip); 190 struct xfs_dq_logitem *qlip = DQUOT_ITEM(lip);
191 struct xfs_dquot *dqp = qlip->qli_dquot; 191 struct xfs_dquot *dqp = qlip->qli_dquot;
192 struct xfs_buf *bp; 192 struct xfs_buf *bp;
193 bool ret = true;
193 194
194 ASSERT(XFS_DQ_IS_LOCKED(dqp)); 195 ASSERT(XFS_DQ_IS_LOCKED(dqp));
195 196
@@ -201,17 +202,20 @@ xfs_qm_dquot_logitem_pushbuf(
201 if (completion_done(&dqp->q_flush) || 202 if (completion_done(&dqp->q_flush) ||
202 !(lip->li_flags & XFS_LI_IN_AIL)) { 203 !(lip->li_flags & XFS_LI_IN_AIL)) {
203 xfs_dqunlock(dqp); 204 xfs_dqunlock(dqp);
204 return; 205 return true;
205 } 206 }
206 207
207 bp = xfs_incore(dqp->q_mount->m_ddev_targp, qlip->qli_format.qlf_blkno, 208 bp = xfs_incore(dqp->q_mount->m_ddev_targp, qlip->qli_format.qlf_blkno,
208 dqp->q_mount->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK); 209 dqp->q_mount->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK);
209 xfs_dqunlock(dqp); 210 xfs_dqunlock(dqp);
210 if (!bp) 211 if (!bp)
211 return; 212 return true;
212 if (XFS_BUF_ISDELAYWRITE(bp)) 213 if (XFS_BUF_ISDELAYWRITE(bp))
213 xfs_buf_delwri_promote(bp); 214 xfs_buf_delwri_promote(bp);
215 if (xfs_buf_ispinned(bp))
216 ret = false;
214 xfs_buf_relse(bp); 217 xfs_buf_relse(bp);
218 return ret;
215} 219}
216 220
217/* 221/*
diff --git a/fs/xfs/quota/xfs_dquot_item.h b/fs/xfs/xfs_dquot_item.h
index 5acae2ada70b..5acae2ada70b 100644
--- a/fs/xfs/quota/xfs_dquot_item.h
+++ b/fs/xfs/xfs_dquot_item.h
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/xfs_export.c
index 75e5d322e48f..75e5d322e48f 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/xfs_export.c
diff --git a/fs/xfs/linux-2.6/xfs_export.h b/fs/xfs/xfs_export.h
index 3272b6ae7a35..3272b6ae7a35 100644
--- a/fs/xfs/linux-2.6/xfs_export.h
+++ b/fs/xfs/xfs_export.h
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/xfs_file.c
index 7f7b42469ea7..7f7b42469ea7 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/xfs_file.c
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/xfs_fs_subr.c
index ed88ed16811c..ed88ed16811c 100644
--- a/fs/xfs/linux-2.6/xfs_fs_subr.c
+++ b/fs/xfs/xfs_fs_subr.c
diff --git a/fs/xfs/linux-2.6/xfs_globals.c b/fs/xfs/xfs_globals.c
index 76e81cff70b9..76e81cff70b9 100644
--- a/fs/xfs/linux-2.6/xfs_globals.c
+++ b/fs/xfs/xfs_globals.c
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index dd5628bd8d0b..9f24ec28283b 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -202,8 +202,7 @@ xfs_ialloc_inode_init(
202 fbuf = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, 202 fbuf = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
203 mp->m_bsize * blks_per_cluster, 203 mp->m_bsize * blks_per_cluster,
204 XBF_LOCK); 204 XBF_LOCK);
205 ASSERT(fbuf); 205 ASSERT(!xfs_buf_geterror(fbuf));
206 ASSERT(!XFS_BUF_GETERROR(fbuf));
207 206
208 /* 207 /*
209 * Initialize all inodes in this buffer and then log them. 208 * Initialize all inodes in this buffer and then log them.
@@ -1486,7 +1485,7 @@ xfs_read_agi(
1486 if (error) 1485 if (error)
1487 return error; 1486 return error;
1488 1487
1489 ASSERT(*bpp && !XFS_BUF_GETERROR(*bpp)); 1488 ASSERT(!xfs_buf_geterror(*bpp));
1490 agi = XFS_BUF_TO_AGI(*bpp); 1489 agi = XFS_BUF_TO_AGI(*bpp);
1491 1490
1492 /* 1491 /*
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 2fcca4b03ed3..0239a7c7c886 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2473,7 +2473,7 @@ cluster_corrupt_out:
2473 if (bp->b_iodone) { 2473 if (bp->b_iodone) {
2474 XFS_BUF_UNDONE(bp); 2474 XFS_BUF_UNDONE(bp);
2475 XFS_BUF_STALE(bp); 2475 XFS_BUF_STALE(bp);
2476 XFS_BUF_ERROR(bp,EIO); 2476 xfs_buf_ioerror(bp, EIO);
2477 xfs_buf_ioend(bp, 0); 2477 xfs_buf_ioend(bp, 0);
2478 } else { 2478 } else {
2479 XFS_BUF_STALE(bp); 2479 XFS_BUF_STALE(bp);
@@ -2585,7 +2585,7 @@ xfs_iflush(
2585 * If the buffer is pinned then push on the log now so we won't 2585 * If the buffer is pinned then push on the log now so we won't
2586 * get stuck waiting in the write for too long. 2586 * get stuck waiting in the write for too long.
2587 */ 2587 */
2588 if (XFS_BUF_ISPINNED(bp)) 2588 if (xfs_buf_ispinned(bp))
2589 xfs_log_force(mp, 0); 2589 xfs_log_force(mp, 0);
2590 2590
2591 /* 2591 /*
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 588406dc6a35..836ad80d4f2b 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -708,13 +708,14 @@ xfs_inode_item_committed(
708 * marked delayed write. If that's the case, we'll promote it and that will 708 * marked delayed write. If that's the case, we'll promote it and that will
709 * allow the caller to write the buffer by triggering the xfsbufd to run. 709 * allow the caller to write the buffer by triggering the xfsbufd to run.
710 */ 710 */
711STATIC void 711STATIC bool
712xfs_inode_item_pushbuf( 712xfs_inode_item_pushbuf(
713 struct xfs_log_item *lip) 713 struct xfs_log_item *lip)
714{ 714{
715 struct xfs_inode_log_item *iip = INODE_ITEM(lip); 715 struct xfs_inode_log_item *iip = INODE_ITEM(lip);
716 struct xfs_inode *ip = iip->ili_inode; 716 struct xfs_inode *ip = iip->ili_inode;
717 struct xfs_buf *bp; 717 struct xfs_buf *bp;
718 bool ret = true;
718 719
719 ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED)); 720 ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED));
720 721
@@ -725,7 +726,7 @@ xfs_inode_item_pushbuf(
725 if (completion_done(&ip->i_flush) || 726 if (completion_done(&ip->i_flush) ||
726 !(lip->li_flags & XFS_LI_IN_AIL)) { 727 !(lip->li_flags & XFS_LI_IN_AIL)) {
727 xfs_iunlock(ip, XFS_ILOCK_SHARED); 728 xfs_iunlock(ip, XFS_ILOCK_SHARED);
728 return; 729 return true;
729 } 730 }
730 731
731 bp = xfs_incore(ip->i_mount->m_ddev_targp, iip->ili_format.ilf_blkno, 732 bp = xfs_incore(ip->i_mount->m_ddev_targp, iip->ili_format.ilf_blkno,
@@ -733,10 +734,13 @@ xfs_inode_item_pushbuf(
733 734
734 xfs_iunlock(ip, XFS_ILOCK_SHARED); 735 xfs_iunlock(ip, XFS_ILOCK_SHARED);
735 if (!bp) 736 if (!bp)
736 return; 737 return true;
737 if (XFS_BUF_ISDELAYWRITE(bp)) 738 if (XFS_BUF_ISDELAYWRITE(bp))
738 xfs_buf_delwri_promote(bp); 739 xfs_buf_delwri_promote(bp);
740 if (xfs_buf_ispinned(bp))
741 ret = false;
739 xfs_buf_relse(bp); 742 xfs_buf_relse(bp);
743 return ret;
740} 744}
741 745
742/* 746/*
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index f7ce7debe14c..f7ce7debe14c 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.h b/fs/xfs/xfs_ioctl.h
index d56173b34a2a..d56173b34a2a 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.h
+++ b/fs/xfs/xfs_ioctl.h
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index 54e623bfbb85..54e623bfbb85 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.h b/fs/xfs/xfs_ioctl32.h
index 80f4060e8970..80f4060e8970 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.h
+++ b/fs/xfs/xfs_ioctl32.h
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/xfs_iops.c
index b9c172b3fbbe..673704fab748 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -70,9 +70,8 @@ xfs_synchronize_times(
70} 70}
71 71
72/* 72/*
73 * If the linux inode is valid, mark it dirty. 73 * If the linux inode is valid, mark it dirty, else mark the dirty state
74 * Used when committing a dirty inode into a transaction so that 74 * in the XFS inode to make sure we pick it up when reclaiming the inode.
75 * the inode will get written back by the linux code
76 */ 75 */
77void 76void
78xfs_mark_inode_dirty_sync( 77xfs_mark_inode_dirty_sync(
@@ -82,6 +81,10 @@ xfs_mark_inode_dirty_sync(
82 81
83 if (!(inode->i_state & (I_WILL_FREE|I_FREEING))) 82 if (!(inode->i_state & (I_WILL_FREE|I_FREEING)))
84 mark_inode_dirty_sync(inode); 83 mark_inode_dirty_sync(inode);
84 else {
85 barrier();
86 ip->i_update_core = 1;
87 }
85} 88}
86 89
87void 90void
@@ -92,6 +95,11 @@ xfs_mark_inode_dirty(
92 95
93 if (!(inode->i_state & (I_WILL_FREE|I_FREEING))) 96 if (!(inode->i_state & (I_WILL_FREE|I_FREEING)))
94 mark_inode_dirty(inode); 97 mark_inode_dirty(inode);
98 else {
99 barrier();
100 ip->i_update_core = 1;
101 }
102
95} 103}
96 104
97/* 105/*
diff --git a/fs/xfs/linux-2.6/xfs_iops.h b/fs/xfs/xfs_iops.h
index ef41c92ce66e..ef41c92ce66e 100644
--- a/fs/xfs/linux-2.6/xfs_iops.h
+++ b/fs/xfs/xfs_iops.h
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/xfs_linux.h
index d42f814e4d35..828662f70d64 100644
--- a/fs/xfs/linux-2.6/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -32,13 +32,12 @@
32# define XFS_BIG_INUMS 0 32# define XFS_BIG_INUMS 0
33#endif 33#endif
34 34
35#include <xfs_types.h> 35#include "xfs_types.h"
36 36
37#include <kmem.h> 37#include "kmem.h"
38#include <mrlock.h> 38#include "mrlock.h"
39#include <time.h> 39#include "time.h"
40 40#include "uuid.h"
41#include <support/uuid.h>
42 41
43#include <linux/semaphore.h> 42#include <linux/semaphore.h>
44#include <linux/mm.h> 43#include <linux/mm.h>
@@ -69,6 +68,8 @@
69#include <linux/ctype.h> 68#include <linux/ctype.h>
70#include <linux/writeback.h> 69#include <linux/writeback.h>
71#include <linux/capability.h> 70#include <linux/capability.h>
71#include <linux/kthread.h>
72#include <linux/freezer.h>
72#include <linux/list_sort.h> 73#include <linux/list_sort.h>
73 74
74#include <asm/page.h> 75#include <asm/page.h>
@@ -78,14 +79,14 @@
78#include <asm/byteorder.h> 79#include <asm/byteorder.h>
79#include <asm/unaligned.h> 80#include <asm/unaligned.h>
80 81
81#include <xfs_vnode.h> 82#include "xfs_vnode.h"
82#include <xfs_stats.h> 83#include "xfs_stats.h"
83#include <xfs_sysctl.h> 84#include "xfs_sysctl.h"
84#include <xfs_iops.h> 85#include "xfs_iops.h"
85#include <xfs_aops.h> 86#include "xfs_aops.h"
86#include <xfs_super.h> 87#include "xfs_super.h"
87#include <xfs_buf.h> 88#include "xfs_buf.h"
88#include <xfs_message.h> 89#include "xfs_message.h"
89 90
90#ifdef __BIG_ENDIAN 91#ifdef __BIG_ENDIAN
91#define XFS_NATIVE_HOST 1 92#define XFS_NATIVE_HOST 1
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 06ff8437ed8e..3a8d4f66d702 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -878,7 +878,7 @@ xlog_iodone(xfs_buf_t *bp)
878 /* 878 /*
879 * Race to shutdown the filesystem if we see an error. 879 * Race to shutdown the filesystem if we see an error.
880 */ 880 */
881 if (XFS_TEST_ERROR((XFS_BUF_GETERROR(bp)), l->l_mp, 881 if (XFS_TEST_ERROR((xfs_buf_geterror(bp)), l->l_mp,
882 XFS_ERRTAG_IODONE_IOERR, XFS_RANDOM_IODONE_IOERR)) { 882 XFS_ERRTAG_IODONE_IOERR, XFS_RANDOM_IODONE_IOERR)) {
883 xfs_ioerror_alert("xlog_iodone", l->l_mp, bp, XFS_BUF_ADDR(bp)); 883 xfs_ioerror_alert("xlog_iodone", l->l_mp, bp, XFS_BUF_ADDR(bp));
884 XFS_BUF_STALE(bp); 884 XFS_BUF_STALE(bp);
@@ -1051,7 +1051,6 @@ xlog_alloc_log(xfs_mount_t *mp,
1051 if (!bp) 1051 if (!bp)
1052 goto out_free_log; 1052 goto out_free_log;
1053 bp->b_iodone = xlog_iodone; 1053 bp->b_iodone = xlog_iodone;
1054 ASSERT(XFS_BUF_ISBUSY(bp));
1055 ASSERT(xfs_buf_islocked(bp)); 1054 ASSERT(xfs_buf_islocked(bp));
1056 log->l_xbuf = bp; 1055 log->l_xbuf = bp;
1057 1056
@@ -1108,7 +1107,6 @@ xlog_alloc_log(xfs_mount_t *mp,
1108 iclog->ic_callback_tail = &(iclog->ic_callback); 1107 iclog->ic_callback_tail = &(iclog->ic_callback);
1109 iclog->ic_datap = (char *)iclog->ic_data + log->l_iclog_hsize; 1108 iclog->ic_datap = (char *)iclog->ic_data + log->l_iclog_hsize;
1110 1109
1111 ASSERT(XFS_BUF_ISBUSY(iclog->ic_bp));
1112 ASSERT(xfs_buf_islocked(iclog->ic_bp)); 1110 ASSERT(xfs_buf_islocked(iclog->ic_bp));
1113 init_waitqueue_head(&iclog->ic_force_wait); 1111 init_waitqueue_head(&iclog->ic_force_wait);
1114 init_waitqueue_head(&iclog->ic_write_wait); 1112 init_waitqueue_head(&iclog->ic_write_wait);
@@ -1248,7 +1246,7 @@ xlog_bdstrat(
1248 struct xlog_in_core *iclog = bp->b_fspriv; 1246 struct xlog_in_core *iclog = bp->b_fspriv;
1249 1247
1250 if (iclog->ic_state & XLOG_STATE_IOERROR) { 1248 if (iclog->ic_state & XLOG_STATE_IOERROR) {
1251 XFS_BUF_ERROR(bp, EIO); 1249 xfs_buf_ioerror(bp, EIO);
1252 XFS_BUF_STALE(bp); 1250 XFS_BUF_STALE(bp);
1253 xfs_buf_ioend(bp, 0); 1251 xfs_buf_ioend(bp, 0);
1254 /* 1252 /*
@@ -1355,7 +1353,6 @@ xlog_sync(xlog_t *log,
1355 XFS_BUF_SET_COUNT(bp, count); 1353 XFS_BUF_SET_COUNT(bp, count);
1356 bp->b_fspriv = iclog; 1354 bp->b_fspriv = iclog;
1357 XFS_BUF_ZEROFLAGS(bp); 1355 XFS_BUF_ZEROFLAGS(bp);
1358 XFS_BUF_BUSY(bp);
1359 XFS_BUF_ASYNC(bp); 1356 XFS_BUF_ASYNC(bp);
1360 bp->b_flags |= XBF_SYNCIO; 1357 bp->b_flags |= XBF_SYNCIO;
1361 1358
@@ -1398,16 +1395,15 @@ xlog_sync(xlog_t *log,
1398 if (split) { 1395 if (split) {
1399 bp = iclog->ic_log->l_xbuf; 1396 bp = iclog->ic_log->l_xbuf;
1400 XFS_BUF_SET_ADDR(bp, 0); /* logical 0 */ 1397 XFS_BUF_SET_ADDR(bp, 0); /* logical 0 */
1401 XFS_BUF_SET_PTR(bp, (xfs_caddr_t)((__psint_t)&(iclog->ic_header)+ 1398 xfs_buf_associate_memory(bp,
1402 (__psint_t)count), split); 1399 (char *)&iclog->ic_header + count, split);
1403 bp->b_fspriv = iclog; 1400 bp->b_fspriv = iclog;
1404 XFS_BUF_ZEROFLAGS(bp); 1401 XFS_BUF_ZEROFLAGS(bp);
1405 XFS_BUF_BUSY(bp);
1406 XFS_BUF_ASYNC(bp); 1402 XFS_BUF_ASYNC(bp);
1407 bp->b_flags |= XBF_SYNCIO; 1403 bp->b_flags |= XBF_SYNCIO;
1408 if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) 1404 if (log->l_mp->m_flags & XFS_MOUNT_BARRIER)
1409 bp->b_flags |= XBF_FUA; 1405 bp->b_flags |= XBF_FUA;
1410 dptr = XFS_BUF_PTR(bp); 1406 dptr = bp->b_addr;
1411 /* 1407 /*
1412 * Bump the cycle numbers at the start of each block 1408 * Bump the cycle numbers at the start of each block
1413 * since this part of the buffer is at the start of 1409 * since this part of the buffer is at the start of
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 052a2c0ec5fb..a199dbcee7d8 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -147,7 +147,7 @@ xlog_align(
147 xfs_daddr_t offset = blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1); 147 xfs_daddr_t offset = blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1);
148 148
149 ASSERT(BBTOB(offset + nbblks) <= XFS_BUF_SIZE(bp)); 149 ASSERT(BBTOB(offset + nbblks) <= XFS_BUF_SIZE(bp));
150 return XFS_BUF_PTR(bp) + BBTOB(offset); 150 return bp->b_addr + BBTOB(offset);
151} 151}
152 152
153 153
@@ -178,9 +178,7 @@ xlog_bread_noalign(
178 178
179 XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no); 179 XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no);
180 XFS_BUF_READ(bp); 180 XFS_BUF_READ(bp);
181 XFS_BUF_BUSY(bp);
182 XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); 181 XFS_BUF_SET_COUNT(bp, BBTOB(nbblks));
183 XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp);
184 182
185 xfsbdstrat(log->l_mp, bp); 183 xfsbdstrat(log->l_mp, bp);
186 error = xfs_buf_iowait(bp); 184 error = xfs_buf_iowait(bp);
@@ -220,18 +218,18 @@ xlog_bread_offset(
220 xfs_buf_t *bp, 218 xfs_buf_t *bp,
221 xfs_caddr_t offset) 219 xfs_caddr_t offset)
222{ 220{
223 xfs_caddr_t orig_offset = XFS_BUF_PTR(bp); 221 xfs_caddr_t orig_offset = bp->b_addr;
224 int orig_len = bp->b_buffer_length; 222 int orig_len = bp->b_buffer_length;
225 int error, error2; 223 int error, error2;
226 224
227 error = XFS_BUF_SET_PTR(bp, offset, BBTOB(nbblks)); 225 error = xfs_buf_associate_memory(bp, offset, BBTOB(nbblks));
228 if (error) 226 if (error)
229 return error; 227 return error;
230 228
231 error = xlog_bread_noalign(log, blk_no, nbblks, bp); 229 error = xlog_bread_noalign(log, blk_no, nbblks, bp);
232 230
233 /* must reset buffer pointer even on error */ 231 /* must reset buffer pointer even on error */
234 error2 = XFS_BUF_SET_PTR(bp, orig_offset, orig_len); 232 error2 = xfs_buf_associate_memory(bp, orig_offset, orig_len);
235 if (error) 233 if (error)
236 return error; 234 return error;
237 return error2; 235 return error2;
@@ -266,11 +264,9 @@ xlog_bwrite(
266 264
267 XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no); 265 XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no);
268 XFS_BUF_ZEROFLAGS(bp); 266 XFS_BUF_ZEROFLAGS(bp);
269 XFS_BUF_BUSY(bp); 267 xfs_buf_hold(bp);
270 XFS_BUF_HOLD(bp);
271 xfs_buf_lock(bp); 268 xfs_buf_lock(bp);
272 XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); 269 XFS_BUF_SET_COUNT(bp, BBTOB(nbblks));
273 XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp);
274 270
275 if ((error = xfs_bwrite(log->l_mp, bp))) 271 if ((error = xfs_bwrite(log->l_mp, bp)))
276 xfs_ioerror_alert("xlog_bwrite", log->l_mp, 272 xfs_ioerror_alert("xlog_bwrite", log->l_mp,
@@ -360,7 +356,7 @@ STATIC void
360xlog_recover_iodone( 356xlog_recover_iodone(
361 struct xfs_buf *bp) 357 struct xfs_buf *bp)
362{ 358{
363 if (XFS_BUF_GETERROR(bp)) { 359 if (bp->b_error) {
364 /* 360 /*
365 * We're not going to bother about retrying 361 * We're not going to bother about retrying
366 * this during recovery. One strike! 362 * this during recovery. One strike!
@@ -1262,7 +1258,7 @@ xlog_write_log_records(
1262 */ 1258 */
1263 ealign = round_down(end_block, sectbb); 1259 ealign = round_down(end_block, sectbb);
1264 if (j == 0 && (start_block + endcount > ealign)) { 1260 if (j == 0 && (start_block + endcount > ealign)) {
1265 offset = XFS_BUF_PTR(bp) + BBTOB(ealign - start_block); 1261 offset = bp->b_addr + BBTOB(ealign - start_block);
1266 error = xlog_bread_offset(log, ealign, sectbb, 1262 error = xlog_bread_offset(log, ealign, sectbb,
1267 bp, offset); 1263 bp, offset);
1268 if (error) 1264 if (error)
@@ -2135,15 +2131,16 @@ xlog_recover_buffer_pass2(
2135 2131
2136 bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len, 2132 bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len,
2137 buf_flags); 2133 buf_flags);
2138 if (XFS_BUF_ISERROR(bp)) { 2134 if (!bp)
2135 return XFS_ERROR(ENOMEM);
2136 error = bp->b_error;
2137 if (error) {
2139 xfs_ioerror_alert("xlog_recover_do..(read#1)", mp, 2138 xfs_ioerror_alert("xlog_recover_do..(read#1)", mp,
2140 bp, buf_f->blf_blkno); 2139 bp, buf_f->blf_blkno);
2141 error = XFS_BUF_GETERROR(bp);
2142 xfs_buf_relse(bp); 2140 xfs_buf_relse(bp);
2143 return error; 2141 return error;
2144 } 2142 }
2145 2143
2146 error = 0;
2147 if (buf_f->blf_flags & XFS_BLF_INODE_BUF) { 2144 if (buf_f->blf_flags & XFS_BLF_INODE_BUF) {
2148 error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f); 2145 error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f);
2149 } else if (buf_f->blf_flags & 2146 } else if (buf_f->blf_flags &
@@ -2227,14 +2224,17 @@ xlog_recover_inode_pass2(
2227 2224
2228 bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len, 2225 bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len,
2229 XBF_LOCK); 2226 XBF_LOCK);
2230 if (XFS_BUF_ISERROR(bp)) { 2227 if (!bp) {
2228 error = ENOMEM;
2229 goto error;
2230 }
2231 error = bp->b_error;
2232 if (error) {
2231 xfs_ioerror_alert("xlog_recover_do..(read#2)", mp, 2233 xfs_ioerror_alert("xlog_recover_do..(read#2)", mp,
2232 bp, in_f->ilf_blkno); 2234 bp, in_f->ilf_blkno);
2233 error = XFS_BUF_GETERROR(bp);
2234 xfs_buf_relse(bp); 2235 xfs_buf_relse(bp);
2235 goto error; 2236 goto error;
2236 } 2237 }
2237 error = 0;
2238 ASSERT(in_f->ilf_fields & XFS_ILOG_CORE); 2238 ASSERT(in_f->ilf_fields & XFS_ILOG_CORE);
2239 dip = (xfs_dinode_t *)xfs_buf_offset(bp, in_f->ilf_boffset); 2239 dip = (xfs_dinode_t *)xfs_buf_offset(bp, in_f->ilf_boffset);
2240 2240
@@ -3437,7 +3437,7 @@ xlog_do_recovery_pass(
3437 /* 3437 /*
3438 * Check for header wrapping around physical end-of-log 3438 * Check for header wrapping around physical end-of-log
3439 */ 3439 */
3440 offset = XFS_BUF_PTR(hbp); 3440 offset = hbp->b_addr;
3441 split_hblks = 0; 3441 split_hblks = 0;
3442 wrapped_hblks = 0; 3442 wrapped_hblks = 0;
3443 if (blk_no + hblks <= log->l_logBBsize) { 3443 if (blk_no + hblks <= log->l_logBBsize) {
@@ -3497,7 +3497,7 @@ xlog_do_recovery_pass(
3497 } else { 3497 } else {
3498 /* This log record is split across the 3498 /* This log record is split across the
3499 * physical end of log */ 3499 * physical end of log */
3500 offset = XFS_BUF_PTR(dbp); 3500 offset = dbp->b_addr;
3501 split_bblks = 0; 3501 split_bblks = 0;
3502 if (blk_no != log->l_logBBsize) { 3502 if (blk_no != log->l_logBBsize) {
3503 /* some data is before the physical 3503 /* some data is before the physical
diff --git a/fs/xfs/linux-2.6/xfs_message.c b/fs/xfs/xfs_message.c
index bd672def95ac..bd672def95ac 100644
--- a/fs/xfs/linux-2.6/xfs_message.c
+++ b/fs/xfs/xfs_message.c
diff --git a/fs/xfs/linux-2.6/xfs_message.h b/fs/xfs/xfs_message.h
index 7fb7ea007672..7fb7ea007672 100644
--- a/fs/xfs/linux-2.6/xfs_message.h
+++ b/fs/xfs/xfs_message.h
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 092e16ae4d9d..0081657ad985 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1615,7 +1615,7 @@ xfs_unmountfs_writesb(xfs_mount_t *mp)
1615 XFS_BUF_UNDELAYWRITE(sbp); 1615 XFS_BUF_UNDELAYWRITE(sbp);
1616 XFS_BUF_WRITE(sbp); 1616 XFS_BUF_WRITE(sbp);
1617 XFS_BUF_UNASYNC(sbp); 1617 XFS_BUF_UNASYNC(sbp);
1618 ASSERT(XFS_BUF_TARGET(sbp) == mp->m_ddev_targp); 1618 ASSERT(sbp->b_target == mp->m_ddev_targp);
1619 xfsbdstrat(mp, sbp); 1619 xfsbdstrat(mp, sbp);
1620 error = xfs_buf_iowait(sbp); 1620 error = xfs_buf_iowait(sbp);
1621 if (error) 1621 if (error)
@@ -1938,7 +1938,7 @@ xfs_getsb(
1938 xfs_buf_lock(bp); 1938 xfs_buf_lock(bp);
1939 } 1939 }
1940 1940
1941 XFS_BUF_HOLD(bp); 1941 xfs_buf_hold(bp);
1942 ASSERT(XFS_BUF_ISDONE(bp)); 1942 ASSERT(XFS_BUF_ISDONE(bp));
1943 return bp; 1943 return bp;
1944} 1944}
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/xfs_qm.c
index 46e54ad9a2dc..9a0aa76facdf 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -1240,7 +1240,7 @@ xfs_qm_reset_dqcounts(
1240 do_div(j, sizeof(xfs_dqblk_t)); 1240 do_div(j, sizeof(xfs_dqblk_t));
1241 ASSERT(mp->m_quotainfo->qi_dqperchunk == j); 1241 ASSERT(mp->m_quotainfo->qi_dqperchunk == j);
1242#endif 1242#endif
1243 ddq = (xfs_disk_dquot_t *)XFS_BUF_PTR(bp); 1243 ddq = bp->b_addr;
1244 for (j = 0; j < mp->m_quotainfo->qi_dqperchunk; j++) { 1244 for (j = 0; j < mp->m_quotainfo->qi_dqperchunk; j++) {
1245 /* 1245 /*
1246 * Do a sanity check, and if needed, repair the dqblk. Don't 1246 * Do a sanity check, and if needed, repair the dqblk. Don't
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/xfs_qm.h
index 43b9abe1052c..43b9abe1052c 100644
--- a/fs/xfs/quota/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c
index a0a829addca9..a0a829addca9 100644
--- a/fs/xfs/quota/xfs_qm_bhv.c
+++ b/fs/xfs/xfs_qm_bhv.c
diff --git a/fs/xfs/quota/xfs_qm_stats.c b/fs/xfs/xfs_qm_stats.c
index 8671a0b32644..8671a0b32644 100644
--- a/fs/xfs/quota/xfs_qm_stats.c
+++ b/fs/xfs/xfs_qm_stats.c
diff --git a/fs/xfs/quota/xfs_qm_stats.h b/fs/xfs/xfs_qm_stats.h
index 5b964fc0dc09..5b964fc0dc09 100644
--- a/fs/xfs/quota/xfs_qm_stats.h
+++ b/fs/xfs/xfs_qm_stats.h
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 609246f42e6c..609246f42e6c 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
diff --git a/fs/xfs/quota/xfs_quota_priv.h b/fs/xfs/xfs_quota_priv.h
index 94a3d927d716..94a3d927d716 100644
--- a/fs/xfs/quota/xfs_quota_priv.h
+++ b/fs/xfs/xfs_quota_priv.h
diff --git a/fs/xfs/linux-2.6/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c
index 29b9d642e93d..7e76f537abb7 100644
--- a/fs/xfs/linux-2.6/xfs_quotaops.c
+++ b/fs/xfs/xfs_quotaops.c
@@ -25,7 +25,7 @@
25#include "xfs_trans.h" 25#include "xfs_trans.h"
26#include "xfs_bmap_btree.h" 26#include "xfs_bmap_btree.h"
27#include "xfs_inode.h" 27#include "xfs_inode.h"
28#include "quota/xfs_qm.h" 28#include "xfs_qm.h"
29#include <linux/quota.h> 29#include <linux/quota.h>
30 30
31 31
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 8f76fdff4f46..35561a511b57 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -168,7 +168,7 @@ error_cancel:
168 xfs_trans_cancel(tp, cancelflags); 168 xfs_trans_cancel(tp, cancelflags);
169 goto error; 169 goto error;
170 } 170 }
171 memset(XFS_BUF_PTR(bp), 0, mp->m_sb.sb_blocksize); 171 memset(bp->b_addr, 0, mp->m_sb.sb_blocksize);
172 xfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1); 172 xfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1);
173 /* 173 /*
174 * Commit the transaction. 174 * Commit the transaction.
@@ -883,7 +883,7 @@ xfs_rtbuf_get(
883 if (error) { 883 if (error) {
884 return error; 884 return error;
885 } 885 }
886 ASSERT(bp && !XFS_BUF_GETERROR(bp)); 886 ASSERT(!xfs_buf_geterror(bp));
887 *bpp = bp; 887 *bpp = bp;
888 return 0; 888 return 0;
889} 889}
@@ -943,7 +943,7 @@ xfs_rtcheck_range(
943 if (error) { 943 if (error) {
944 return error; 944 return error;
945 } 945 }
946 bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 946 bufp = bp->b_addr;
947 /* 947 /*
948 * Compute the starting word's address, and starting bit. 948 * Compute the starting word's address, and starting bit.
949 */ 949 */
@@ -994,7 +994,7 @@ xfs_rtcheck_range(
994 if (error) { 994 if (error) {
995 return error; 995 return error;
996 } 996 }
997 b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 997 b = bufp = bp->b_addr;
998 word = 0; 998 word = 0;
999 } else { 999 } else {
1000 /* 1000 /*
@@ -1040,7 +1040,7 @@ xfs_rtcheck_range(
1040 if (error) { 1040 if (error) {
1041 return error; 1041 return error;
1042 } 1042 }
1043 b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1043 b = bufp = bp->b_addr;
1044 word = 0; 1044 word = 0;
1045 } else { 1045 } else {
1046 /* 1046 /*
@@ -1158,7 +1158,7 @@ xfs_rtfind_back(
1158 if (error) { 1158 if (error) {
1159 return error; 1159 return error;
1160 } 1160 }
1161 bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1161 bufp = bp->b_addr;
1162 /* 1162 /*
1163 * Get the first word's index & point to it. 1163 * Get the first word's index & point to it.
1164 */ 1164 */
@@ -1210,7 +1210,7 @@ xfs_rtfind_back(
1210 if (error) { 1210 if (error) {
1211 return error; 1211 return error;
1212 } 1212 }
1213 bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1213 bufp = bp->b_addr;
1214 word = XFS_BLOCKWMASK(mp); 1214 word = XFS_BLOCKWMASK(mp);
1215 b = &bufp[word]; 1215 b = &bufp[word];
1216 } else { 1216 } else {
@@ -1256,7 +1256,7 @@ xfs_rtfind_back(
1256 if (error) { 1256 if (error) {
1257 return error; 1257 return error;
1258 } 1258 }
1259 bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1259 bufp = bp->b_addr;
1260 word = XFS_BLOCKWMASK(mp); 1260 word = XFS_BLOCKWMASK(mp);
1261 b = &bufp[word]; 1261 b = &bufp[word];
1262 } else { 1262 } else {
@@ -1333,7 +1333,7 @@ xfs_rtfind_forw(
1333 if (error) { 1333 if (error) {
1334 return error; 1334 return error;
1335 } 1335 }
1336 bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1336 bufp = bp->b_addr;
1337 /* 1337 /*
1338 * Get the first word's index & point to it. 1338 * Get the first word's index & point to it.
1339 */ 1339 */
@@ -1384,7 +1384,7 @@ xfs_rtfind_forw(
1384 if (error) { 1384 if (error) {
1385 return error; 1385 return error;
1386 } 1386 }
1387 b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1387 b = bufp = bp->b_addr;
1388 word = 0; 1388 word = 0;
1389 } else { 1389 } else {
1390 /* 1390 /*
@@ -1429,7 +1429,7 @@ xfs_rtfind_forw(
1429 if (error) { 1429 if (error) {
1430 return error; 1430 return error;
1431 } 1431 }
1432 b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1432 b = bufp = bp->b_addr;
1433 word = 0; 1433 word = 0;
1434 } else { 1434 } else {
1435 /* 1435 /*
@@ -1649,7 +1649,7 @@ xfs_rtmodify_range(
1649 if (error) { 1649 if (error) {
1650 return error; 1650 return error;
1651 } 1651 }
1652 bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1652 bufp = bp->b_addr;
1653 /* 1653 /*
1654 * Compute the starting word's address, and starting bit. 1654 * Compute the starting word's address, and starting bit.
1655 */ 1655 */
@@ -1694,7 +1694,7 @@ xfs_rtmodify_range(
1694 if (error) { 1694 if (error) {
1695 return error; 1695 return error;
1696 } 1696 }
1697 first = b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1697 first = b = bufp = bp->b_addr;
1698 word = 0; 1698 word = 0;
1699 } else { 1699 } else {
1700 /* 1700 /*
@@ -1734,7 +1734,7 @@ xfs_rtmodify_range(
1734 if (error) { 1734 if (error) {
1735 return error; 1735 return error;
1736 } 1736 }
1737 first = b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); 1737 first = b = bufp = bp->b_addr;
1738 word = 0; 1738 word = 0;
1739 } else { 1739 } else {
1740 /* 1740 /*
@@ -1832,8 +1832,8 @@ xfs_rtmodify_summary(
1832 */ 1832 */
1833 sp = XFS_SUMPTR(mp, bp, so); 1833 sp = XFS_SUMPTR(mp, bp, so);
1834 *sp += delta; 1834 *sp += delta;
1835 xfs_trans_log_buf(tp, bp, (uint)((char *)sp - (char *)XFS_BUF_PTR(bp)), 1835 xfs_trans_log_buf(tp, bp, (uint)((char *)sp - (char *)bp->b_addr),
1836 (uint)((char *)sp - (char *)XFS_BUF_PTR(bp) + sizeof(*sp) - 1)); 1836 (uint)((char *)sp - (char *)bp->b_addr + sizeof(*sp) - 1));
1837 return 0; 1837 return 0;
1838} 1838}
1839 1839
diff --git a/fs/xfs/xfs_rtalloc.h b/fs/xfs/xfs_rtalloc.h
index 09e1f4f35e97..f7f3a359c1c5 100644
--- a/fs/xfs/xfs_rtalloc.h
+++ b/fs/xfs/xfs_rtalloc.h
@@ -47,7 +47,7 @@ struct xfs_trans;
47#define XFS_SUMOFFSTOBLOCK(mp,s) \ 47#define XFS_SUMOFFSTOBLOCK(mp,s) \
48 (((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog) 48 (((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog)
49#define XFS_SUMPTR(mp,bp,so) \ 49#define XFS_SUMPTR(mp,bp,so) \
50 ((xfs_suminfo_t *)((char *)XFS_BUF_PTR(bp) + \ 50 ((xfs_suminfo_t *)((bp)->b_addr + \
51 (((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp)))) 51 (((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp))))
52 52
53#define XFS_BITTOBLOCK(mp,bi) ((bi) >> (mp)->m_blkbit_log) 53#define XFS_BITTOBLOCK(mp,bi) ((bi) >> (mp)->m_blkbit_log)
diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c
index d6d6fdfe9422..c96a8a05ac03 100644
--- a/fs/xfs/xfs_rw.c
+++ b/fs/xfs/xfs_rw.c
@@ -104,9 +104,9 @@ xfs_ioerror_alert(
104 xfs_alert(mp, 104 xfs_alert(mp,
105 "I/O error occurred: meta-data dev %s block 0x%llx" 105 "I/O error occurred: meta-data dev %s block 0x%llx"
106 " (\"%s\") error %d buf count %zd", 106 " (\"%s\") error %d buf count %zd",
107 XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)), 107 xfs_buf_target_name(bp->b_target),
108 (__uint64_t)blkno, func, 108 (__uint64_t)blkno, func,
109 XFS_BUF_GETERROR(bp), XFS_BUF_COUNT(bp)); 109 bp->b_error, XFS_BUF_COUNT(bp));
110} 110}
111 111
112/* 112/*
@@ -137,8 +137,8 @@ xfs_read_buf(
137 bp = xfs_buf_read(target, blkno, len, flags); 137 bp = xfs_buf_read(target, blkno, len, flags);
138 if (!bp) 138 if (!bp)
139 return XFS_ERROR(EIO); 139 return XFS_ERROR(EIO);
140 error = XFS_BUF_GETERROR(bp); 140 error = bp->b_error;
141 if (bp && !error && !XFS_FORCED_SHUTDOWN(mp)) { 141 if (!error && !XFS_FORCED_SHUTDOWN(mp)) {
142 *bpp = bp; 142 *bpp = bp;
143 } else { 143 } else {
144 *bpp = NULL; 144 *bpp = NULL;
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h
index 1eb2ba586814..cb6ae715814a 100644
--- a/fs/xfs/xfs_sb.h
+++ b/fs/xfs/xfs_sb.h
@@ -509,7 +509,7 @@ static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp)
509 509
510#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */ 510#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
511#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) 511#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
512#define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)XFS_BUF_PTR(bp)) 512#define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)((bp)->b_addr))
513 513
514#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d)) 514#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
515#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \ 515#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
diff --git a/fs/xfs/linux-2.6/xfs_stats.c b/fs/xfs/xfs_stats.c
index 76fdc5861932..76fdc5861932 100644
--- a/fs/xfs/linux-2.6/xfs_stats.c
+++ b/fs/xfs/xfs_stats.c
diff --git a/fs/xfs/linux-2.6/xfs_stats.h b/fs/xfs/xfs_stats.h
index 736854b1ca1a..736854b1ca1a 100644
--- a/fs/xfs/linux-2.6/xfs_stats.h
+++ b/fs/xfs/xfs_stats.h
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/xfs_super.c
index 9a72dda58bd0..5cf06b85fd9d 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -356,6 +356,8 @@ xfs_parseargs(
356 mp->m_flags |= XFS_MOUNT_DELAYLOG; 356 mp->m_flags |= XFS_MOUNT_DELAYLOG;
357 } else if (!strcmp(this_char, MNTOPT_NODELAYLOG)) { 357 } else if (!strcmp(this_char, MNTOPT_NODELAYLOG)) {
358 mp->m_flags &= ~XFS_MOUNT_DELAYLOG; 358 mp->m_flags &= ~XFS_MOUNT_DELAYLOG;
359 xfs_warn(mp,
360 "nodelaylog is deprecated and will be removed in Linux 3.3");
359 } else if (!strcmp(this_char, MNTOPT_DISCARD)) { 361 } else if (!strcmp(this_char, MNTOPT_DISCARD)) {
360 mp->m_flags |= XFS_MOUNT_DISCARD; 362 mp->m_flags |= XFS_MOUNT_DISCARD;
361 } else if (!strcmp(this_char, MNTOPT_NODISCARD)) { 363 } else if (!strcmp(this_char, MNTOPT_NODISCARD)) {
@@ -877,33 +879,17 @@ xfs_log_inode(
877 struct xfs_trans *tp; 879 struct xfs_trans *tp;
878 int error; 880 int error;
879 881
880 xfs_iunlock(ip, XFS_ILOCK_SHARED);
881 tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS); 882 tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS);
882 error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0); 883 error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0);
883
884 if (error) { 884 if (error) {
885 xfs_trans_cancel(tp, 0); 885 xfs_trans_cancel(tp, 0);
886 /* we need to return with the lock hold shared */
887 xfs_ilock(ip, XFS_ILOCK_SHARED);
888 return error; 886 return error;
889 } 887 }
890 888
891 xfs_ilock(ip, XFS_ILOCK_EXCL); 889 xfs_ilock(ip, XFS_ILOCK_EXCL);
892 890 xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);
893 /*
894 * Note - it's possible that we might have pushed ourselves out of the
895 * way during trans_reserve which would flush the inode. But there's
896 * no guarantee that the inode buffer has actually gone out yet (it's
897 * delwri). Plus the buffer could be pinned anyway if it's part of
898 * an inode in another recent transaction. So we play it safe and
899 * fire off the transaction anyway.
900 */
901 xfs_trans_ijoin(tp, ip);
902 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); 891 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
903 error = xfs_trans_commit(tp, 0); 892 return xfs_trans_commit(tp, 0);
904 xfs_ilock_demote(ip, XFS_ILOCK_EXCL);
905
906 return error;
907} 893}
908 894
909STATIC int 895STATIC int
@@ -918,7 +904,9 @@ xfs_fs_write_inode(
918 trace_xfs_write_inode(ip); 904 trace_xfs_write_inode(ip);
919 905
920 if (XFS_FORCED_SHUTDOWN(mp)) 906 if (XFS_FORCED_SHUTDOWN(mp))
921 return XFS_ERROR(EIO); 907 return -XFS_ERROR(EIO);
908 if (!ip->i_update_core)
909 return 0;
922 910
923 if (wbc->sync_mode == WB_SYNC_ALL) { 911 if (wbc->sync_mode == WB_SYNC_ALL) {
924 /* 912 /*
@@ -929,12 +917,10 @@ xfs_fs_write_inode(
929 * of synchronous log foces dramatically. 917 * of synchronous log foces dramatically.
930 */ 918 */
931 xfs_ioend_wait(ip); 919 xfs_ioend_wait(ip);
932 xfs_ilock(ip, XFS_ILOCK_SHARED); 920 error = xfs_log_inode(ip);
933 if (ip->i_update_core) { 921 if (error)
934 error = xfs_log_inode(ip); 922 goto out;
935 if (error) 923 return 0;
936 goto out_unlock;
937 }
938 } else { 924 } else {
939 /* 925 /*
940 * We make this non-blocking if the inode is contended, return 926 * We make this non-blocking if the inode is contended, return
@@ -1666,24 +1652,13 @@ xfs_init_workqueues(void)
1666 */ 1652 */
1667 xfs_syncd_wq = alloc_workqueue("xfssyncd", WQ_CPU_INTENSIVE, 8); 1653 xfs_syncd_wq = alloc_workqueue("xfssyncd", WQ_CPU_INTENSIVE, 8);
1668 if (!xfs_syncd_wq) 1654 if (!xfs_syncd_wq)
1669 goto out; 1655 return -ENOMEM;
1670
1671 xfs_ail_wq = alloc_workqueue("xfsail", WQ_CPU_INTENSIVE, 8);
1672 if (!xfs_ail_wq)
1673 goto out_destroy_syncd;
1674
1675 return 0; 1656 return 0;
1676
1677out_destroy_syncd:
1678 destroy_workqueue(xfs_syncd_wq);
1679out:
1680 return -ENOMEM;
1681} 1657}
1682 1658
1683STATIC void 1659STATIC void
1684xfs_destroy_workqueues(void) 1660xfs_destroy_workqueues(void)
1685{ 1661{
1686 destroy_workqueue(xfs_ail_wq);
1687 destroy_workqueue(xfs_syncd_wq); 1662 destroy_workqueue(xfs_syncd_wq);
1688} 1663}
1689 1664
diff --git a/fs/xfs/linux-2.6/xfs_super.h b/fs/xfs/xfs_super.h
index 50a3266c999e..50a3266c999e 100644
--- a/fs/xfs/linux-2.6/xfs_super.h
+++ b/fs/xfs/xfs_super.h
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/xfs_sync.c
index e4c938afb910..4604f90f86a3 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/xfs_sync.c
@@ -332,7 +332,7 @@ xfs_sync_fsdata(
332 * between there and here. 332 * between there and here.
333 */ 333 */
334 bp = xfs_getsb(mp, 0); 334 bp = xfs_getsb(mp, 0);
335 if (XFS_BUF_ISPINNED(bp)) 335 if (xfs_buf_ispinned(bp))
336 xfs_log_force(mp, 0); 336 xfs_log_force(mp, 0);
337 337
338 return xfs_bwrite(mp, bp); 338 return xfs_bwrite(mp, bp);
diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/xfs_sync.h
index 941202e7ac6e..941202e7ac6e 100644
--- a/fs/xfs/linux-2.6/xfs_sync.h
+++ b/fs/xfs/xfs_sync.h
diff --git a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/xfs_sysctl.c
index ee2d2adaa438..ee2d2adaa438 100644
--- a/fs/xfs/linux-2.6/xfs_sysctl.c
+++ b/fs/xfs/xfs_sysctl.c
diff --git a/fs/xfs/linux-2.6/xfs_sysctl.h b/fs/xfs/xfs_sysctl.h
index b9937d450f8e..b9937d450f8e 100644
--- a/fs/xfs/linux-2.6/xfs_sysctl.h
+++ b/fs/xfs/xfs_sysctl.h
diff --git a/fs/xfs/linux-2.6/xfs_trace.c b/fs/xfs/xfs_trace.c
index 88d25d4aa56e..9010ce885e6a 100644
--- a/fs/xfs/linux-2.6/xfs_trace.c
+++ b/fs/xfs/xfs_trace.c
@@ -43,8 +43,8 @@
43#include "xfs_quota.h" 43#include "xfs_quota.h"
44#include "xfs_iomap.h" 44#include "xfs_iomap.h"
45#include "xfs_aops.h" 45#include "xfs_aops.h"
46#include "quota/xfs_dquot_item.h" 46#include "xfs_dquot_item.h"
47#include "quota/xfs_dquot.h" 47#include "xfs_dquot.h"
48#include "xfs_log_recover.h" 48#include "xfs_log_recover.h"
49#include "xfs_inode_item.h" 49#include "xfs_inode_item.h"
50 50
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/xfs_trace.h
index 690fc7a7bd72..690fc7a7bd72 100644
--- a/fs/xfs/linux-2.6/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index 06a9759b6352..53597f4db9b5 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -350,7 +350,7 @@ typedef struct xfs_item_ops {
350 void (*iop_unlock)(xfs_log_item_t *); 350 void (*iop_unlock)(xfs_log_item_t *);
351 xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t); 351 xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t);
352 void (*iop_push)(xfs_log_item_t *); 352 void (*iop_push)(xfs_log_item_t *);
353 void (*iop_pushbuf)(xfs_log_item_t *); 353 bool (*iop_pushbuf)(xfs_log_item_t *);
354 void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t); 354 void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
355} xfs_item_ops_t; 355} xfs_item_ops_t;
356 356
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 43233e92f0f6..3a1e7ca54c2d 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -28,8 +28,6 @@
28#include "xfs_trans_priv.h" 28#include "xfs_trans_priv.h"
29#include "xfs_error.h" 29#include "xfs_error.h"
30 30
31struct workqueue_struct *xfs_ail_wq; /* AIL workqueue */
32
33#ifdef DEBUG 31#ifdef DEBUG
34/* 32/*
35 * Check that the list is sorted as it should be. 33 * Check that the list is sorted as it should be.
@@ -299,7 +297,7 @@ xfs_trans_ail_cursor_last(
299 * Splice the log item list into the AIL at the given LSN. We splice to the 297 * Splice the log item list into the AIL at the given LSN. We splice to the
300 * tail of the given LSN to maintain insert order for push traversals. The 298 * tail of the given LSN to maintain insert order for push traversals. The
301 * cursor is optional, allowing repeated updates to the same LSN to avoid 299 * cursor is optional, allowing repeated updates to the same LSN to avoid
302 * repeated traversals. 300 * repeated traversals. This should not be called with an empty list.
303 */ 301 */
304static void 302static void
305xfs_ail_splice( 303xfs_ail_splice(
@@ -308,50 +306,39 @@ xfs_ail_splice(
308 struct list_head *list, 306 struct list_head *list,
309 xfs_lsn_t lsn) 307 xfs_lsn_t lsn)
310{ 308{
311 struct xfs_log_item *lip = cur ? cur->item : NULL; 309 struct xfs_log_item *lip;
312 struct xfs_log_item *next_lip; 310
311 ASSERT(!list_empty(list));
313 312
314 /* 313 /*
315 * Get a new cursor if we don't have a placeholder or the existing one 314 * Use the cursor to determine the insertion point if one is
316 * has been invalidated. 315 * provided. If not, or if the one we got is not valid,
316 * find the place in the AIL where the items belong.
317 */ 317 */
318 if (!lip || (__psint_t)lip & 1) { 318 lip = cur ? cur->item : NULL;
319 if (!lip || (__psint_t) lip & 1)
319 lip = __xfs_trans_ail_cursor_last(ailp, lsn); 320 lip = __xfs_trans_ail_cursor_last(ailp, lsn);
320 321
321 if (!lip) { 322 /*
322 /* The list is empty, so just splice and return. */ 323 * If a cursor is provided, we know we're processing the AIL
323 if (cur) 324 * in lsn order, and future items to be spliced in will
324 cur->item = NULL; 325 * follow the last one being inserted now. Update the
325 list_splice(list, &ailp->xa_ail); 326 * cursor to point to that last item, now while we have a
326 return; 327 * reliable pointer to it.
327 } 328 */
328 } 329 if (cur)
330 cur->item = list_entry(list->prev, struct xfs_log_item, li_ail);
329 331
330 /* 332 /*
331 * Our cursor points to the item we want to insert _after_, so we have 333 * Finally perform the splice. Unless the AIL was empty,
332 * to update the cursor to point to the end of the list we are splicing 334 * lip points to the item in the AIL _after_ which the new
333 * in so that it points to the correct location for the next splice. 335 * items should go. If lip is null the AIL was empty, so
334 * i.e. before the splice 336 * the new items go at the head of the AIL.
335 *
336 * lsn -> lsn -> lsn + x -> lsn + x ...
337 * ^
338 * | cursor points here
339 *
340 * After the splice we have:
341 *
342 * lsn -> lsn -> lsn -> lsn -> .... -> lsn -> lsn + x -> lsn + x ...
343 * ^ ^
344 * | cursor points here | needs to move here
345 *
346 * So we set the cursor to the last item in the list to be spliced
347 * before we execute the splice, resulting in the cursor pointing to
348 * the correct item after the splice occurs.
349 */ 337 */
350 if (cur) { 338 if (lip)
351 next_lip = list_entry(list->prev, struct xfs_log_item, li_ail); 339 list_splice(list, &lip->li_ail);
352 cur->item = next_lip; 340 else
353 } 341 list_splice(list, &ailp->xa_ail);
354 list_splice(list, &lip->li_ail);
355} 342}
356 343
357/* 344/*
@@ -367,16 +354,10 @@ xfs_ail_delete(
367 xfs_trans_ail_cursor_clear(ailp, lip); 354 xfs_trans_ail_cursor_clear(ailp, lip);
368} 355}
369 356
370/* 357static long
371 * xfs_ail_worker does the work of pushing on the AIL. It will requeue itself 358xfsaild_push(
372 * to run at a later time if there is more work to do to complete the push. 359 struct xfs_ail *ailp)
373 */
374STATIC void
375xfs_ail_worker(
376 struct work_struct *work)
377{ 360{
378 struct xfs_ail *ailp = container_of(to_delayed_work(work),
379 struct xfs_ail, xa_work);
380 xfs_mount_t *mp = ailp->xa_mount; 361 xfs_mount_t *mp = ailp->xa_mount;
381 struct xfs_ail_cursor cur; 362 struct xfs_ail_cursor cur;
382 xfs_log_item_t *lip; 363 xfs_log_item_t *lip;
@@ -438,8 +419,13 @@ xfs_ail_worker(
438 419
439 case XFS_ITEM_PUSHBUF: 420 case XFS_ITEM_PUSHBUF:
440 XFS_STATS_INC(xs_push_ail_pushbuf); 421 XFS_STATS_INC(xs_push_ail_pushbuf);
441 IOP_PUSHBUF(lip); 422
442 ailp->xa_last_pushed_lsn = lsn; 423 if (!IOP_PUSHBUF(lip)) {
424 stuck++;
425 flush_log = 1;
426 } else {
427 ailp->xa_last_pushed_lsn = lsn;
428 }
443 push_xfsbufd = 1; 429 push_xfsbufd = 1;
444 break; 430 break;
445 431
@@ -451,7 +437,6 @@ xfs_ail_worker(
451 437
452 case XFS_ITEM_LOCKED: 438 case XFS_ITEM_LOCKED:
453 XFS_STATS_INC(xs_push_ail_locked); 439 XFS_STATS_INC(xs_push_ail_locked);
454 ailp->xa_last_pushed_lsn = lsn;
455 stuck++; 440 stuck++;
456 break; 441 break;
457 442
@@ -512,20 +497,6 @@ out_done:
512 /* We're past our target or empty, so idle */ 497 /* We're past our target or empty, so idle */
513 ailp->xa_last_pushed_lsn = 0; 498 ailp->xa_last_pushed_lsn = 0;
514 499
515 /*
516 * We clear the XFS_AIL_PUSHING_BIT first before checking
517 * whether the target has changed. If the target has changed,
518 * this pushes the requeue race directly onto the result of the
519 * atomic test/set bit, so we are guaranteed that either the
520 * the pusher that changed the target or ourselves will requeue
521 * the work (but not both).
522 */
523 clear_bit(XFS_AIL_PUSHING_BIT, &ailp->xa_flags);
524 smp_rmb();
525 if (XFS_LSN_CMP(ailp->xa_target, target) == 0 ||
526 test_and_set_bit(XFS_AIL_PUSHING_BIT, &ailp->xa_flags))
527 return;
528
529 tout = 50; 500 tout = 50;
530 } else if (XFS_LSN_CMP(lsn, target) >= 0) { 501 } else if (XFS_LSN_CMP(lsn, target) >= 0) {
531 /* 502 /*
@@ -548,9 +519,30 @@ out_done:
548 tout = 20; 519 tout = 20;
549 } 520 }
550 521
551 /* There is more to do, requeue us. */ 522 return tout;
552 queue_delayed_work(xfs_syncd_wq, &ailp->xa_work, 523}
553 msecs_to_jiffies(tout)); 524
525static int
526xfsaild(
527 void *data)
528{
529 struct xfs_ail *ailp = data;
530 long tout = 0; /* milliseconds */
531
532 while (!kthread_should_stop()) {
533 if (tout && tout <= 20)
534 __set_current_state(TASK_KILLABLE);
535 else
536 __set_current_state(TASK_INTERRUPTIBLE);
537 schedule_timeout(tout ?
538 msecs_to_jiffies(tout) : MAX_SCHEDULE_TIMEOUT);
539
540 try_to_freeze();
541
542 tout = xfsaild_push(ailp);
543 }
544
545 return 0;
554} 546}
555 547
556/* 548/*
@@ -585,8 +577,9 @@ xfs_ail_push(
585 */ 577 */
586 smp_wmb(); 578 smp_wmb();
587 xfs_trans_ail_copy_lsn(ailp, &ailp->xa_target, &threshold_lsn); 579 xfs_trans_ail_copy_lsn(ailp, &ailp->xa_target, &threshold_lsn);
588 if (!test_and_set_bit(XFS_AIL_PUSHING_BIT, &ailp->xa_flags)) 580 smp_wmb();
589 queue_delayed_work(xfs_syncd_wq, &ailp->xa_work, 0); 581
582 wake_up_process(ailp->xa_task);
590} 583}
591 584
592/* 585/*
@@ -682,6 +675,7 @@ xfs_trans_ail_update_bulk(
682 int i; 675 int i;
683 LIST_HEAD(tmp); 676 LIST_HEAD(tmp);
684 677
678 ASSERT(nr_items > 0); /* Not required, but true. */
685 mlip = xfs_ail_min(ailp); 679 mlip = xfs_ail_min(ailp);
686 680
687 for (i = 0; i < nr_items; i++) { 681 for (i = 0; i < nr_items; i++) {
@@ -701,7 +695,8 @@ xfs_trans_ail_update_bulk(
701 list_add(&lip->li_ail, &tmp); 695 list_add(&lip->li_ail, &tmp);
702 } 696 }
703 697
704 xfs_ail_splice(ailp, cur, &tmp, lsn); 698 if (!list_empty(&tmp))
699 xfs_ail_splice(ailp, cur, &tmp, lsn);
705 700
706 if (!mlip_changed) { 701 if (!mlip_changed) {
707 spin_unlock(&ailp->xa_lock); 702 spin_unlock(&ailp->xa_lock);
@@ -822,9 +817,18 @@ xfs_trans_ail_init(
822 INIT_LIST_HEAD(&ailp->xa_ail); 817 INIT_LIST_HEAD(&ailp->xa_ail);
823 INIT_LIST_HEAD(&ailp->xa_cursors); 818 INIT_LIST_HEAD(&ailp->xa_cursors);
824 spin_lock_init(&ailp->xa_lock); 819 spin_lock_init(&ailp->xa_lock);
825 INIT_DELAYED_WORK(&ailp->xa_work, xfs_ail_worker); 820
821 ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s",
822 ailp->xa_mount->m_fsname);
823 if (IS_ERR(ailp->xa_task))
824 goto out_free_ailp;
825
826 mp->m_ail = ailp; 826 mp->m_ail = ailp;
827 return 0; 827 return 0;
828
829out_free_ailp:
830 kmem_free(ailp);
831 return ENOMEM;
828} 832}
829 833
830void 834void
@@ -833,6 +837,6 @@ xfs_trans_ail_destroy(
833{ 837{
834 struct xfs_ail *ailp = mp->m_ail; 838 struct xfs_ail *ailp = mp->m_ail;
835 839
836 cancel_delayed_work_sync(&ailp->xa_work); 840 kthread_stop(ailp->xa_task);
837 kmem_free(ailp); 841 kmem_free(ailp);
838} 842}
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index 15584fc3ed7d..137e2b9e2948 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -54,7 +54,7 @@ xfs_trans_buf_item_match(
54 list_for_each_entry(lidp, &tp->t_items, lid_trans) { 54 list_for_each_entry(lidp, &tp->t_items, lid_trans) {
55 blip = (struct xfs_buf_log_item *)lidp->lid_item; 55 blip = (struct xfs_buf_log_item *)lidp->lid_item;
56 if (blip->bli_item.li_type == XFS_LI_BUF && 56 if (blip->bli_item.li_type == XFS_LI_BUF &&
57 XFS_BUF_TARGET(blip->bli_buf) == target && 57 blip->bli_buf->b_target == target &&
58 XFS_BUF_ADDR(blip->bli_buf) == blkno && 58 XFS_BUF_ADDR(blip->bli_buf) == blkno &&
59 XFS_BUF_COUNT(blip->bli_buf) == len) 59 XFS_BUF_COUNT(blip->bli_buf) == len)
60 return blip->bli_buf; 60 return blip->bli_buf;
@@ -80,7 +80,6 @@ _xfs_trans_bjoin(
80{ 80{
81 struct xfs_buf_log_item *bip; 81 struct xfs_buf_log_item *bip;
82 82
83 ASSERT(XFS_BUF_ISBUSY(bp));
84 ASSERT(bp->b_transp == NULL); 83 ASSERT(bp->b_transp == NULL);
85 84
86 /* 85 /*
@@ -194,7 +193,7 @@ xfs_trans_get_buf(xfs_trans_t *tp,
194 return NULL; 193 return NULL;
195 } 194 }
196 195
197 ASSERT(!XFS_BUF_GETERROR(bp)); 196 ASSERT(!bp->b_error);
198 197
199 _xfs_trans_bjoin(tp, bp, 1); 198 _xfs_trans_bjoin(tp, bp, 1);
200 trace_xfs_trans_get_buf(bp->b_fspriv); 199 trace_xfs_trans_get_buf(bp->b_fspriv);
@@ -293,10 +292,10 @@ xfs_trans_read_buf(
293 return (flags & XBF_TRYLOCK) ? 292 return (flags & XBF_TRYLOCK) ?
294 EAGAIN : XFS_ERROR(ENOMEM); 293 EAGAIN : XFS_ERROR(ENOMEM);
295 294
296 if (XFS_BUF_GETERROR(bp) != 0) { 295 if (bp->b_error) {
296 error = bp->b_error;
297 xfs_ioerror_alert("xfs_trans_read_buf", mp, 297 xfs_ioerror_alert("xfs_trans_read_buf", mp,
298 bp, blkno); 298 bp, blkno);
299 error = XFS_BUF_GETERROR(bp);
300 xfs_buf_relse(bp); 299 xfs_buf_relse(bp);
301 return error; 300 return error;
302 } 301 }
@@ -330,7 +329,7 @@ xfs_trans_read_buf(
330 ASSERT(xfs_buf_islocked(bp)); 329 ASSERT(xfs_buf_islocked(bp));
331 ASSERT(bp->b_transp == tp); 330 ASSERT(bp->b_transp == tp);
332 ASSERT(bp->b_fspriv != NULL); 331 ASSERT(bp->b_fspriv != NULL);
333 ASSERT((XFS_BUF_ISERROR(bp)) == 0); 332 ASSERT(!bp->b_error);
334 if (!(XFS_BUF_ISDONE(bp))) { 333 if (!(XFS_BUF_ISDONE(bp))) {
335 trace_xfs_trans_read_buf_io(bp, _RET_IP_); 334 trace_xfs_trans_read_buf_io(bp, _RET_IP_);
336 ASSERT(!XFS_BUF_ISASYNC(bp)); 335 ASSERT(!XFS_BUF_ISASYNC(bp));
@@ -386,10 +385,9 @@ xfs_trans_read_buf(
386 return (flags & XBF_TRYLOCK) ? 385 return (flags & XBF_TRYLOCK) ?
387 0 : XFS_ERROR(ENOMEM); 386 0 : XFS_ERROR(ENOMEM);
388 } 387 }
389 if (XFS_BUF_GETERROR(bp) != 0) { 388 if (bp->b_error) {
390 XFS_BUF_SUPER_STALE(bp); 389 error = bp->b_error;
391 error = XFS_BUF_GETERROR(bp); 390 XFS_BUF_SUPER_STALE(bp);
392
393 xfs_ioerror_alert("xfs_trans_read_buf", mp, 391 xfs_ioerror_alert("xfs_trans_read_buf", mp,
394 bp, blkno); 392 bp, blkno);
395 if (tp->t_flags & XFS_TRANS_DIRTY) 393 if (tp->t_flags & XFS_TRANS_DIRTY)
@@ -430,7 +428,7 @@ shutdown_abort:
430 if (XFS_BUF_ISSTALE(bp) && XFS_BUF_ISDELAYWRITE(bp)) 428 if (XFS_BUF_ISSTALE(bp) && XFS_BUF_ISDELAYWRITE(bp))
431 xfs_notice(mp, "about to pop assert, bp == 0x%p", bp); 429 xfs_notice(mp, "about to pop assert, bp == 0x%p", bp);
432#endif 430#endif
433 ASSERT((XFS_BUF_BFLAGS(bp) & (XBF_STALE|XBF_DELWRI)) != 431 ASSERT((bp->b_flags & (XBF_STALE|XBF_DELWRI)) !=
434 (XBF_STALE|XBF_DELWRI)); 432 (XBF_STALE|XBF_DELWRI));
435 433
436 trace_xfs_trans_read_buf_shut(bp, _RET_IP_); 434 trace_xfs_trans_read_buf_shut(bp, _RET_IP_);
@@ -581,7 +579,6 @@ xfs_trans_bhold(xfs_trans_t *tp,
581{ 579{
582 xfs_buf_log_item_t *bip = bp->b_fspriv; 580 xfs_buf_log_item_t *bip = bp->b_fspriv;
583 581
584 ASSERT(XFS_BUF_ISBUSY(bp));
585 ASSERT(bp->b_transp == tp); 582 ASSERT(bp->b_transp == tp);
586 ASSERT(bip != NULL); 583 ASSERT(bip != NULL);
587 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 584 ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
@@ -602,7 +599,6 @@ xfs_trans_bhold_release(xfs_trans_t *tp,
602{ 599{
603 xfs_buf_log_item_t *bip = bp->b_fspriv; 600 xfs_buf_log_item_t *bip = bp->b_fspriv;
604 601
605 ASSERT(XFS_BUF_ISBUSY(bp));
606 ASSERT(bp->b_transp == tp); 602 ASSERT(bp->b_transp == tp);
607 ASSERT(bip != NULL); 603 ASSERT(bip != NULL);
608 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 604 ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
@@ -631,7 +627,6 @@ xfs_trans_log_buf(xfs_trans_t *tp,
631{ 627{
632 xfs_buf_log_item_t *bip = bp->b_fspriv; 628 xfs_buf_log_item_t *bip = bp->b_fspriv;
633 629
634 ASSERT(XFS_BUF_ISBUSY(bp));
635 ASSERT(bp->b_transp == tp); 630 ASSERT(bp->b_transp == tp);
636 ASSERT(bip != NULL); 631 ASSERT(bip != NULL);
637 ASSERT((first <= last) && (last < XFS_BUF_COUNT(bp))); 632 ASSERT((first <= last) && (last < XFS_BUF_COUNT(bp)));
@@ -702,7 +697,6 @@ xfs_trans_binval(
702{ 697{
703 xfs_buf_log_item_t *bip = bp->b_fspriv; 698 xfs_buf_log_item_t *bip = bp->b_fspriv;
704 699
705 ASSERT(XFS_BUF_ISBUSY(bp));
706 ASSERT(bp->b_transp == tp); 700 ASSERT(bp->b_transp == tp);
707 ASSERT(bip != NULL); 701 ASSERT(bip != NULL);
708 ASSERT(atomic_read(&bip->bli_refcount) > 0); 702 ASSERT(atomic_read(&bip->bli_refcount) > 0);
@@ -774,7 +768,6 @@ xfs_trans_inode_buf(
774{ 768{
775 xfs_buf_log_item_t *bip = bp->b_fspriv; 769 xfs_buf_log_item_t *bip = bp->b_fspriv;
776 770
777 ASSERT(XFS_BUF_ISBUSY(bp));
778 ASSERT(bp->b_transp == tp); 771 ASSERT(bp->b_transp == tp);
779 ASSERT(bip != NULL); 772 ASSERT(bip != NULL);
780 ASSERT(atomic_read(&bip->bli_refcount) > 0); 773 ASSERT(atomic_read(&bip->bli_refcount) > 0);
@@ -798,7 +791,6 @@ xfs_trans_stale_inode_buf(
798{ 791{
799 xfs_buf_log_item_t *bip = bp->b_fspriv; 792 xfs_buf_log_item_t *bip = bp->b_fspriv;
800 793
801 ASSERT(XFS_BUF_ISBUSY(bp));
802 ASSERT(bp->b_transp == tp); 794 ASSERT(bp->b_transp == tp);
803 ASSERT(bip != NULL); 795 ASSERT(bip != NULL);
804 ASSERT(atomic_read(&bip->bli_refcount) > 0); 796 ASSERT(atomic_read(&bip->bli_refcount) > 0);
@@ -823,7 +815,6 @@ xfs_trans_inode_alloc_buf(
823{ 815{
824 xfs_buf_log_item_t *bip = bp->b_fspriv; 816 xfs_buf_log_item_t *bip = bp->b_fspriv;
825 817
826 ASSERT(XFS_BUF_ISBUSY(bp));
827 ASSERT(bp->b_transp == tp); 818 ASSERT(bp->b_transp == tp);
828 ASSERT(bip != NULL); 819 ASSERT(bip != NULL);
829 ASSERT(atomic_read(&bip->bli_refcount) > 0); 820 ASSERT(atomic_read(&bip->bli_refcount) > 0);
@@ -851,7 +842,6 @@ xfs_trans_dquot_buf(
851{ 842{
852 xfs_buf_log_item_t *bip = bp->b_fspriv; 843 xfs_buf_log_item_t *bip = bp->b_fspriv;
853 844
854 ASSERT(XFS_BUF_ISBUSY(bp));
855 ASSERT(bp->b_transp == tp); 845 ASSERT(bp->b_transp == tp);
856 ASSERT(bip != NULL); 846 ASSERT(bip != NULL);
857 ASSERT(type == XFS_BLF_UDQUOT_BUF || 847 ASSERT(type == XFS_BLF_UDQUOT_BUF ||
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index 4d00ee67792d..4d00ee67792d 100644
--- a/fs/xfs/quota/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h
index 212946b97239..22750b5e4a8f 100644
--- a/fs/xfs/xfs_trans_priv.h
+++ b/fs/xfs/xfs_trans_priv.h
@@ -64,23 +64,17 @@ struct xfs_ail_cursor {
64 */ 64 */
65struct xfs_ail { 65struct xfs_ail {
66 struct xfs_mount *xa_mount; 66 struct xfs_mount *xa_mount;
67 struct task_struct *xa_task;
67 struct list_head xa_ail; 68 struct list_head xa_ail;
68 xfs_lsn_t xa_target; 69 xfs_lsn_t xa_target;
69 struct list_head xa_cursors; 70 struct list_head xa_cursors;
70 spinlock_t xa_lock; 71 spinlock_t xa_lock;
71 struct delayed_work xa_work;
72 xfs_lsn_t xa_last_pushed_lsn; 72 xfs_lsn_t xa_last_pushed_lsn;
73 unsigned long xa_flags;
74}; 73};
75 74
76#define XFS_AIL_PUSHING_BIT 0
77
78/* 75/*
79 * From xfs_trans_ail.c 76 * From xfs_trans_ail.c
80 */ 77 */
81
82extern struct workqueue_struct *xfs_ail_wq; /* AIL workqueue */
83
84void xfs_trans_ail_update_bulk(struct xfs_ail *ailp, 78void xfs_trans_ail_update_bulk(struct xfs_ail *ailp,
85 struct xfs_ail_cursor *cur, 79 struct xfs_ail_cursor *cur,
86 struct xfs_log_item **log_items, int nr_items, 80 struct xfs_log_item **log_items, int nr_items,
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/xfs_vnode.h
index 7c220b4227bc..7c220b4227bc 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/xfs_vnode.h
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 9322e13f0c63..51fc429527bc 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -83,7 +83,9 @@ xfs_readlink_bmap(
83 83
84 bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 84 bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt),
85 XBF_LOCK | XBF_MAPPED | XBF_DONT_BLOCK); 85 XBF_LOCK | XBF_MAPPED | XBF_DONT_BLOCK);
86 error = XFS_BUF_GETERROR(bp); 86 if (!bp)
87 return XFS_ERROR(ENOMEM);
88 error = bp->b_error;
87 if (error) { 89 if (error) {
88 xfs_ioerror_alert("xfs_readlink", 90 xfs_ioerror_alert("xfs_readlink",
89 ip->i_mount, bp, XFS_BUF_ADDR(bp)); 91 ip->i_mount, bp, XFS_BUF_ADDR(bp));
@@ -94,7 +96,7 @@ xfs_readlink_bmap(
94 byte_cnt = pathlen; 96 byte_cnt = pathlen;
95 pathlen -= byte_cnt; 97 pathlen -= byte_cnt;
96 98
97 memcpy(link, XFS_BUF_PTR(bp), byte_cnt); 99 memcpy(link, bp->b_addr, byte_cnt);
98 xfs_buf_relse(bp); 100 xfs_buf_relse(bp);
99 } 101 }
100 102
@@ -1648,13 +1650,13 @@ xfs_symlink(
1648 byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); 1650 byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
1649 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, 1651 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
1650 BTOBB(byte_cnt), 0); 1652 BTOBB(byte_cnt), 0);
1651 ASSERT(bp && !XFS_BUF_GETERROR(bp)); 1653 ASSERT(!xfs_buf_geterror(bp));
1652 if (pathlen < byte_cnt) { 1654 if (pathlen < byte_cnt) {
1653 byte_cnt = pathlen; 1655 byte_cnt = pathlen;
1654 } 1656 }
1655 pathlen -= byte_cnt; 1657 pathlen -= byte_cnt;
1656 1658
1657 memcpy(XFS_BUF_PTR(bp), cur_chunk, byte_cnt); 1659 memcpy(bp->b_addr, cur_chunk, byte_cnt);
1658 cur_chunk += byte_cnt; 1660 cur_chunk += byte_cnt;
1659 1661
1660 xfs_trans_log_buf(tp, bp, 0, byte_cnt - 1); 1662 xfs_trans_log_buf(tp, bp, 0, byte_cnt - 1);
@@ -1999,7 +2001,7 @@ xfs_zero_remaining_bytes(
1999 mp, bp, XFS_BUF_ADDR(bp)); 2001 mp, bp, XFS_BUF_ADDR(bp));
2000 break; 2002 break;
2001 } 2003 }
2002 memset(XFS_BUF_PTR(bp) + 2004 memset(bp->b_addr +
2003 (offset - XFS_FSB_TO_B(mp, imap.br_startoff)), 2005 (offset - XFS_FSB_TO_B(mp, imap.br_startoff)),
2004 0, lastoffset - offset + 1); 2006 0, lastoffset - offset + 1);
2005 XFS_BUF_UNDONE(bp); 2007 XFS_BUF_UNDONE(bp);
diff --git a/fs/xfs/linux-2.6/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 87d3e03878c8..87d3e03878c8 100644
--- a/fs/xfs/linux-2.6/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c