diff options
Diffstat (limited to 'fs/xfs')
| -rw-r--r-- | fs/xfs/Makefile | 119 | ||||
| -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.h | 3 | ||||
| -rw-r--r-- | fs/xfs/xfs_acl.c (renamed from fs/xfs/linux-2.6/xfs_acl.c) | 6 | ||||
| -rw-r--r-- | fs/xfs/xfs_acl.h | 5 | ||||
| -rw-r--r-- | fs/xfs/xfs_ag.h | 6 | ||||
| -rw-r--r-- | fs/xfs/xfs_alloc.c | 7 | ||||
| -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.c | 3 | ||||
| -rw-r--r-- | fs/xfs/xfs_bmap.c | 10 | ||||
| -rw-r--r-- | fs/xfs/xfs_btree.c | 17 | ||||
| -rw-r--r-- | fs/xfs/xfs_btree.h | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_buf.c (renamed from fs/xfs/linux-2.6/xfs_buf.c) | 18 | ||||
| -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.c | 24 | ||||
| -rw-r--r-- | fs/xfs/xfs_da_btree.c | 44 | ||||
| -rw-r--r-- | fs/xfs/xfs_dinode.h | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_dir2.c | 16 | ||||
| -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) | 0 | ||||
| -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) | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_filestream.c | 14 | ||||
| -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.c | 5 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode.c | 20 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode.h | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_ioctl.c (renamed from fs/xfs/linux-2.6/xfs_ioctl.c) | 6 | ||||
| -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) | 23 | ||||
| -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) | 27 | ||||
| -rw-r--r-- | fs/xfs/xfs_log.c | 14 | ||||
| -rw-r--r-- | fs/xfs/xfs_log_recover.c | 42 | ||||
| -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.c | 6 | ||||
| -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_rename.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_rtalloc.c | 32 | ||||
| -rw-r--r-- | fs/xfs/xfs_rtalloc.h | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_rw.c | 8 | ||||
| -rw-r--r-- | fs/xfs/xfs_sb.h | 2 | ||||
| -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) | 36 | ||||
| -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_ail.c | 67 | ||||
| -rw-r--r-- | fs/xfs/xfs_trans_buf.c | 28 | ||||
| -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_vnode.h (renamed from fs/xfs/linux-2.6/xfs_vnode.h) | 0 | ||||
| -rw-r--r-- | fs/xfs/xfs_vnodeops.c | 22 | ||||
| -rw-r--r-- | fs/xfs/xfs_xattr.c (renamed from fs/xfs/linux-2.6/xfs_xattr.c) | 0 | 
80 files changed, 335 insertions, 370 deletions
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile index 75bb316529d..427a4e82a58 100644 --- a/fs/xfs/Makefile +++ b/fs/xfs/Makefile @@ -16,44 +16,53 @@  # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  # -ccflags-y := -I$(src) -I$(src)/linux-2.6 -ccflags-$(CONFIG_XFS_DEBUG) += -g +ccflags-y += -I$(src)			# needed for trace events -XFS_LINUX := linux-2.6 +ccflags-$(CONFIG_XFS_DEBUG) += -g  obj-$(CONFIG_XFS_FS)		+= xfs.o -xfs-y				+= linux-2.6/xfs_trace.o - -xfs-$(CONFIG_XFS_QUOTA)		+= $(addprefix quota/, \ -				   xfs_dquot.o \ -				   xfs_dquot_item.o \ -				   xfs_trans_dquot.o \ -				   xfs_qm_syscalls.o \ -				   xfs_qm_bhv.o \ -				   xfs_qm.o) -xfs-$(CONFIG_XFS_QUOTA)		+= linux-2.6/xfs_quotaops.o - -ifeq ($(CONFIG_XFS_QUOTA),y) -xfs-$(CONFIG_PROC_FS)		+= quota/xfs_qm_stats.o -endif - -xfs-$(CONFIG_XFS_RT)		+= xfs_rtalloc.o -xfs-$(CONFIG_XFS_POSIX_ACL)	+= $(XFS_LINUX)/xfs_acl.o -xfs-$(CONFIG_PROC_FS)		+= $(XFS_LINUX)/xfs_stats.o -xfs-$(CONFIG_SYSCTL)		+= $(XFS_LINUX)/xfs_sysctl.o -xfs-$(CONFIG_COMPAT)		+= $(XFS_LINUX)/xfs_ioctl32.o +# this one should be compiled first, as the tracing macros can easily blow up +xfs-y				+= xfs_trace.o +# highlevel code +xfs-y				+= xfs_aops.o \ +				   xfs_bit.o \ +				   xfs_buf.o \ +				   xfs_dfrag.o \ +				   xfs_discard.o \ +				   xfs_error.o \ +				   xfs_export.o \ +				   xfs_file.o \ +				   xfs_filestream.o \ +				   xfs_fsops.o \ +				   xfs_fs_subr.o \ +				   xfs_globals.o \ +				   xfs_iget.o \ +				   xfs_ioctl.o \ +				   xfs_iomap.o \ +				   xfs_iops.o \ +				   xfs_itable.o \ +				   xfs_message.o \ +				   xfs_mru_cache.o \ +				   xfs_super.o \ +				   xfs_sync.o \ +				   xfs_xattr.o \ +				   xfs_rename.o \ +				   xfs_rw.o \ +				   xfs_utils.o \ +				   xfs_vnodeops.o \ +				   kmem.o \ +				   uuid.o +# code shared with libxfs  xfs-y				+= xfs_alloc.o \  				   xfs_alloc_btree.o \  				   xfs_attr.o \  				   xfs_attr_leaf.o \ -				   xfs_bit.o \  				   xfs_bmap.o \  				   xfs_bmap_btree.o \  				   xfs_btree.o \ -				   xfs_buf_item.o \  				   xfs_da_btree.o \  				   xfs_dir2.o \  				   xfs_dir2_block.o \ @@ -61,49 +70,37 @@ xfs-y				+= xfs_alloc.o \  				   xfs_dir2_leaf.o \  				   xfs_dir2_node.o \  				   xfs_dir2_sf.o \ -				   xfs_error.o \ -				   xfs_extfree_item.o \ -				   xfs_filestream.o \ -				   xfs_fsops.o \  				   xfs_ialloc.o \  				   xfs_ialloc_btree.o \ -				   xfs_iget.o \  				   xfs_inode.o \ -				   xfs_inode_item.o \ -				   xfs_iomap.o \ -				   xfs_itable.o \ -				   xfs_dfrag.o \ -				   xfs_log.o \ -				   xfs_log_cil.o \  				   xfs_log_recover.o \  				   xfs_mount.o \ -				   xfs_mru_cache.o \ -				   xfs_rename.o \ -				   xfs_trans.o \ +				   xfs_trans.o + +# low-level transaction/log code +xfs-y				+= xfs_log.o \ +				   xfs_log_cil.o \ +				   xfs_buf_item.o \ +				   xfs_extfree_item.o \ +				   xfs_inode_item.o \  				   xfs_trans_ail.o \  				   xfs_trans_buf.o \  				   xfs_trans_extfree.o \  				   xfs_trans_inode.o \ -				   xfs_utils.o \ -				   xfs_vnodeops.o \ -				   xfs_rw.o - -# Objects in linux/ -xfs-y				+= $(addprefix $(XFS_LINUX)/, \ -				   kmem.o \ -				   xfs_aops.o \ -				   xfs_buf.o \ -				   xfs_discard.o \ -				   xfs_export.o \ -				   xfs_file.o \ -				   xfs_fs_subr.o \ -				   xfs_globals.o \ -				   xfs_ioctl.o \ -				   xfs_iops.o \ -				   xfs_message.o \ -				   xfs_super.o \ -				   xfs_sync.o \ -				   xfs_xattr.o) -# Objects in support/ -xfs-y				+= support/uuid.o +# optional features +xfs-$(CONFIG_XFS_QUOTA)		+= xfs_dquot.o \ +				   xfs_dquot_item.o \ +				   xfs_trans_dquot.o \ +				   xfs_qm_syscalls.o \ +				   xfs_qm_bhv.o \ +				   xfs_qm.o \ +				   xfs_quotaops.o +ifeq ($(CONFIG_XFS_QUOTA),y) +xfs-$(CONFIG_PROC_FS)		+= xfs_qm_stats.o +endif +xfs-$(CONFIG_XFS_RT)		+= xfs_rtalloc.o +xfs-$(CONFIG_XFS_POSIX_ACL)	+= xfs_acl.o +xfs-$(CONFIG_PROC_FS)		+= xfs_stats.o +xfs-$(CONFIG_SYSCTL)		+= xfs_sysctl.o +xfs-$(CONFIG_COMPAT)		+= xfs_ioctl32.o diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/kmem.c index a907de565db..a907de565db 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 292eff19803..292eff19803 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 ff6a19873e5..ff6a19873e5 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 387e695a184..387e695a184 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 b83f76b6d41..b83f76b6d41 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 4732d71262c..4732d71262c 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 53ec3ea9a62..d8b11b7f94a 100644 --- a/fs/xfs/xfs.h +++ b/fs/xfs/xfs.h @@ -24,5 +24,6 @@  #define XFS_BUF_LOCK_TRACKING 1  #endif -#include <linux-2.6/xfs_linux.h> +#include "xfs_linux.h" +  #endif	/* __XFS_H__ */ diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/xfs_acl.c index 44ce5165680..b6c4b3795c4 100644 --- a/fs/xfs/linux-2.6/xfs_acl.c +++ b/fs/xfs/xfs_acl.c @@ -221,7 +221,7 @@ xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)  }  static int -xfs_set_mode(struct inode *inode, mode_t mode) +xfs_set_mode(struct inode *inode, umode_t mode)  {  	int error = 0; @@ -267,7 +267,7 @@ posix_acl_default_exists(struct inode *inode)  int  xfs_inherit_acl(struct inode *inode, struct posix_acl *acl)  { -	mode_t mode = inode->i_mode; +	umode_t mode = inode->i_mode;  	int error = 0, inherit = 0;  	if (S_ISDIR(inode->i_mode)) { @@ -381,7 +381,7 @@ xfs_xattr_acl_set(struct dentry *dentry, const char *name,  		goto out_release;  	if (type == ACL_TYPE_ACCESS) { -		mode_t mode = inode->i_mode; +		umode_t mode = inode->i_mode;  		error = posix_acl_equiv_mode(acl, &mode);  		if (error <= 0) { diff --git a/fs/xfs/xfs_acl.h b/fs/xfs/xfs_acl.h index 2c656ef4947..39632d94135 100644 --- a/fs/xfs/xfs_acl.h +++ b/fs/xfs/xfs_acl.h @@ -51,7 +51,10 @@ extern int posix_acl_default_exists(struct inode *inode);  extern const struct xattr_handler xfs_xattr_acl_access_handler;  extern const struct xattr_handler xfs_xattr_acl_default_handler;  #else -# define xfs_get_acl(inode, type)			NULL +static inline struct posix_acl *xfs_get_acl(struct inode *inode, int type) +{ +	return NULL; +}  # define xfs_inherit_acl(inode, default_acl)		0  # define xfs_acl_chmod(inode)				0  # define posix_acl_access_exists(inode)			0 diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h index 6530769a999..4805f009f92 100644 --- a/fs/xfs/xfs_ag.h +++ b/fs/xfs/xfs_ag.h @@ -103,7 +103,7 @@ typedef struct xfs_agf {  /* disk block (xfs_daddr_t) in the AG */  #define XFS_AGF_DADDR(mp)	((xfs_daddr_t)(1 << (mp)->m_sectbb_log))  #define	XFS_AGF_BLOCK(mp)	XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp)) -#define	XFS_BUF_TO_AGF(bp)	((xfs_agf_t *)XFS_BUF_PTR(bp)) +#define	XFS_BUF_TO_AGF(bp)	((xfs_agf_t *)((bp)->b_addr))  extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,  			xfs_agnumber_t agno, int flags, struct xfs_buf **bpp); @@ -156,7 +156,7 @@ typedef struct xfs_agi {  /* disk block (xfs_daddr_t) in the AG */  #define XFS_AGI_DADDR(mp)	((xfs_daddr_t)(2 << (mp)->m_sectbb_log))  #define	XFS_AGI_BLOCK(mp)	XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp)) -#define	XFS_BUF_TO_AGI(bp)	((xfs_agi_t *)XFS_BUF_PTR(bp)) +#define	XFS_BUF_TO_AGI(bp)	((xfs_agi_t *)((bp)->b_addr))  extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,  				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,  #define XFS_AGFL_DADDR(mp)	((xfs_daddr_t)(3 << (mp)->m_sectbb_log))  #define	XFS_AGFL_BLOCK(mp)	XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))  #define XFS_AGFL_SIZE(mp)	((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t)) -#define	XFS_BUF_TO_AGFL(bp)	((xfs_agfl_t *)XFS_BUF_PTR(bp)) +#define	XFS_BUF_TO_AGFL(bp)	((xfs_agfl_t *)((bp)->b_addr))  typedef struct xfs_agfl {  	__be32		agfl_bno[1];	/* actually XFS_AGFL_SIZE(mp) */ diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index 1e00b3ef627..bdd9cb54d63 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c @@ -451,8 +451,7 @@ xfs_alloc_read_agfl(  			XFS_FSS_TO_BB(mp, 1), 0, &bp);  	if (error)  		return error; -	ASSERT(bp); -	ASSERT(!XFS_BUF_GETERROR(bp)); +	ASSERT(!xfs_buf_geterror(bp));  	XFS_BUF_SET_VTYPE_REF(bp, B_FS_AGFL, XFS_AGFL_REF);  	*bpp = bp;  	return 0; @@ -2116,7 +2115,7 @@ xfs_read_agf(  	if (!*bpp)  		return 0; -	ASSERT(!XFS_BUF_GETERROR(*bpp)); +	ASSERT(!(*bpp)->b_error);  	agf = XFS_BUF_TO_AGF(*bpp);  	/* @@ -2168,7 +2167,7 @@ xfs_alloc_read_agf(  		return error;  	if (!*bpp)  		return 0; -	ASSERT(!XFS_BUF_GETERROR(*bpp)); +	ASSERT(!(*bpp)->b_error);  	agf = XFS_BUF_TO_AGF(*bpp);  	pag = xfs_perag_get(mp, agno); diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/xfs_aops.c index 63e971e2b83..8c37dde4c52 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(  	bool			is_async)  {  	struct xfs_ioend	*ioend = iocb->private; +	struct inode		*inode = ioend->io_inode;  	/*  	 * blockdev_direct_IO can return an error even after the I/O @@ -1331,7 +1332,7 @@ xfs_end_io_direct_write(  	}  	/* XXX: probably should move into the real I/O completion handler */ -	inode_dio_done(ioend->io_inode); +	inode_dio_done(inode);  }  STATIC ssize_t diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/xfs_aops.h index 71f721e1a71..71f721e1a71 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 cbae424fe1b..160bcdc34a6 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)  		bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt,  				 XBF_LOCK | XBF_DONT_BLOCK); -		ASSERT(bp); -		ASSERT(!XFS_BUF_GETERROR(bp)); +		ASSERT(!xfs_buf_geterror(bp));  		tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen :  							XFS_BUF_SIZE(bp); diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index c51a3f90363..452a291383a 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c @@ -414,7 +414,7 @@ xfs_bmap_add_attrfork_local(  	if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip))  		return 0; -	if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { +	if (S_ISDIR(ip->i_d.di_mode)) {  		mp = ip->i_mount;  		memset(&dargs, 0, sizeof(dargs));  		dargs.dp = ip; @@ -3344,8 +3344,7 @@ xfs_bmap_local_to_extents(  	 * We don't want to deal with the case of keeping inode data inline yet.  	 * So sending the data fork of a regular inode is invalid.  	 */ -	ASSERT(!((ip->i_d.di_mode & S_IFMT) == S_IFREG && -		 whichfork == XFS_DATA_FORK)); +	ASSERT(!(S_ISREG(ip->i_d.di_mode) && whichfork == XFS_DATA_FORK));  	ifp = XFS_IFORK_PTR(ip, whichfork);  	ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL);  	flags = 0; @@ -3384,8 +3383,7 @@ xfs_bmap_local_to_extents(  		ASSERT(args.len == 1);  		*firstblock = args.fsbno;  		bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0); -		memcpy((char *)XFS_BUF_PTR(bp), ifp->if_u1.if_data, -			ifp->if_bytes); +		memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes);  		xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1);  		xfs_bmap_forkoff_reset(args.mp, ip, whichfork);  		xfs_idata_realloc(ip, -ifp->if_bytes, whichfork); @@ -4052,7 +4050,7 @@ xfs_bmap_one_block(  #ifndef DEBUG  	if (whichfork == XFS_DATA_FORK) { -		return ((ip->i_d.di_mode & S_IFMT) == S_IFREG) ? +		return S_ISREG(ip->i_d.di_mode) ?  			(ip->i_size == ip->i_mount->m_sb.sb_blocksize) :  			(ip->i_d.di_size == ip->i_mount->m_sb.sb_blocksize);  	} diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c index cabf4b5604a..2b9fd385e27 100644 --- a/fs/xfs/xfs_btree.c +++ b/fs/xfs/xfs_btree.c @@ -275,8 +275,7 @@ xfs_btree_dup_cursor(  				return error;  			}  			new->bc_bufs[i] = bp; -			ASSERT(bp); -			ASSERT(!XFS_BUF_GETERROR(bp)); +			ASSERT(!xfs_buf_geterror(bp));  		} else  			new->bc_bufs[i] = NULL;  	} @@ -467,8 +466,7 @@ xfs_btree_get_bufl(  	ASSERT(fsbno != NULLFSBLOCK);  	d = XFS_FSB_TO_DADDR(mp, fsbno);  	bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock); -	ASSERT(bp); -	ASSERT(!XFS_BUF_GETERROR(bp)); +	ASSERT(!xfs_buf_geterror(bp));  	return bp;  } @@ -491,8 +489,7 @@ xfs_btree_get_bufs(  	ASSERT(agbno != NULLAGBLOCK);  	d = XFS_AGB_TO_DADDR(mp, agno, agbno);  	bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock); -	ASSERT(bp); -	ASSERT(!XFS_BUF_GETERROR(bp)); +	ASSERT(!xfs_buf_geterror(bp));  	return bp;  } @@ -632,7 +629,7 @@ xfs_btree_read_bufl(  			mp->m_bsize, lock, &bp))) {  		return error;  	} -	ASSERT(!bp || !XFS_BUF_GETERROR(bp)); +	ASSERT(!xfs_buf_geterror(bp));  	if (bp)  		XFS_BUF_SET_VTYPE_REF(bp, B_FS_MAP, refval);  	*bpp = bp; @@ -973,8 +970,7 @@ xfs_btree_get_buf_block(  	*bpp = xfs_trans_get_buf(cur->bc_tp, mp->m_ddev_targp, d,  				 mp->m_bsize, flags); -	ASSERT(*bpp); -	ASSERT(!XFS_BUF_GETERROR(*bpp)); +	ASSERT(!xfs_buf_geterror(*bpp));  	*block = XFS_BUF_TO_BLOCK(*bpp);  	return 0; @@ -1006,8 +1002,7 @@ xfs_btree_read_buf_block(  	if (error)  		return error; -	ASSERT(*bpp != NULL); -	ASSERT(!XFS_BUF_GETERROR(*bpp)); +	ASSERT(!xfs_buf_geterror(*bpp));  	xfs_btree_set_refs(cur, *bpp);  	*block = XFS_BUF_TO_BLOCK(*bpp); diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h index 8d05a6a46ce..5b240de104c 100644 --- a/fs/xfs/xfs_btree.h +++ b/fs/xfs/xfs_btree.h @@ -262,7 +262,7 @@ typedef struct xfs_btree_cur  /*   * Convert from buffer to btree block header.   */ -#define	XFS_BUF_TO_BLOCK(bp)	((struct xfs_btree_block *)XFS_BUF_PTR(bp)) +#define	XFS_BUF_TO_BLOCK(bp)	((struct xfs_btree_block *)((bp)->b_addr))  /* diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/xfs_buf.c index b2b41198559..c57836dc778 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -596,7 +596,7 @@ _xfs_buf_read(  	bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD);  	status = xfs_buf_iorequest(bp); -	if (status || XFS_BUF_ISERROR(bp) || (flags & XBF_ASYNC)) +	if (status || bp->b_error || (flags & XBF_ASYNC))  		return status;  	return xfs_buf_iowait(bp);  } @@ -679,7 +679,6 @@ xfs_buf_read_uncached(  	/* set up the buffer for a read IO */  	XFS_BUF_SET_ADDR(bp, daddr);  	XFS_BUF_READ(bp); -	XFS_BUF_BUSY(bp);  	xfsbdstrat(mp, bp);  	error = xfs_buf_iowait(bp); @@ -1069,7 +1068,7 @@ xfs_bioerror(  	/*  	 * No need to wait until the buffer is unpinned, we aren't flushing it.  	 */ -	XFS_BUF_ERROR(bp, EIO); +	xfs_buf_ioerror(bp, EIO);  	/*  	 * We're calling xfs_buf_ioend, so delete XBF_DONE flag. @@ -1094,7 +1093,7 @@ STATIC int  xfs_bioerror_relse(  	struct xfs_buf	*bp)  { -	int64_t		fl = XFS_BUF_BFLAGS(bp); +	int64_t		fl = bp->b_flags;  	/*  	 * No need to wait until the buffer is unpinned.  	 * We aren't flushing it. @@ -1115,7 +1114,7 @@ xfs_bioerror_relse(  		 * There's no reason to mark error for  		 * ASYNC buffers.  		 */ -		XFS_BUF_ERROR(bp, EIO); +		xfs_buf_ioerror(bp, EIO);  		XFS_BUF_FINISH_IOWAIT(bp);  	} else {  		xfs_buf_relse(bp); @@ -1224,6 +1223,9 @@ _xfs_buf_ioapply(  		rw = READ;  	} +	/* we only use the buffer cache for meta-data */ +	rw |= REQ_META; +  next_chunk:  	atomic_inc(&bp->b_io_remaining);  	nr_pages = BIO_MAX_SECTORS >> (PAGE_SHIFT - BBSHIFT); @@ -1321,7 +1323,7 @@ xfs_buf_offset(  	struct page		*page;  	if (bp->b_flags & XBF_MAPPED) -		return XFS_BUF_PTR(bp) + offset; +		return bp->b_addr + offset;  	offset += bp->b_offset;  	page = bp->b_pages[offset >> PAGE_SHIFT]; @@ -1481,7 +1483,7 @@ xfs_setsize_buftarg_flags(  	if (set_blocksize(btp->bt_bdev, sectorsize)) {  		xfs_warn(btp->bt_mount,  			"Cannot set_blocksize to %u on device %s\n", -			sectorsize, XFS_BUFTARG_NAME(btp)); +			sectorsize, xfs_buf_target_name(btp));  		return EINVAL;  	} @@ -1678,7 +1680,7 @@ xfs_buf_delwri_split(  	list_for_each_entry_safe(bp, n, dwq, b_list) {  		ASSERT(bp->b_flags & XBF_DELWRI); -		if (!XFS_BUF_ISPINNED(bp) && xfs_buf_trylock(bp)) { +		if (!xfs_buf_ispinned(bp) && xfs_buf_trylock(bp)) {  			if (!force &&  			    time_before(jiffies, bp->b_queuetime + age)) {  				xfs_buf_unlock(bp); diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/xfs_buf.h index 6a83b46b4bc..620972b8094 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 *);  extern int xfs_buf_init(void);  extern void xfs_buf_terminate(void); -#define xfs_buf_target_name(target)	\ -	({ char __b[BDEVNAME_SIZE]; bdevname((target)->bt_bdev, __b); __b; }) +static inline const char * +xfs_buf_target_name(struct xfs_buftarg *target) +{ +	static char __b[BDEVNAME_SIZE]; + +	return bdevname(target->bt_bdev, __b); +} -#define XFS_BUF_BFLAGS(bp)	((bp)->b_flags)  #define XFS_BUF_ZEROFLAGS(bp) \  	((bp)->b_flags &= ~(XBF_READ|XBF_WRITE|XBF_ASYNC|XBF_DELWRI| \  			    XBF_SYNCIO|XBF_FUA|XBF_FLUSH)) @@ -251,23 +255,14 @@ void xfs_buf_stale(struct xfs_buf *bp);  #define XFS_BUF_UNDELAYWRITE(bp)	xfs_buf_delwri_dequeue(bp)  #define XFS_BUF_ISDELAYWRITE(bp)	((bp)->b_flags & XBF_DELWRI) -#define XFS_BUF_ERROR(bp,no)	xfs_buf_ioerror(bp,no) -#define XFS_BUF_GETERROR(bp)	xfs_buf_geterror(bp) -#define XFS_BUF_ISERROR(bp)	(xfs_buf_geterror(bp) ? 1 : 0) -  #define XFS_BUF_DONE(bp)	((bp)->b_flags |= XBF_DONE)  #define XFS_BUF_UNDONE(bp)	((bp)->b_flags &= ~XBF_DONE)  #define XFS_BUF_ISDONE(bp)	((bp)->b_flags & XBF_DONE) -#define XFS_BUF_BUSY(bp)	do { } while (0) -#define XFS_BUF_UNBUSY(bp)	do { } while (0) -#define XFS_BUF_ISBUSY(bp)	(1) -  #define XFS_BUF_ASYNC(bp)	((bp)->b_flags |= XBF_ASYNC)  #define XFS_BUF_UNASYNC(bp)	((bp)->b_flags &= ~XBF_ASYNC)  #define XFS_BUF_ISASYNC(bp)	((bp)->b_flags & XBF_ASYNC) -#define XFS_BUF_HOLD(bp)	xfs_buf_hold(bp)  #define XFS_BUF_READ(bp)	((bp)->b_flags |= XBF_READ)  #define XFS_BUF_UNREAD(bp)	((bp)->b_flags &= ~XBF_READ)  #define XFS_BUF_ISREAD(bp)	((bp)->b_flags & XBF_READ) @@ -276,10 +271,6 @@ void xfs_buf_stale(struct xfs_buf *bp);  #define XFS_BUF_UNWRITE(bp)	((bp)->b_flags &= ~XBF_WRITE)  #define XFS_BUF_ISWRITE(bp)	((bp)->b_flags & XBF_WRITE) -#define XFS_BUF_SET_START(bp)			do { } while (0) - -#define XFS_BUF_PTR(bp)			(xfs_caddr_t)((bp)->b_addr) -#define XFS_BUF_SET_PTR(bp, val, cnt)	xfs_buf_associate_memory(bp, val, cnt)  #define XFS_BUF_ADDR(bp)		((bp)->b_bn)  #define XFS_BUF_SET_ADDR(bp, bno)	((bp)->b_bn = (xfs_daddr_t)(bno))  #define XFS_BUF_OFFSET(bp)		((bp)->b_file_offset) @@ -299,14 +290,13 @@ xfs_buf_set_ref(  #define XFS_BUF_SET_VTYPE_REF(bp, type, ref)	xfs_buf_set_ref(bp, ref)  #define XFS_BUF_SET_VTYPE(bp, type)		do { } while (0) -#define XFS_BUF_ISPINNED(bp)	atomic_read(&((bp)->b_pin_count)) +static inline int xfs_buf_ispinned(struct xfs_buf *bp) +{ +	return atomic_read(&bp->b_pin_count); +}  #define XFS_BUF_FINISH_IOWAIT(bp)	complete(&bp->b_iowait); -#define XFS_BUF_SET_TARGET(bp, target)	((bp)->b_target = (target)) -#define XFS_BUF_TARGET(bp)		((bp)->b_target) -#define XFS_BUFTARG_NAME(target)	xfs_buf_target_name(target) -  static inline void xfs_buf_relse(xfs_buf_t *bp)  {  	xfs_buf_unlock(bp); diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 88492916c3d..cac2ecfa674 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c @@ -124,9 +124,9 @@ xfs_buf_item_log_check(  	bp = bip->bli_buf;  	ASSERT(XFS_BUF_COUNT(bp) > 0); -	ASSERT(XFS_BUF_PTR(bp) != NULL); +	ASSERT(bp->b_addr != NULL);  	orig = bip->bli_orig; -	buffer = XFS_BUF_PTR(bp); +	buffer = bp->b_addr;  	for (x = 0; x < XFS_BUF_COUNT(bp); x++) {  		if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) {  			xfs_emerg(bp->b_mount, @@ -371,7 +371,6 @@ xfs_buf_item_pin(  {  	struct xfs_buf_log_item	*bip = BUF_ITEM(lip); -	ASSERT(XFS_BUF_ISBUSY(bip->bli_buf));  	ASSERT(atomic_read(&bip->bli_refcount) > 0);  	ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||  	       (bip->bli_flags & XFS_BLI_STALE)); @@ -479,13 +478,13 @@ xfs_buf_item_trylock(  	struct xfs_buf_log_item	*bip = BUF_ITEM(lip);  	struct xfs_buf		*bp = bip->bli_buf; -	if (XFS_BUF_ISPINNED(bp)) +	if (xfs_buf_ispinned(bp))  		return XFS_ITEM_PINNED;  	if (!xfs_buf_trylock(bp))  		return XFS_ITEM_LOCKED;  	/* take a reference to the buffer.  */ -	XFS_BUF_HOLD(bp); +	xfs_buf_hold(bp);  	ASSERT(!(bip->bli_flags & XFS_BLI_STALE));  	trace_xfs_buf_item_trylock(bip); @@ -726,7 +725,7 @@ xfs_buf_item_init(  	 * to have logged.  	 */  	bip->bli_orig = (char *)kmem_alloc(XFS_BUF_COUNT(bp), KM_SLEEP); -	memcpy(bip->bli_orig, XFS_BUF_PTR(bp), XFS_BUF_COUNT(bp)); +	memcpy(bip->bli_orig, bp->b_addr, XFS_BUF_COUNT(bp));  	bip->bli_logged = (char *)kmem_zalloc(XFS_BUF_COUNT(bp) / NBBY, KM_SLEEP);  #endif @@ -895,7 +894,6 @@ xfs_buf_attach_iodone(  {  	xfs_log_item_t	*head_lip; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(xfs_buf_islocked(bp));  	lip->li_cb = cb; @@ -960,7 +958,7 @@ xfs_buf_iodone_callbacks(  	static ulong		lasttime;  	static xfs_buftarg_t	*lasttarg; -	if (likely(!XFS_BUF_GETERROR(bp))) +	if (likely(!xfs_buf_geterror(bp)))  		goto do_callbacks;  	/* @@ -973,14 +971,14 @@ xfs_buf_iodone_callbacks(  		goto do_callbacks;  	} -	if (XFS_BUF_TARGET(bp) != lasttarg || +	if (bp->b_target != lasttarg ||  	    time_after(jiffies, (lasttime + 5*HZ))) {  		lasttime = jiffies;  		xfs_alert(mp, "Device %s: metadata write error block 0x%llx", -			XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)), +			xfs_buf_target_name(bp->b_target),  		      (__uint64_t)XFS_BUF_ADDR(bp));  	} -	lasttarg = XFS_BUF_TARGET(bp); +	lasttarg = bp->b_target;  	/*  	 * If the write was asynchronous then no one will be looking for the @@ -991,12 +989,11 @@ xfs_buf_iodone_callbacks(  	 * around.  	 */  	if (XFS_BUF_ISASYNC(bp)) { -		XFS_BUF_ERROR(bp, 0); /* errno of 0 unsets the flag */ +		xfs_buf_ioerror(bp, 0); /* errno of 0 unsets the flag */  		if (!XFS_BUF_ISSTALE(bp)) {  			XFS_BUF_DELAYWRITE(bp);  			XFS_BUF_DONE(bp); -			XFS_BUF_SET_START(bp);  		}  		ASSERT(bp->b_iodone != NULL);  		trace_xfs_buf_item_iodone_async(bp, _RET_IP_); @@ -1013,7 +1010,6 @@ xfs_buf_iodone_callbacks(  	XFS_BUF_UNDELAYWRITE(bp);  	trace_xfs_buf_error_relse(bp, _RET_IP_); -	xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);  do_callbacks:  	xfs_buf_do_callbacks(bp); diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index 2925726529f..ee9d5427fcd 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c @@ -692,6 +692,24 @@ xfs_da_join(xfs_da_state_t *state)  	return(error);  } +#ifdef	DEBUG +static void +xfs_da_blkinfo_onlychild_validate(struct xfs_da_blkinfo *blkinfo, __u16 level) +{ +	__be16	magic = blkinfo->magic; + +	if (level == 1) { +		ASSERT(magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || +		       magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); +	} else +		ASSERT(magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); +	ASSERT(!blkinfo->forw); +	ASSERT(!blkinfo->back); +} +#else	/* !DEBUG */ +#define	xfs_da_blkinfo_onlychild_validate(blkinfo, level) +#endif	/* !DEBUG */ +  /*   * We have only one entry in the root.  Copy the only remaining child of   * the old root to block 0 as the new root node. @@ -700,8 +718,6 @@ STATIC int  xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk)  {  	xfs_da_intnode_t *oldroot; -	/* REFERENCED */ -	xfs_da_blkinfo_t *blkinfo;  	xfs_da_args_t *args;  	xfs_dablk_t child;  	xfs_dabuf_t *bp; @@ -732,15 +748,9 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk)  	if (error)  		return(error);  	ASSERT(bp != NULL); -	blkinfo = bp->data; -	if (be16_to_cpu(oldroot->hdr.level) == 1) { -		ASSERT(blkinfo->magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || -		       blkinfo->magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); -	} else { -		ASSERT(blkinfo->magic == cpu_to_be16(XFS_DA_NODE_MAGIC)); -	} -	ASSERT(!blkinfo->forw); -	ASSERT(!blkinfo->back); +	xfs_da_blkinfo_onlychild_validate(bp->data, +					be16_to_cpu(oldroot->hdr.level)); +  	memcpy(root_blk->bp->data, bp->data, state->blocksize);  	xfs_da_log_buf(args->trans, root_blk->bp, 0, state->blocksize - 1);  	error = xfs_da_shrink_inode(args, child, bp); @@ -2040,7 +2050,7 @@ xfs_da_do_buf(  		case 0:  			bp = xfs_trans_get_buf(trans, mp->m_ddev_targp,  				mappedbno, nmapped, 0); -			error = bp ? XFS_BUF_GETERROR(bp) : XFS_ERROR(EIO); +			error = bp ? bp->b_error : XFS_ERROR(EIO);  			break;  		case 1:  		case 2: @@ -2258,7 +2268,7 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps)  		dabuf->nbuf = 1;  		bp = bps[0];  		dabuf->bbcount = (short)BTOBB(XFS_BUF_COUNT(bp)); -		dabuf->data = XFS_BUF_PTR(bp); +		dabuf->data = bp->b_addr;  		dabuf->bps[0] = bp;  	} else {  		dabuf->nbuf = nbuf; @@ -2269,7 +2279,7 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps)  		dabuf->data = kmem_alloc(BBTOB(dabuf->bbcount), KM_SLEEP);  		for (i = off = 0; i < nbuf; i++, off += XFS_BUF_COUNT(bp)) {  			bp = bps[i]; -			memcpy((char *)dabuf->data + off, XFS_BUF_PTR(bp), +			memcpy((char *)dabuf->data + off, bp->b_addr,  				XFS_BUF_COUNT(bp));  		}  	} @@ -2292,8 +2302,8 @@ xfs_da_buf_clean(xfs_dabuf_t *dabuf)  		for (i = off = 0; i < dabuf->nbuf;  				i++, off += XFS_BUF_COUNT(bp)) {  			bp = dabuf->bps[i]; -			memcpy(XFS_BUF_PTR(bp), (char *)dabuf->data + off, -				XFS_BUF_COUNT(bp)); +			memcpy(bp->b_addr, dabuf->data + off, +						XFS_BUF_COUNT(bp));  		}  	}  } @@ -2330,7 +2340,7 @@ xfs_da_log_buf(xfs_trans_t *tp, xfs_dabuf_t *dabuf, uint first, uint last)  	ASSERT(dabuf->nbuf && dabuf->data && dabuf->bbcount && dabuf->bps[0]);  	if (dabuf->nbuf == 1) { -		ASSERT(dabuf->data == (void *)XFS_BUF_PTR(dabuf->bps[0])); +		ASSERT(dabuf->data == dabuf->bps[0]->b_addr);  		xfs_trans_log_buf(tp, dabuf->bps[0], first, last);  		return;  	} diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h index dffba9ba0db..a3721633abc 100644 --- a/fs/xfs/xfs_dinode.h +++ b/fs/xfs/xfs_dinode.h @@ -148,7 +148,7 @@ typedef enum xfs_dinode_fmt {  		be32_to_cpu((dip)->di_nextents) : \  		be16_to_cpu((dip)->di_anextents)) -#define	XFS_BUF_TO_DINODE(bp)	((xfs_dinode_t *)XFS_BUF_PTR(bp)) +#define	XFS_BUF_TO_DINODE(bp)	((xfs_dinode_t *)((bp)->b_addr))  /*   * For block and character special files the 32bit dev_t is stored at the diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index 4580ce00aeb..a2e27010c7f 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c @@ -121,7 +121,7 @@ xfs_dir_isempty(  {  	xfs_dir2_sf_hdr_t	*sfp; -	ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); +	ASSERT(S_ISDIR(dp->i_d.di_mode));  	if (dp->i_d.di_size == 0)	/* might happen during shutdown. */  		return 1;  	if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp)) @@ -179,7 +179,7 @@ xfs_dir_init(  	memset((char *)&args, 0, sizeof(args));  	args.dp = dp;  	args.trans = tp; -	ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); +	ASSERT(S_ISDIR(dp->i_d.di_mode));  	if ((error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino)))  		return error;  	return xfs_dir2_sf_create(&args, pdp->i_ino); @@ -202,7 +202,7 @@ xfs_dir_createname(  	int			rval;  	int			v;		/* type-checking value */ -	ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); +	ASSERT(S_ISDIR(dp->i_d.di_mode));  	if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum)))  		return rval;  	XFS_STATS_INC(xs_dir_create); @@ -278,7 +278,7 @@ xfs_dir_lookup(  	int		rval;  	int		v;		/* type-checking value */ -	ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); +	ASSERT(S_ISDIR(dp->i_d.di_mode));  	XFS_STATS_INC(xs_dir_lookup);  	memset(&args, 0, sizeof(xfs_da_args_t)); @@ -333,7 +333,7 @@ xfs_dir_removename(  	int		rval;  	int		v;		/* type-checking value */ -	ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); +	ASSERT(S_ISDIR(dp->i_d.di_mode));  	XFS_STATS_INC(xs_dir_remove);  	memset(&args, 0, sizeof(xfs_da_args_t)); @@ -382,7 +382,7 @@ xfs_readdir(  	if (XFS_FORCED_SHUTDOWN(dp->i_mount))  		return XFS_ERROR(EIO); -	ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); +	ASSERT(S_ISDIR(dp->i_d.di_mode));  	XFS_STATS_INC(xs_dir_getdents);  	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) @@ -414,7 +414,7 @@ xfs_dir_replace(  	int		rval;  	int		v;		/* type-checking value */ -	ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); +	ASSERT(S_ISDIR(dp->i_d.di_mode));  	if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum)))  		return rval; @@ -464,7 +464,7 @@ xfs_dir_canenter(  	if (resblks)  		return 0; -	ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); +	ASSERT(S_ISDIR(dp->i_d.di_mode));  	memset(&args, 0, sizeof(xfs_da_args_t));  	args.name = name->name; diff --git a/fs/xfs/linux-2.6/xfs_discard.c b/fs/xfs/xfs_discard.c index 244e797dae3..244e797dae3 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 344879aea64..344879aea64 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 837f31158d4..db62959bed1 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c @@ -318,10 +318,9 @@ xfs_qm_init_dquot_blk(  	int		curid, i;  	ASSERT(tp); -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(xfs_buf_islocked(bp)); -	d = (xfs_dqblk_t *)XFS_BUF_PTR(bp); +	d = bp->b_addr;  	/*  	 * ID of the first dquot in the block - id's are zero based. @@ -403,7 +402,7 @@ xfs_qm_dqalloc(  			       dqp->q_blkno,  			       mp->m_quotainfo->qi_dqchunklen,  			       0); -	if (!bp || (error = XFS_BUF_GETERROR(bp))) +	if (!bp || (error = xfs_buf_geterror(bp)))  		goto error1;  	/*  	 * Make a chunk of dquots out of this buffer and log @@ -534,13 +533,12 @@ xfs_qm_dqtobp(  			return XFS_ERROR(error);  	} -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(xfs_buf_islocked(bp));  	/*  	 * calculate the location of the dquot inside the buffer.  	 */ -	ddq = (struct xfs_disk_dquot *)(XFS_BUF_PTR(bp) + dqp->q_bufoffset); +	ddq = bp->b_addr + dqp->q_bufoffset;  	/*  	 * A simple sanity check in case we got a corrupted dquot... @@ -553,7 +551,6 @@ xfs_qm_dqtobp(  			xfs_trans_brelse(tp, bp);  			return XFS_ERROR(EIO);  		} -		XFS_BUF_BUSY(bp); /* We dirtied this */  	}  	*O_bpp = bp; @@ -622,7 +619,6 @@ xfs_qm_dqread(  	 * this particular dquot was repaired. We still aren't afraid to  	 * brelse it because we have the changes incore.  	 */ -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(xfs_buf_islocked(bp));  	xfs_trans_brelse(tp, bp); @@ -1204,7 +1200,7 @@ xfs_qm_dqflush(  	/*  	 * Calculate the location of the dquot inside the buffer.  	 */ -	ddqp = (struct xfs_disk_dquot *)(XFS_BUF_PTR(bp) + dqp->q_bufoffset); +	ddqp = bp->b_addr + dqp->q_bufoffset;  	/*  	 * A simple sanity check in case we got a corrupted dquot.. @@ -1240,7 +1236,7 @@ xfs_qm_dqflush(  	 * If the buffer is pinned then push on the log so we won't  	 * get stuck waiting in the write for too long.  	 */ -	if (XFS_BUF_ISPINNED(bp)) { +	if (xfs_buf_ispinned(bp)) {  		trace_xfs_dqflush_force(dqp);  		xfs_log_force(mp, 0);  	} @@ -1447,7 +1443,7 @@ xfs_qm_dqflock_pushbuf_wait(  		goto out_lock;  	if (XFS_BUF_ISDELAYWRITE(bp)) { -		if (XFS_BUF_ISPINNED(bp)) +		if (xfs_buf_ispinned(bp))  			xfs_log_force(mp, 0);  		xfs_buf_delwri_promote(bp);  		wake_up_process(bp->b_target->bt_task); diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/xfs_dquot.h index 34b7e945dbf..34b7e945dbf 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 9e0e2fa3f2c..9e0e2fa3f2c 100644 --- a/fs/xfs/quota/xfs_dquot_item.c +++ b/fs/xfs/xfs_dquot_item.c diff --git a/fs/xfs/quota/xfs_dquot_item.h b/fs/xfs/xfs_dquot_item.h index 5acae2ada70..5acae2ada70 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 75e5d322e48..75e5d322e48 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 3272b6ae7a3..3272b6ae7a3 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 825390e1c13..7f7b42469ea 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -149,7 +149,9 @@ xfs_file_fsync(  	xfs_iflags_clear(ip, XFS_ITRUNCATED); +	xfs_ilock(ip, XFS_IOLOCK_SHARED);  	xfs_ioend_wait(ip); +	xfs_iunlock(ip, XFS_IOLOCK_SHARED);  	if (mp->m_flags & XFS_MOUNT_BARRIER) {  		/* diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c index 9124425b7f2..3ff3d9e23de 100644 --- a/fs/xfs/xfs_filestream.c +++ b/fs/xfs/xfs_filestream.c @@ -344,9 +344,9 @@ _xfs_filestream_update_ag(  	 * Either ip is a regular file and pip is a directory, or ip is a  	 * directory and pip is NULL.  	 */ -	ASSERT(ip && (((ip->i_d.di_mode & S_IFREG) && pip && -	               (pip->i_d.di_mode & S_IFDIR)) || -	              ((ip->i_d.di_mode & S_IFDIR) && !pip))); +	ASSERT(ip && ((S_ISREG(ip->i_d.di_mode) && pip && +	               S_ISDIR(pip->i_d.di_mode)) || +	              (S_ISDIR(ip->i_d.di_mode) && !pip)));  	mp = ip->i_mount;  	cache = mp->m_filestream; @@ -537,7 +537,7 @@ xfs_filestream_lookup_ag(  	xfs_agnumber_t	ag;  	int		ref; -	if (!(ip->i_d.di_mode & (S_IFREG | S_IFDIR))) { +	if (!S_ISREG(ip->i_d.di_mode) && !S_ISDIR(ip->i_d.di_mode)) {  		ASSERT(0);  		return NULLAGNUMBER;  	} @@ -579,9 +579,9 @@ xfs_filestream_associate(  	xfs_agnumber_t	ag, rotorstep, startag;  	int		err = 0; -	ASSERT(pip->i_d.di_mode & S_IFDIR); -	ASSERT(ip->i_d.di_mode & S_IFREG); -	if (!(pip->i_d.di_mode & S_IFDIR) || !(ip->i_d.di_mode & S_IFREG)) +	ASSERT(S_ISDIR(pip->i_d.di_mode)); +	ASSERT(S_ISREG(ip->i_d.di_mode)); +	if (!S_ISDIR(pip->i_d.di_mode) || !S_ISREG(ip->i_d.di_mode))  		return -EINVAL;  	mp = pip->i_mount; diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/xfs_fs_subr.c index ed88ed16811..ed88ed16811 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 76e81cff70b..76e81cff70b 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 dd5628bd8d0..9f24ec28283 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c @@ -202,8 +202,7 @@ xfs_ialloc_inode_init(  		fbuf = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,  					 mp->m_bsize * blks_per_cluster,  					 XBF_LOCK); -		ASSERT(fbuf); -		ASSERT(!XFS_BUF_GETERROR(fbuf)); +		ASSERT(!xfs_buf_geterror(fbuf));  		/*  		 * Initialize all inodes in this buffer and then log them. @@ -1486,7 +1485,7 @@ xfs_read_agi(  	if (error)  		return error; -	ASSERT(*bpp && !XFS_BUF_GETERROR(*bpp)); +	ASSERT(!xfs_buf_geterror(*bpp));  	agi = XFS_BUF_TO_AGI(*bpp);  	/* diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 3cc21ddf9f7..0239a7c7c88 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -368,7 +368,7 @@ xfs_iformat(  			/*  			 * no local regular files yet  			 */ -			if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) { +			if (unlikely(S_ISREG(be16_to_cpu(dip->di_mode)))) {  				xfs_warn(ip->i_mount,  			"corrupt inode %Lu (local format for regular file).",  					(unsigned long long) ip->i_ino); @@ -1040,7 +1040,7 @@ xfs_ialloc(  	if (pip && XFS_INHERIT_GID(pip)) {  		ip->i_d.di_gid = pip->i_d.di_gid; -		if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) { +		if ((pip->i_d.di_mode & S_ISGID) && S_ISDIR(mode)) {  			ip->i_d.di_mode |= S_ISGID;  		}  	} @@ -1097,14 +1097,14 @@ xfs_ialloc(  		if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) {  			uint	di_flags = 0; -			if ((mode & S_IFMT) == S_IFDIR) { +			if (S_ISDIR(mode)) {  				if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)  					di_flags |= XFS_DIFLAG_RTINHERIT;  				if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) {  					di_flags |= XFS_DIFLAG_EXTSZINHERIT;  					ip->i_d.di_extsize = pip->i_d.di_extsize;  				} -			} else if ((mode & S_IFMT) == S_IFREG) { +			} else if (S_ISREG(mode)) {  				if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)  					di_flags |= XFS_DIFLAG_REALTIME;  				if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { @@ -1188,7 +1188,7 @@ xfs_isize_check(  	int			nimaps;  	xfs_bmbt_irec_t		imaps[2]; -	if ((ip->i_d.di_mode & S_IFMT) != S_IFREG) +	if (!S_ISREG(ip->i_d.di_mode))  		return;  	if (XFS_IS_REALTIME_INODE(ip)) @@ -1828,7 +1828,7 @@ xfs_ifree(  	ASSERT(ip->i_d.di_nextents == 0);  	ASSERT(ip->i_d.di_anextents == 0);  	ASSERT((ip->i_d.di_size == 0 && ip->i_size == 0) || -	       ((ip->i_d.di_mode & S_IFMT) != S_IFREG)); +	       (!S_ISREG(ip->i_d.di_mode)));  	ASSERT(ip->i_d.di_nblocks == 0);  	/* @@ -2473,7 +2473,7 @@ cluster_corrupt_out:  		if (bp->b_iodone) {  			XFS_BUF_UNDONE(bp);  			XFS_BUF_STALE(bp); -			XFS_BUF_ERROR(bp,EIO); +			xfs_buf_ioerror(bp, EIO);  			xfs_buf_ioend(bp, 0);  		} else {  			XFS_BUF_STALE(bp); @@ -2585,7 +2585,7 @@ xfs_iflush(  	 * If the buffer is pinned then push on the log now so we won't  	 * get stuck waiting in the write for too long.  	 */ -	if (XFS_BUF_ISPINNED(bp)) +	if (xfs_buf_ispinned(bp))  		xfs_log_force(mp, 0);  	/* @@ -2671,7 +2671,7 @@ xfs_iflush_int(  			__func__, ip->i_ino, ip, ip->i_d.di_magic);  		goto corrupt_out;  	} -	if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) { +	if (S_ISREG(ip->i_d.di_mode)) {  		if (XFS_TEST_ERROR(  		    (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&  		    (ip->i_d.di_format != XFS_DINODE_FMT_BTREE), @@ -2681,7 +2681,7 @@ xfs_iflush_int(  				__func__, ip->i_ino, ip);  			goto corrupt_out;  		} -	} else if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { +	} else if (S_ISDIR(ip->i_d.di_mode)) {  		if (XFS_TEST_ERROR(  		    (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&  		    (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) && diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index a97644ab945..2380a4bcbec 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -263,7 +263,7 @@ typedef struct xfs_inode {  	struct inode		i_vnode;	/* embedded VFS inode */  } xfs_inode_t; -#define XFS_ISIZE(ip)	(((ip)->i_d.di_mode & S_IFMT) == S_IFREG) ? \ +#define XFS_ISIZE(ip)	S_ISREG((ip)->i_d.di_mode) ? \  				(ip)->i_size : (ip)->i_d.di_size;  /* Convert from vfs inode to xfs inode */ diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index acca2c5ca3f..f7ce7debe14 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -265,7 +265,7 @@ xfs_open_by_handle(  		return PTR_ERR(filp);  	} -	if (inode->i_mode & S_IFREG) { +	if (S_ISREG(inode->i_mode)) {  		filp->f_flags |= O_NOATIME;  		filp->f_mode |= FMODE_NOCMTIME;  	} @@ -850,14 +850,14 @@ xfs_set_diflags(  		di_flags |= XFS_DIFLAG_NODEFRAG;  	if (xflags & XFS_XFLAG_FILESTREAM)  		di_flags |= XFS_DIFLAG_FILESTREAM; -	if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { +	if (S_ISDIR(ip->i_d.di_mode)) {  		if (xflags & XFS_XFLAG_RTINHERIT)  			di_flags |= XFS_DIFLAG_RTINHERIT;  		if (xflags & XFS_XFLAG_NOSYMLINKS)  			di_flags |= XFS_DIFLAG_NOSYMLINKS;  		if (xflags & XFS_XFLAG_EXTSZINHERIT)  			di_flags |= XFS_DIFLAG_EXTSZINHERIT; -	} else if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) { +	} else if (S_ISREG(ip->i_d.di_mode)) {  		if (xflags & XFS_XFLAG_REALTIME)  			di_flags |= XFS_DIFLAG_REALTIME;  		if (xflags & XFS_XFLAG_EXTSIZE) diff --git a/fs/xfs/linux-2.6/xfs_ioctl.h b/fs/xfs/xfs_ioctl.h index d56173b34a2..d56173b34a2 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 54e623bfbb8..54e623bfbb8 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 80f4060e897..80f4060e897 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 6544c3236bc..673704fab74 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -70,9 +70,8 @@ xfs_synchronize_times(  }  /* - * If the linux inode is valid, mark it dirty. - * Used when committing a dirty inode into a transaction so that - * the inode will get written back by the linux code + * If the linux inode is valid, mark it dirty, else mark the dirty state + * in the XFS inode to make sure we pick it up when reclaiming the inode.   */  void  xfs_mark_inode_dirty_sync( @@ -82,6 +81,10 @@ xfs_mark_inode_dirty_sync(  	if (!(inode->i_state & (I_WILL_FREE|I_FREEING)))  		mark_inode_dirty_sync(inode); +	else { +		barrier(); +		ip->i_update_core = 1; +	}  }  void @@ -92,6 +95,11 @@ xfs_mark_inode_dirty(  	if (!(inode->i_state & (I_WILL_FREE|I_FREEING)))  		mark_inode_dirty(inode); +	else { +		barrier(); +		ip->i_update_core = 1; +	} +  }  /* @@ -1194,9 +1202,14 @@ xfs_setup_inode(  		break;  	} -	/* if there is no attribute fork no ACL can exist on this inode */ -	if (!XFS_IFORK_Q(ip)) +	/* +	 * If there is no attribute fork no ACL can exist on this inode, +	 * and it can't have any file capabilities attached to it either. +	 */ +	if (!XFS_IFORK_Q(ip)) { +		inode_has_no_xattr(inode);  		cache_no_acl(inode); +	}  	xfs_iflags_clear(ip, XFS_INEW);  	barrier(); diff --git a/fs/xfs/linux-2.6/xfs_iops.h b/fs/xfs/xfs_iops.h index ef41c92ce66..ef41c92ce66 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 d42f814e4d3..1e8a45e74c3 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/xfs_linux.h @@ -32,13 +32,12 @@  # define XFS_BIG_INUMS	0  #endif -#include <xfs_types.h> +#include "xfs_types.h" -#include <kmem.h> -#include <mrlock.h> -#include <time.h> - -#include <support/uuid.h> +#include "kmem.h" +#include "mrlock.h" +#include "time.h" +#include "uuid.h"  #include <linux/semaphore.h>  #include <linux/mm.h> @@ -78,14 +77,14 @@  #include <asm/byteorder.h>  #include <asm/unaligned.h> -#include <xfs_vnode.h> -#include <xfs_stats.h> -#include <xfs_sysctl.h> -#include <xfs_iops.h> -#include <xfs_aops.h> -#include <xfs_super.h> -#include <xfs_buf.h> -#include <xfs_message.h> +#include "xfs_vnode.h" +#include "xfs_stats.h" +#include "xfs_sysctl.h" +#include "xfs_iops.h" +#include "xfs_aops.h" +#include "xfs_super.h" +#include "xfs_buf.h" +#include "xfs_message.h"  #ifdef __BIG_ENDIAN  #define XFS_NATIVE_HOST 1 diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 06ff8437ed8..3a8d4f66d70 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -878,7 +878,7 @@ xlog_iodone(xfs_buf_t *bp)  	/*  	 * Race to shutdown the filesystem if we see an error.  	 */ -	if (XFS_TEST_ERROR((XFS_BUF_GETERROR(bp)), l->l_mp, +	if (XFS_TEST_ERROR((xfs_buf_geterror(bp)), l->l_mp,  			XFS_ERRTAG_IODONE_IOERR, XFS_RANDOM_IODONE_IOERR)) {  		xfs_ioerror_alert("xlog_iodone", l->l_mp, bp, XFS_BUF_ADDR(bp));  		XFS_BUF_STALE(bp); @@ -1051,7 +1051,6 @@ xlog_alloc_log(xfs_mount_t	*mp,  	if (!bp)  		goto out_free_log;  	bp->b_iodone = xlog_iodone; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(xfs_buf_islocked(bp));  	log->l_xbuf = bp; @@ -1108,7 +1107,6 @@ xlog_alloc_log(xfs_mount_t	*mp,  		iclog->ic_callback_tail = &(iclog->ic_callback);  		iclog->ic_datap = (char *)iclog->ic_data + log->l_iclog_hsize; -		ASSERT(XFS_BUF_ISBUSY(iclog->ic_bp));  		ASSERT(xfs_buf_islocked(iclog->ic_bp));  		init_waitqueue_head(&iclog->ic_force_wait);  		init_waitqueue_head(&iclog->ic_write_wait); @@ -1248,7 +1246,7 @@ xlog_bdstrat(  	struct xlog_in_core	*iclog = bp->b_fspriv;  	if (iclog->ic_state & XLOG_STATE_IOERROR) { -		XFS_BUF_ERROR(bp, EIO); +		xfs_buf_ioerror(bp, EIO);  		XFS_BUF_STALE(bp);  		xfs_buf_ioend(bp, 0);  		/* @@ -1355,7 +1353,6 @@ xlog_sync(xlog_t		*log,  	XFS_BUF_SET_COUNT(bp, count);  	bp->b_fspriv = iclog;  	XFS_BUF_ZEROFLAGS(bp); -	XFS_BUF_BUSY(bp);  	XFS_BUF_ASYNC(bp);  	bp->b_flags |= XBF_SYNCIO; @@ -1398,16 +1395,15 @@ xlog_sync(xlog_t		*log,  	if (split) {  		bp = iclog->ic_log->l_xbuf;  		XFS_BUF_SET_ADDR(bp, 0);	     /* logical 0 */ -		XFS_BUF_SET_PTR(bp, (xfs_caddr_t)((__psint_t)&(iclog->ic_header)+ -					    (__psint_t)count), split); +		xfs_buf_associate_memory(bp, +				(char *)&iclog->ic_header + count, split);  		bp->b_fspriv = iclog;  		XFS_BUF_ZEROFLAGS(bp); -		XFS_BUF_BUSY(bp);  		XFS_BUF_ASYNC(bp);  		bp->b_flags |= XBF_SYNCIO;  		if (log->l_mp->m_flags & XFS_MOUNT_BARRIER)  			bp->b_flags |= XBF_FUA; -		dptr = XFS_BUF_PTR(bp); +		dptr = bp->b_addr;  		/*  		 * Bump the cycle numbers at the start of each block  		 * 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 8fe4206de05..a199dbcee7d 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -147,7 +147,7 @@ xlog_align(  	xfs_daddr_t	offset = blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1);  	ASSERT(BBTOB(offset + nbblks) <= XFS_BUF_SIZE(bp)); -	return XFS_BUF_PTR(bp) + BBTOB(offset); +	return bp->b_addr + BBTOB(offset);  } @@ -178,9 +178,7 @@ xlog_bread_noalign(  	XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no);  	XFS_BUF_READ(bp); -	XFS_BUF_BUSY(bp);  	XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); -	XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp);  	xfsbdstrat(log->l_mp, bp);  	error = xfs_buf_iowait(bp); @@ -220,18 +218,18 @@ xlog_bread_offset(  	xfs_buf_t	*bp,  	xfs_caddr_t	offset)  { -	xfs_caddr_t	orig_offset = XFS_BUF_PTR(bp); +	xfs_caddr_t	orig_offset = bp->b_addr;  	int		orig_len = bp->b_buffer_length;  	int		error, error2; -	error = XFS_BUF_SET_PTR(bp, offset, BBTOB(nbblks)); +	error = xfs_buf_associate_memory(bp, offset, BBTOB(nbblks));  	if (error)  		return error;  	error = xlog_bread_noalign(log, blk_no, nbblks, bp);  	/* must reset buffer pointer even on error */ -	error2 = XFS_BUF_SET_PTR(bp, orig_offset, orig_len); +	error2 = xfs_buf_associate_memory(bp, orig_offset, orig_len);  	if (error)  		return error;  	return error2; @@ -266,11 +264,9 @@ xlog_bwrite(  	XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no);  	XFS_BUF_ZEROFLAGS(bp); -	XFS_BUF_BUSY(bp); -	XFS_BUF_HOLD(bp); +	xfs_buf_hold(bp);  	xfs_buf_lock(bp);  	XFS_BUF_SET_COUNT(bp, BBTOB(nbblks)); -	XFS_BUF_SET_TARGET(bp, log->l_mp->m_logdev_targp);  	if ((error = xfs_bwrite(log->l_mp, bp)))  		xfs_ioerror_alert("xlog_bwrite", log->l_mp, @@ -360,7 +356,7 @@ STATIC void  xlog_recover_iodone(  	struct xfs_buf	*bp)  { -	if (XFS_BUF_GETERROR(bp)) { +	if (bp->b_error) {  		/*  		 * We're not going to bother about retrying  		 * this during recovery. One strike! @@ -1262,7 +1258,7 @@ xlog_write_log_records(  		 */  		ealign = round_down(end_block, sectbb);  		if (j == 0 && (start_block + endcount > ealign)) { -			offset = XFS_BUF_PTR(bp) + BBTOB(ealign - start_block); +			offset = bp->b_addr + BBTOB(ealign - start_block);  			error = xlog_bread_offset(log, ealign, sectbb,  							bp, offset);  			if (error) @@ -2135,15 +2131,16 @@ xlog_recover_buffer_pass2(  	bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len,  			  buf_flags); -	if (XFS_BUF_ISERROR(bp)) { +	if (!bp) +		return XFS_ERROR(ENOMEM); +	error = bp->b_error; +	if (error) {  		xfs_ioerror_alert("xlog_recover_do..(read#1)", mp,  				  bp, buf_f->blf_blkno); -		error = XFS_BUF_GETERROR(bp);  		xfs_buf_relse(bp);  		return error;  	} -	error = 0;  	if (buf_f->blf_flags & XFS_BLF_INODE_BUF) {  		error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f);  	} else if (buf_f->blf_flags & @@ -2227,14 +2224,17 @@ xlog_recover_inode_pass2(  	bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len,  			  XBF_LOCK); -	if (XFS_BUF_ISERROR(bp)) { +	if (!bp) { +		error = ENOMEM; +		goto error; +	} +	error = bp->b_error; +	if (error) {  		xfs_ioerror_alert("xlog_recover_do..(read#2)", mp,  				  bp, in_f->ilf_blkno); -		error = XFS_BUF_GETERROR(bp);  		xfs_buf_relse(bp);  		goto error;  	} -	error = 0;  	ASSERT(in_f->ilf_fields & XFS_ILOG_CORE);  	dip = (xfs_dinode_t *)xfs_buf_offset(bp, in_f->ilf_boffset); @@ -2283,7 +2283,7 @@ xlog_recover_inode_pass2(  	/* Take the opportunity to reset the flush iteration count */  	dicp->di_flushiter = 0; -	if (unlikely((dicp->di_mode & S_IFMT) == S_IFREG)) { +	if (unlikely(S_ISREG(dicp->di_mode))) {  		if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) &&  		    (dicp->di_format != XFS_DINODE_FMT_BTREE)) {  			XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(3)", @@ -2296,7 +2296,7 @@ xlog_recover_inode_pass2(  			error = EFSCORRUPTED;  			goto error;  		} -	} else if (unlikely((dicp->di_mode & S_IFMT) == S_IFDIR)) { +	} else if (unlikely(S_ISDIR(dicp->di_mode))) {  		if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) &&  		    (dicp->di_format != XFS_DINODE_FMT_BTREE) &&  		    (dicp->di_format != XFS_DINODE_FMT_LOCAL)) { @@ -3437,7 +3437,7 @@ xlog_do_recovery_pass(  			/*  			 * Check for header wrapping around physical end-of-log  			 */ -			offset = XFS_BUF_PTR(hbp); +			offset = hbp->b_addr;  			split_hblks = 0;  			wrapped_hblks = 0;  			if (blk_no + hblks <= log->l_logBBsize) { @@ -3497,7 +3497,7 @@ xlog_do_recovery_pass(  			} else {  				/* This log record is split across the  				 * physical end of log */ -				offset = XFS_BUF_PTR(dbp); +				offset = dbp->b_addr;  				split_bblks = 0;  				if (blk_no != log->l_logBBsize) {  					/* some data is before the physical diff --git a/fs/xfs/linux-2.6/xfs_message.c b/fs/xfs/xfs_message.c index bd672def95a..bd672def95a 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 7fb7ea00767..7fb7ea00767 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 7f25245da28..0081657ad98 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -1331,7 +1331,7 @@ xfs_mountfs(  	ASSERT(rip != NULL); -	if (unlikely((rip->i_d.di_mode & S_IFMT) != S_IFDIR)) { +	if (unlikely(!S_ISDIR(rip->i_d.di_mode))) {  		xfs_warn(mp, "corrupted root inode %llu: not a directory",  			(unsigned long long)rip->i_ino);  		xfs_iunlock(rip, XFS_ILOCK_EXCL); @@ -1615,7 +1615,7 @@ xfs_unmountfs_writesb(xfs_mount_t *mp)  		XFS_BUF_UNDELAYWRITE(sbp);  		XFS_BUF_WRITE(sbp);  		XFS_BUF_UNASYNC(sbp); -		ASSERT(XFS_BUF_TARGET(sbp) == mp->m_ddev_targp); +		ASSERT(sbp->b_target == mp->m_ddev_targp);  		xfsbdstrat(mp, sbp);  		error = xfs_buf_iowait(sbp);  		if (error) @@ -1938,7 +1938,7 @@ xfs_getsb(  		xfs_buf_lock(bp);  	} -	XFS_BUF_HOLD(bp); +	xfs_buf_hold(bp);  	ASSERT(XFS_BUF_ISDONE(bp));  	return bp;  } diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/xfs_qm.c index 46e54ad9a2d..9a0aa76facd 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -1240,7 +1240,7 @@ xfs_qm_reset_dqcounts(  	do_div(j, sizeof(xfs_dqblk_t));  	ASSERT(mp->m_quotainfo->qi_dqperchunk == j);  #endif -	ddq = (xfs_disk_dquot_t *)XFS_BUF_PTR(bp); +	ddq = bp->b_addr;  	for (j = 0; j < mp->m_quotainfo->qi_dqperchunk; j++) {  		/*  		 * 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 43b9abe1052..43b9abe1052 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 a0a829addca..a0a829addca 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 8671a0b3264..8671a0b3264 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 5b964fc0dc0..5b964fc0dc0 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 609246f42e6..609246f42e6 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 94a3d927d71..94a3d927d71 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 29b9d642e93..7e76f537abb 100644 --- a/fs/xfs/linux-2.6/xfs_quotaops.c +++ b/fs/xfs/xfs_quotaops.c @@ -25,7 +25,7 @@  #include "xfs_trans.h"  #include "xfs_bmap_btree.h"  #include "xfs_inode.h" -#include "quota/xfs_qm.h" +#include "xfs_qm.h"  #include <linux/quota.h> diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index 77a59891734..df78c297d1a 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c @@ -116,7 +116,7 @@ xfs_rename(  	trace_xfs_rename(src_dp, target_dp, src_name, target_name);  	new_parent = (src_dp != target_dp); -	src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR); +	src_is_directory = S_ISDIR(src_ip->i_d.di_mode);  	if (src_is_directory) {  		/* @@ -226,7 +226,7 @@ xfs_rename(  		 * target and source are directories and that target can be  		 * destroyed, or that neither is a directory.  		 */ -		if ((target_ip->i_d.di_mode & S_IFMT) == S_IFDIR) { +		if (S_ISDIR(target_ip->i_d.di_mode)) {  			/*  			 * Make sure target dir is empty.  			 */ diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 8f76fdff4f4..35561a511b5 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -168,7 +168,7 @@ error_cancel:  				xfs_trans_cancel(tp, cancelflags);  				goto error;  			} -			memset(XFS_BUF_PTR(bp), 0, mp->m_sb.sb_blocksize); +			memset(bp->b_addr, 0, mp->m_sb.sb_blocksize);  			xfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1);  			/*  			 * Commit the transaction. @@ -883,7 +883,7 @@ xfs_rtbuf_get(  	if (error) {  		return error;  	} -	ASSERT(bp && !XFS_BUF_GETERROR(bp)); +	ASSERT(!xfs_buf_geterror(bp));  	*bpp = bp;  	return 0;  } @@ -943,7 +943,7 @@ xfs_rtcheck_range(  	if (error) {  		return error;  	} -	bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +	bufp = bp->b_addr;  	/*  	 * Compute the starting word's address, and starting bit.  	 */ @@ -994,7 +994,7 @@ xfs_rtcheck_range(  			if (error) {  				return error;  			} -			b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +			b = bufp = bp->b_addr;  			word = 0;  		} else {  			/* @@ -1040,7 +1040,7 @@ xfs_rtcheck_range(  			if (error) {  				return error;  			} -			b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +			b = bufp = bp->b_addr;  			word = 0;  		} else {  			/* @@ -1158,7 +1158,7 @@ xfs_rtfind_back(  	if (error) {  		return error;  	} -	bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +	bufp = bp->b_addr;  	/*  	 * Get the first word's index & point to it.  	 */ @@ -1210,7 +1210,7 @@ xfs_rtfind_back(  			if (error) {  				return error;  			} -			bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +			bufp = bp->b_addr;  			word = XFS_BLOCKWMASK(mp);  			b = &bufp[word];  		} else { @@ -1256,7 +1256,7 @@ xfs_rtfind_back(  			if (error) {  				return error;  			} -			bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +			bufp = bp->b_addr;  			word = XFS_BLOCKWMASK(mp);  			b = &bufp[word];  		} else { @@ -1333,7 +1333,7 @@ xfs_rtfind_forw(  	if (error) {  		return error;  	} -	bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +	bufp = bp->b_addr;  	/*  	 * Get the first word's index & point to it.  	 */ @@ -1384,7 +1384,7 @@ xfs_rtfind_forw(  			if (error) {  				return error;  			} -			b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +			b = bufp = bp->b_addr;  			word = 0;  		} else {  			/* @@ -1429,7 +1429,7 @@ xfs_rtfind_forw(  			if (error) {  				return error;  			} -			b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +			b = bufp = bp->b_addr;  			word = 0;  		} else {  			/* @@ -1649,7 +1649,7 @@ xfs_rtmodify_range(  	if (error) {  		return error;  	} -	bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +	bufp = bp->b_addr;  	/*  	 * Compute the starting word's address, and starting bit.  	 */ @@ -1694,7 +1694,7 @@ xfs_rtmodify_range(  			if (error) {  				return error;  			} -			first = b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +			first = b = bufp = bp->b_addr;  			word = 0;  		} else {  			/* @@ -1734,7 +1734,7 @@ xfs_rtmodify_range(  			if (error) {  				return error;  			} -			first = b = bufp = (xfs_rtword_t *)XFS_BUF_PTR(bp); +			first = b = bufp = bp->b_addr;  			word = 0;  		} else {  			/* @@ -1832,8 +1832,8 @@ xfs_rtmodify_summary(  	 */  	sp = XFS_SUMPTR(mp, bp, so);  	*sp += delta; -	xfs_trans_log_buf(tp, bp, (uint)((char *)sp - (char *)XFS_BUF_PTR(bp)), -		(uint)((char *)sp - (char *)XFS_BUF_PTR(bp) + sizeof(*sp) - 1)); +	xfs_trans_log_buf(tp, bp, (uint)((char *)sp - (char *)bp->b_addr), +		(uint)((char *)sp - (char *)bp->b_addr + sizeof(*sp) - 1));  	return 0;  } diff --git a/fs/xfs/xfs_rtalloc.h b/fs/xfs/xfs_rtalloc.h index 09e1f4f35e9..f7f3a359c1c 100644 --- a/fs/xfs/xfs_rtalloc.h +++ b/fs/xfs/xfs_rtalloc.h @@ -47,7 +47,7 @@ struct xfs_trans;  #define	XFS_SUMOFFSTOBLOCK(mp,s)	\  	(((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog)  #define	XFS_SUMPTR(mp,bp,so)	\ -	((xfs_suminfo_t *)((char *)XFS_BUF_PTR(bp) + \ +	((xfs_suminfo_t *)((bp)->b_addr + \  		(((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp))))  #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 d6d6fdfe942..c96a8a05ac0 100644 --- a/fs/xfs/xfs_rw.c +++ b/fs/xfs/xfs_rw.c @@ -104,9 +104,9 @@ xfs_ioerror_alert(  	xfs_alert(mp,  		 "I/O error occurred: meta-data dev %s block 0x%llx"  		 "       (\"%s\") error %d buf count %zd", -		XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)), +		xfs_buf_target_name(bp->b_target),  		(__uint64_t)blkno, func, -		XFS_BUF_GETERROR(bp), XFS_BUF_COUNT(bp)); +		bp->b_error, XFS_BUF_COUNT(bp));  }  /* @@ -137,8 +137,8 @@ xfs_read_buf(  	bp = xfs_buf_read(target, blkno, len, flags);  	if (!bp)  		return XFS_ERROR(EIO); -	error = XFS_BUF_GETERROR(bp); -	if (bp && !error && !XFS_FORCED_SHUTDOWN(mp)) { +	error = bp->b_error; +	if (!error && !XFS_FORCED_SHUTDOWN(mp)) {  		*bpp = bp;  	} else {  		*bpp = NULL; diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h index 1eb2ba58681..cb6ae715814 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)  #define XFS_SB_DADDR		((xfs_daddr_t)0) /* daddr in filesystem/ag */  #define	XFS_SB_BLOCK(mp)	XFS_HDR_BLOCK(mp, XFS_SB_DADDR) -#define XFS_BUF_TO_SBP(bp)	((xfs_dsb_t *)XFS_BUF_PTR(bp)) +#define XFS_BUF_TO_SBP(bp)	((xfs_dsb_t *)((bp)->b_addr))  #define	XFS_HDR_BLOCK(mp,d)	((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))  #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 76fdc586193..76fdc586193 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 736854b1ca1..736854b1ca1 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 9a72dda58bd..2366c54cc4f 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -356,6 +356,8 @@ xfs_parseargs(  			mp->m_flags |= XFS_MOUNT_DELAYLOG;  		} else if (!strcmp(this_char, MNTOPT_NODELAYLOG)) {  			mp->m_flags &= ~XFS_MOUNT_DELAYLOG; +			xfs_warn(mp, +	"nodelaylog is deprecated and will be removed in Linux 3.3");  		} else if (!strcmp(this_char, MNTOPT_DISCARD)) {  			mp->m_flags |= XFS_MOUNT_DISCARD;  		} else if (!strcmp(this_char, MNTOPT_NODISCARD)) { @@ -877,33 +879,17 @@ xfs_log_inode(  	struct xfs_trans	*tp;  	int			error; -	xfs_iunlock(ip, XFS_ILOCK_SHARED);  	tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS);  	error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0); -  	if (error) {  		xfs_trans_cancel(tp, 0); -		/* we need to return with the lock hold shared */ -		xfs_ilock(ip, XFS_ILOCK_SHARED);  		return error;  	}  	xfs_ilock(ip, XFS_ILOCK_EXCL); - -	/* -	 * Note - it's possible that we might have pushed ourselves out of the -	 * way during trans_reserve which would flush the inode.  But there's -	 * no guarantee that the inode buffer has actually gone out yet (it's -	 * delwri).  Plus the buffer could be pinned anyway if it's part of -	 * an inode in another recent transaction.  So we play it safe and -	 * fire off the transaction anyway. -	 */ -	xfs_trans_ijoin(tp, ip); +	xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);  	xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); -	error = xfs_trans_commit(tp, 0); -	xfs_ilock_demote(ip, XFS_ILOCK_EXCL); - -	return error; +	return xfs_trans_commit(tp, 0);  }  STATIC int @@ -918,7 +904,9 @@ xfs_fs_write_inode(  	trace_xfs_write_inode(ip);  	if (XFS_FORCED_SHUTDOWN(mp)) -		return XFS_ERROR(EIO); +		return -XFS_ERROR(EIO); +	if (!ip->i_update_core) +		return 0;  	if (wbc->sync_mode == WB_SYNC_ALL) {  		/* @@ -929,12 +917,10 @@ xfs_fs_write_inode(  		 * of synchronous log foces dramatically.  		 */  		xfs_ioend_wait(ip); -		xfs_ilock(ip, XFS_ILOCK_SHARED); -		if (ip->i_update_core) { -			error = xfs_log_inode(ip); -			if (error) -				goto out_unlock; -		} +		error = xfs_log_inode(ip); +		if (error) +			goto out; +		return 0;  	} else {  		/*  		 * We make this non-blocking if the inode is contended, return diff --git a/fs/xfs/linux-2.6/xfs_super.h b/fs/xfs/xfs_super.h index 50a3266c999..50a3266c999 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 e4c938afb91..4604f90f86a 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/xfs_sync.c @@ -332,7 +332,7 @@ xfs_sync_fsdata(  	 * between there and here.  	 */  	bp = xfs_getsb(mp, 0); -	if (XFS_BUF_ISPINNED(bp)) +	if (xfs_buf_ispinned(bp))  		xfs_log_force(mp, 0);  	return xfs_bwrite(mp, bp); diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/xfs_sync.h index 941202e7ac6..941202e7ac6 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 ee2d2adaa43..ee2d2adaa43 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 b9937d450f8..b9937d450f8 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 88d25d4aa56..9010ce885e6 100644 --- a/fs/xfs/linux-2.6/xfs_trace.c +++ b/fs/xfs/xfs_trace.c @@ -43,8 +43,8 @@  #include "xfs_quota.h"  #include "xfs_iomap.h"  #include "xfs_aops.h" -#include "quota/xfs_dquot_item.h" -#include "quota/xfs_dquot.h" +#include "xfs_dquot_item.h" +#include "xfs_dquot.h"  #include "xfs_log_recover.h"  #include "xfs_inode_item.h" diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/xfs_trace.h index 690fc7a7bd7..690fc7a7bd7 100644 --- a/fs/xfs/linux-2.6/xfs_trace.h +++ b/fs/xfs/xfs_trace.h diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index 43233e92f0f..c15aa29fa16 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c @@ -299,7 +299,7 @@ xfs_trans_ail_cursor_last(   * Splice the log item list into the AIL at the given LSN. We splice to the   * tail of the given LSN to maintain insert order for push traversals. The   * cursor is optional, allowing repeated updates to the same LSN to avoid - * repeated traversals. + * repeated traversals.  This should not be called with an empty list.   */  static void  xfs_ail_splice( @@ -308,50 +308,39 @@ xfs_ail_splice(  	struct list_head	*list,  	xfs_lsn_t		lsn)  { -	struct xfs_log_item	*lip = cur ? cur->item : NULL; -	struct xfs_log_item	*next_lip; +	struct xfs_log_item	*lip; + +	ASSERT(!list_empty(list));  	/* -	 * Get a new cursor if we don't have a placeholder or the existing one -	 * has been invalidated. +	 * Use the cursor to determine the insertion point if one is +	 * provided.  If not, or if the one we got is not valid, +	 * find the place in the AIL where the items belong.  	 */ -	if (!lip || (__psint_t)lip & 1) { +	lip = cur ? cur->item : NULL; +	if (!lip || (__psint_t) lip & 1)  		lip = __xfs_trans_ail_cursor_last(ailp, lsn); -		if (!lip) { -			/* The list is empty, so just splice and return.  */ -			if (cur) -				cur->item = NULL; -			list_splice(list, &ailp->xa_ail); -			return; -		} -	} +	/* +	 * If a cursor is provided, we know we're processing the AIL +	 * in lsn order, and future items to be spliced in will +	 * follow the last one being inserted now.  Update the +	 * cursor to point to that last item, now while we have a +	 * reliable pointer to it. +	 */ +	if (cur) +		cur->item = list_entry(list->prev, struct xfs_log_item, li_ail);  	/* -	 * Our cursor points to the item we want to insert _after_, so we have -	 * to update the cursor to point to the end of the list we are splicing -	 * in so that it points to the correct location for the next splice. -	 * i.e. before the splice -	 * -	 *  lsn -> lsn -> lsn + x -> lsn + x ... -	 *          ^ -	 *          | cursor points here -	 * -	 * After the splice we have: -	 * -	 *  lsn -> lsn -> lsn -> lsn -> .... -> lsn -> lsn + x -> lsn + x ... -	 *          ^                            ^ -	 *          | cursor points here         | needs to move here -	 * -	 * So we set the cursor to the last item in the list to be spliced -	 * before we execute the splice, resulting in the cursor pointing to -	 * the correct item after the splice occurs. +	 * Finally perform the splice.  Unless the AIL was empty, +	 * lip points to the item in the AIL _after_ which the new +	 * items should go.  If lip is null the AIL was empty, so +	 * the new items go at the head of the AIL.  	 */ -	if (cur) { -		next_lip = list_entry(list->prev, struct xfs_log_item, li_ail); -		cur->item = next_lip; -	} -	list_splice(list, &lip->li_ail); +	if (lip) +		list_splice(list, &lip->li_ail); +	else +		list_splice(list, &ailp->xa_ail);  }  /* @@ -682,6 +671,7 @@ xfs_trans_ail_update_bulk(  	int			i;  	LIST_HEAD(tmp); +	ASSERT(nr_items > 0);		/* Not required, but true. */  	mlip = xfs_ail_min(ailp);  	for (i = 0; i < nr_items; i++) { @@ -701,7 +691,8 @@ xfs_trans_ail_update_bulk(  		list_add(&lip->li_ail, &tmp);  	} -	xfs_ail_splice(ailp, cur, &tmp, lsn); +	if (!list_empty(&tmp)) +		xfs_ail_splice(ailp, cur, &tmp, lsn);  	if (!mlip_changed) {  		spin_unlock(&ailp->xa_lock); diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c index 15584fc3ed7..137e2b9e294 100644 --- a/fs/xfs/xfs_trans_buf.c +++ b/fs/xfs/xfs_trans_buf.c @@ -54,7 +54,7 @@ xfs_trans_buf_item_match(  	list_for_each_entry(lidp, &tp->t_items, lid_trans) {  		blip = (struct xfs_buf_log_item *)lidp->lid_item;  		if (blip->bli_item.li_type == XFS_LI_BUF && -		    XFS_BUF_TARGET(blip->bli_buf) == target && +		    blip->bli_buf->b_target == target &&  		    XFS_BUF_ADDR(blip->bli_buf) == blkno &&  		    XFS_BUF_COUNT(blip->bli_buf) == len)  			return blip->bli_buf; @@ -80,7 +80,6 @@ _xfs_trans_bjoin(  {  	struct xfs_buf_log_item	*bip; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(bp->b_transp == NULL);  	/* @@ -194,7 +193,7 @@ xfs_trans_get_buf(xfs_trans_t	*tp,  		return NULL;  	} -	ASSERT(!XFS_BUF_GETERROR(bp)); +	ASSERT(!bp->b_error);  	_xfs_trans_bjoin(tp, bp, 1);  	trace_xfs_trans_get_buf(bp->b_fspriv); @@ -293,10 +292,10 @@ xfs_trans_read_buf(  			return (flags & XBF_TRYLOCK) ?  					EAGAIN : XFS_ERROR(ENOMEM); -		if (XFS_BUF_GETERROR(bp) != 0) { +		if (bp->b_error) { +			error = bp->b_error;  			xfs_ioerror_alert("xfs_trans_read_buf", mp,  					  bp, blkno); -			error = XFS_BUF_GETERROR(bp);  			xfs_buf_relse(bp);  			return error;  		} @@ -330,7 +329,7 @@ xfs_trans_read_buf(  		ASSERT(xfs_buf_islocked(bp));  		ASSERT(bp->b_transp == tp);  		ASSERT(bp->b_fspriv != NULL); -		ASSERT((XFS_BUF_ISERROR(bp)) == 0); +		ASSERT(!bp->b_error);  		if (!(XFS_BUF_ISDONE(bp))) {  			trace_xfs_trans_read_buf_io(bp, _RET_IP_);  			ASSERT(!XFS_BUF_ISASYNC(bp)); @@ -386,10 +385,9 @@ xfs_trans_read_buf(  		return (flags & XBF_TRYLOCK) ?  					0 : XFS_ERROR(ENOMEM);  	} -	if (XFS_BUF_GETERROR(bp) != 0) { -	    XFS_BUF_SUPER_STALE(bp); -		error = XFS_BUF_GETERROR(bp); - +	if (bp->b_error) { +		error = bp->b_error; +		XFS_BUF_SUPER_STALE(bp);  		xfs_ioerror_alert("xfs_trans_read_buf", mp,  				  bp, blkno);  		if (tp->t_flags & XFS_TRANS_DIRTY) @@ -430,7 +428,7 @@ shutdown_abort:  	if (XFS_BUF_ISSTALE(bp) && XFS_BUF_ISDELAYWRITE(bp))  		xfs_notice(mp, "about to pop assert, bp == 0x%p", bp);  #endif -	ASSERT((XFS_BUF_BFLAGS(bp) & (XBF_STALE|XBF_DELWRI)) != +	ASSERT((bp->b_flags & (XBF_STALE|XBF_DELWRI)) !=  				     (XBF_STALE|XBF_DELWRI));  	trace_xfs_trans_read_buf_shut(bp, _RET_IP_); @@ -581,7 +579,6 @@ xfs_trans_bhold(xfs_trans_t	*tp,  {  	xfs_buf_log_item_t	*bip = bp->b_fspriv; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(bp->b_transp == tp);  	ASSERT(bip != NULL);  	ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); @@ -602,7 +599,6 @@ xfs_trans_bhold_release(xfs_trans_t	*tp,  {  	xfs_buf_log_item_t	*bip = bp->b_fspriv; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(bp->b_transp == tp);  	ASSERT(bip != NULL);  	ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); @@ -631,7 +627,6 @@ xfs_trans_log_buf(xfs_trans_t	*tp,  {  	xfs_buf_log_item_t	*bip = bp->b_fspriv; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(bp->b_transp == tp);  	ASSERT(bip != NULL);  	ASSERT((first <= last) && (last < XFS_BUF_COUNT(bp))); @@ -702,7 +697,6 @@ xfs_trans_binval(  {  	xfs_buf_log_item_t	*bip = bp->b_fspriv; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(bp->b_transp == tp);  	ASSERT(bip != NULL);  	ASSERT(atomic_read(&bip->bli_refcount) > 0); @@ -774,7 +768,6 @@ xfs_trans_inode_buf(  {  	xfs_buf_log_item_t	*bip = bp->b_fspriv; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(bp->b_transp == tp);  	ASSERT(bip != NULL);  	ASSERT(atomic_read(&bip->bli_refcount) > 0); @@ -798,7 +791,6 @@ xfs_trans_stale_inode_buf(  {  	xfs_buf_log_item_t	*bip = bp->b_fspriv; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(bp->b_transp == tp);  	ASSERT(bip != NULL);  	ASSERT(atomic_read(&bip->bli_refcount) > 0); @@ -823,7 +815,6 @@ xfs_trans_inode_alloc_buf(  {  	xfs_buf_log_item_t	*bip = bp->b_fspriv; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(bp->b_transp == tp);  	ASSERT(bip != NULL);  	ASSERT(atomic_read(&bip->bli_refcount) > 0); @@ -851,7 +842,6 @@ xfs_trans_dquot_buf(  {  	xfs_buf_log_item_t	*bip = bp->b_fspriv; -	ASSERT(XFS_BUF_ISBUSY(bp));  	ASSERT(bp->b_transp == tp);  	ASSERT(bip != NULL);  	ASSERT(type == XFS_BLF_UDQUOT_BUF || diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c index 4d00ee67792..4d00ee67792 100644 --- a/fs/xfs/quota/xfs_trans_dquot.c +++ b/fs/xfs/xfs_trans_dquot.c diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/xfs_vnode.h index 7c220b4227b..7c220b4227b 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 88d121486c5..51fc429527b 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c @@ -83,7 +83,9 @@ xfs_readlink_bmap(  		bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt),  				  XBF_LOCK | XBF_MAPPED | XBF_DONT_BLOCK); -		error = XFS_BUF_GETERROR(bp); +		if (!bp) +			return XFS_ERROR(ENOMEM); +		error = bp->b_error;  		if (error) {  			xfs_ioerror_alert("xfs_readlink",  				  ip->i_mount, bp, XFS_BUF_ADDR(bp)); @@ -94,7 +96,7 @@ xfs_readlink_bmap(  			byte_cnt = pathlen;  		pathlen -= byte_cnt; -		memcpy(link, XFS_BUF_PTR(bp), byte_cnt); +		memcpy(link, bp->b_addr, byte_cnt);  		xfs_buf_relse(bp);  	} @@ -121,7 +123,7 @@ xfs_readlink(  	xfs_ilock(ip, XFS_ILOCK_SHARED); -	ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFLNK); +	ASSERT(S_ISLNK(ip->i_d.di_mode));  	ASSERT(ip->i_d.di_size <= MAXPATHLEN);  	pathlen = ip->i_d.di_size; @@ -529,7 +531,7 @@ xfs_release(  	if (ip->i_d.di_nlink == 0)  		return 0; -	if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && +	if ((S_ISREG(ip->i_d.di_mode) &&  	     ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 ||  	       ip->i_delayed_blks > 0)) &&  	     (ip->i_df.if_flags & XFS_IFEXTENTS))  && @@ -610,7 +612,7 @@ xfs_inactive(  	truncate = ((ip->i_d.di_nlink == 0) &&  	    ((ip->i_d.di_size != 0) || (ip->i_size != 0) ||  	     (ip->i_d.di_nextents > 0) || (ip->i_delayed_blks > 0)) && -	    ((ip->i_d.di_mode & S_IFMT) == S_IFREG)); +	    S_ISREG(ip->i_d.di_mode));  	mp = ip->i_mount; @@ -621,7 +623,7 @@ xfs_inactive(  		goto out;  	if (ip->i_d.di_nlink != 0) { -		if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && +		if ((S_ISREG(ip->i_d.di_mode) &&                       ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 ||                         ip->i_delayed_blks > 0)) &&  		      (ip->i_df.if_flags & XFS_IFEXTENTS) && @@ -669,7 +671,7 @@ xfs_inactive(  			xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL);  			return VN_INACTIVE_CACHE;  		} -	} else if ((ip->i_d.di_mode & S_IFMT) == S_IFLNK) { +	} else if (S_ISLNK(ip->i_d.di_mode)) {  		/*  		 * If we get an error while cleaning up a @@ -1648,13 +1650,13 @@ xfs_symlink(  			byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);  			bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,  					       BTOBB(byte_cnt), 0); -			ASSERT(bp && !XFS_BUF_GETERROR(bp)); +			ASSERT(!xfs_buf_geterror(bp));  			if (pathlen < byte_cnt) {  				byte_cnt = pathlen;  			}  			pathlen -= byte_cnt; -			memcpy(XFS_BUF_PTR(bp), cur_chunk, byte_cnt); +			memcpy(bp->b_addr, cur_chunk, byte_cnt);  			cur_chunk += byte_cnt;  			xfs_trans_log_buf(tp, bp, 0, byte_cnt - 1); @@ -1999,7 +2001,7 @@ xfs_zero_remaining_bytes(  					  mp, bp, XFS_BUF_ADDR(bp));  			break;  		} -		memset(XFS_BUF_PTR(bp) + +		memset(bp->b_addr +  			(offset - XFS_FSB_TO_B(mp, imap.br_startoff)),  		      0, lastoffset - offset + 1);  		XFS_BUF_UNDONE(bp); diff --git a/fs/xfs/linux-2.6/xfs_xattr.c b/fs/xfs/xfs_xattr.c index 87d3e03878c..87d3e03878c 100644 --- a/fs/xfs/linux-2.6/xfs_xattr.c +++ b/fs/xfs/xfs_xattr.c  |