Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f21ce8f8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs

Pull XFS update (part 2) from Ben Myers:
 "Fixes for tracing of xfs_name strings, flag handling in
  open_by_handle, a log space hang with freeze/unfreeze, fstrim offset
  calculations, a section mismatch with xfs_qm_exit, an oops in
  xlog_recover_process_iunlinks, and a deadlock in xfs_rtfree_extent.

  There are also additional trace points for attributes, and the
  addition of a workqueue for allocation to work around kernel stack
  size limitations."

* 'for-linus' of git://oss.sgi.com/xfs/xfs:
  xfs: add lots of attribute trace points
  xfs: Fix oops on IO error during xlog_recover_process_iunlinks()
  xfs: fix fstrim offset calculations
  xfs: Account log unmount transaction correctly
  xfs: don't cache inodes read through bulkstat
  xfs: trace xfs_name strings correctly
  xfs: introduce an allocation workqueue
  xfs: Fix open flag handling in open_by_handle code
  xfs: fix deadlock in xfs_rtfree_extent
  fs: xfs: fix section mismatch in linux-next
parents 0c9aac08 5a5881cd
Loading
Loading
Loading
Loading
+34 −2
Original line number Original line Diff line number Diff line
@@ -35,6 +35,7 @@
#include "xfs_error.h"
#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_trace.h"


struct workqueue_struct *xfs_alloc_wq;


#define XFS_ABSDIFF(a,b)	(((a) <= (b)) ? ((b) - (a)) : ((a) - (b)))
#define XFS_ABSDIFF(a,b)	(((a) <= (b)) ? ((b) - (a)) : ((a) - (b)))


@@ -68,7 +69,7 @@ xfs_alloc_lookup_eq(
 * Lookup the first record greater than or equal to [bno, len]
 * Lookup the first record greater than or equal to [bno, len]
 * in the btree given by cur.
 * in the btree given by cur.
 */
 */
STATIC int				/* error */
int				/* error */
xfs_alloc_lookup_ge(
xfs_alloc_lookup_ge(
	struct xfs_btree_cur	*cur,	/* btree cursor */
	struct xfs_btree_cur	*cur,	/* btree cursor */
	xfs_agblock_t		bno,	/* starting block of extent */
	xfs_agblock_t		bno,	/* starting block of extent */
@@ -2207,7 +2208,7 @@ xfs_alloc_read_agf(
 * group or loop over the allocation groups to find the result.
 * group or loop over the allocation groups to find the result.
 */
 */
int				/* error */
int				/* error */
xfs_alloc_vextent(
__xfs_alloc_vextent(
	xfs_alloc_arg_t	*args)	/* allocation argument structure */
	xfs_alloc_arg_t	*args)	/* allocation argument structure */
{
{
	xfs_agblock_t	agsize;	/* allocation group size */
	xfs_agblock_t	agsize;	/* allocation group size */
@@ -2417,6 +2418,37 @@ error0:
	return error;
	return error;
}
}


static void
xfs_alloc_vextent_worker(
	struct work_struct	*work)
{
	struct xfs_alloc_arg	*args = container_of(work,
						struct xfs_alloc_arg, work);
	unsigned long		pflags;

	/* we are in a transaction context here */
	current_set_flags_nested(&pflags, PF_FSTRANS);

	args->result = __xfs_alloc_vextent(args);
	complete(args->done);

	current_restore_flags_nested(&pflags, PF_FSTRANS);
}


int				/* error */
xfs_alloc_vextent(
	xfs_alloc_arg_t	*args)	/* allocation argument structure */
{
	DECLARE_COMPLETION_ONSTACK(done);

	args->done = &done;
	INIT_WORK(&args->work, xfs_alloc_vextent_worker);
	queue_work(xfs_alloc_wq, &args->work);
	wait_for_completion(&done);
	return args->result;
}

/*
/*
 * Free an extent.
 * Free an extent.
 * Just break up the extent address and hand off to xfs_free_ag_extent
 * Just break up the extent address and hand off to xfs_free_ag_extent
+12 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,8 @@ struct xfs_perag;
struct xfs_trans;
struct xfs_trans;
struct xfs_busy_extent;
struct xfs_busy_extent;


extern struct workqueue_struct *xfs_alloc_wq;

/*
/*
 * Freespace allocation types.  Argument to xfs_alloc_[v]extent.
 * Freespace allocation types.  Argument to xfs_alloc_[v]extent.
 */
 */
@@ -119,6 +121,9 @@ typedef struct xfs_alloc_arg {
	char		isfl;		/* set if is freelist blocks - !acctg */
	char		isfl;		/* set if is freelist blocks - !acctg */
	char		userdata;	/* set if this is user data */
	char		userdata;	/* set if this is user data */
	xfs_fsblock_t	firstblock;	/* io first block allocated */
	xfs_fsblock_t	firstblock;	/* io first block allocated */
	struct completion *done;
	struct work_struct work;
	int		result;
} xfs_alloc_arg_t;
} xfs_alloc_arg_t;


/*
/*
@@ -243,6 +248,13 @@ xfs_alloc_lookup_le(
	xfs_extlen_t		len,	/* length of extent */
	xfs_extlen_t		len,	/* length of extent */
	int			*stat);	/* success/failure */
	int			*stat);	/* success/failure */


int				/* error */
xfs_alloc_lookup_ge(
	struct xfs_btree_cur	*cur,	/* btree cursor */
	xfs_agblock_t		bno,	/* starting block of extent */
	xfs_extlen_t		len,	/* length of extent */
	int			*stat);	/* success/failure */

int					/* error */
int					/* error */
xfs_alloc_get_rec(
xfs_alloc_get_rec(
	struct xfs_btree_cur	*cur,	/* btree cursor */
	struct xfs_btree_cur	*cur,	/* btree cursor */
+16 −0
Original line number Original line Diff line number Diff line
@@ -853,6 +853,8 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
{
{
	int newsize, forkoff, retval;
	int newsize, forkoff, retval;


	trace_xfs_attr_sf_addname(args);

	retval = xfs_attr_shortform_lookup(args);
	retval = xfs_attr_shortform_lookup(args);
	if ((args->flags & ATTR_REPLACE) && (retval == ENOATTR)) {
	if ((args->flags & ATTR_REPLACE) && (retval == ENOATTR)) {
		return(retval);
		return(retval);
@@ -896,6 +898,8 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
	xfs_dabuf_t *bp;
	xfs_dabuf_t *bp;
	int retval, error, committed, forkoff;
	int retval, error, committed, forkoff;


	trace_xfs_attr_leaf_addname(args);

	/*
	/*
	 * Read the (only) block in the attribute list in.
	 * Read the (only) block in the attribute list in.
	 */
	 */
@@ -920,6 +924,9 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
			xfs_da_brelse(args->trans, bp);
			xfs_da_brelse(args->trans, bp);
			return(retval);
			return(retval);
		}
		}

		trace_xfs_attr_leaf_replace(args);

		args->op_flags |= XFS_DA_OP_RENAME;	/* an atomic rename */
		args->op_flags |= XFS_DA_OP_RENAME;	/* an atomic rename */
		args->blkno2 = args->blkno;		/* set 2nd entry info*/
		args->blkno2 = args->blkno;		/* set 2nd entry info*/
		args->index2 = args->index;
		args->index2 = args->index;
@@ -1090,6 +1097,8 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
	xfs_dabuf_t *bp;
	xfs_dabuf_t *bp;
	int error, committed, forkoff;
	int error, committed, forkoff;


	trace_xfs_attr_leaf_removename(args);

	/*
	/*
	 * Remove the attribute.
	 * Remove the attribute.
	 */
	 */
@@ -1223,6 +1232,8 @@ xfs_attr_node_addname(xfs_da_args_t *args)
	xfs_mount_t *mp;
	xfs_mount_t *mp;
	int committed, retval, error;
	int committed, retval, error;


	trace_xfs_attr_node_addname(args);

	/*
	/*
	 * Fill in bucket of arguments/results/context to carry around.
	 * Fill in bucket of arguments/results/context to carry around.
	 */
	 */
@@ -1249,6 +1260,9 @@ restart:
	} else if (retval == EEXIST) {
	} else if (retval == EEXIST) {
		if (args->flags & ATTR_CREATE)
		if (args->flags & ATTR_CREATE)
			goto out;
			goto out;

		trace_xfs_attr_node_replace(args);

		args->op_flags |= XFS_DA_OP_RENAME;	/* atomic rename op */
		args->op_flags |= XFS_DA_OP_RENAME;	/* atomic rename op */
		args->blkno2 = args->blkno;		/* set 2nd entry info*/
		args->blkno2 = args->blkno;		/* set 2nd entry info*/
		args->index2 = args->index;
		args->index2 = args->index;
@@ -1480,6 +1494,8 @@ xfs_attr_node_removename(xfs_da_args_t *args)
	xfs_dabuf_t *bp;
	xfs_dabuf_t *bp;
	int retval, error, committed, forkoff;
	int retval, error, committed, forkoff;


	trace_xfs_attr_node_removename(args);

	/*
	/*
	 * Tie a string around our finger to remind us where we are.
	 * Tie a string around our finger to remind us where we are.
	 */
	 */
+36 −4
Original line number Original line Diff line number Diff line
@@ -235,6 +235,8 @@ xfs_attr_shortform_create(xfs_da_args_t *args)
	xfs_inode_t *dp;
	xfs_inode_t *dp;
	xfs_ifork_t *ifp;
	xfs_ifork_t *ifp;


	trace_xfs_attr_sf_create(args);

	dp = args->dp;
	dp = args->dp;
	ASSERT(dp != NULL);
	ASSERT(dp != NULL);
	ifp = dp->i_afp;
	ifp = dp->i_afp;
@@ -268,6 +270,8 @@ xfs_attr_shortform_add(xfs_da_args_t *args, int forkoff)
	xfs_inode_t *dp;
	xfs_inode_t *dp;
	xfs_ifork_t *ifp;
	xfs_ifork_t *ifp;


	trace_xfs_attr_sf_add(args);

	dp = args->dp;
	dp = args->dp;
	mp = dp->i_mount;
	mp = dp->i_mount;
	dp->i_d.di_forkoff = forkoff;
	dp->i_d.di_forkoff = forkoff;
@@ -337,6 +341,8 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
	xfs_mount_t *mp;
	xfs_mount_t *mp;
	xfs_inode_t *dp;
	xfs_inode_t *dp;


	trace_xfs_attr_sf_remove(args);

	dp = args->dp;
	dp = args->dp;
	mp = dp->i_mount;
	mp = dp->i_mount;
	base = sizeof(xfs_attr_sf_hdr_t);
	base = sizeof(xfs_attr_sf_hdr_t);
@@ -405,6 +411,8 @@ xfs_attr_shortform_lookup(xfs_da_args_t *args)
	int i;
	int i;
	xfs_ifork_t *ifp;
	xfs_ifork_t *ifp;


	trace_xfs_attr_sf_lookup(args);

	ifp = args->dp->i_afp;
	ifp = args->dp->i_afp;
	ASSERT(ifp->if_flags & XFS_IFINLINE);
	ASSERT(ifp->if_flags & XFS_IFINLINE);
	sf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;
	sf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;
@@ -476,6 +484,8 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args)
	xfs_dabuf_t *bp;
	xfs_dabuf_t *bp;
	xfs_ifork_t *ifp;
	xfs_ifork_t *ifp;


	trace_xfs_attr_sf_to_leaf(args);

	dp = args->dp;
	dp = args->dp;
	ifp = dp->i_afp;
	ifp = dp->i_afp;
	sf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;
	sf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;
@@ -775,6 +785,8 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
	char *tmpbuffer;
	char *tmpbuffer;
	int error, i;
	int error, i;


	trace_xfs_attr_leaf_to_sf(args);

	dp = args->dp;
	dp = args->dp;
	tmpbuffer = kmem_alloc(XFS_LBSIZE(dp->i_mount), KM_SLEEP);
	tmpbuffer = kmem_alloc(XFS_LBSIZE(dp->i_mount), KM_SLEEP);
	ASSERT(tmpbuffer != NULL);
	ASSERT(tmpbuffer != NULL);
@@ -848,6 +860,8 @@ xfs_attr_leaf_to_node(xfs_da_args_t *args)
	xfs_dablk_t blkno;
	xfs_dablk_t blkno;
	int error;
	int error;


	trace_xfs_attr_leaf_to_node(args);

	dp = args->dp;
	dp = args->dp;
	bp1 = bp2 = NULL;
	bp1 = bp2 = NULL;
	error = xfs_da_grow_inode(args, &blkno);
	error = xfs_da_grow_inode(args, &blkno);
@@ -911,6 +925,8 @@ xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp)
	xfs_dabuf_t *bp;
	xfs_dabuf_t *bp;
	int error;
	int error;


	trace_xfs_attr_leaf_create(args);

	dp = args->dp;
	dp = args->dp;
	ASSERT(dp != NULL);
	ASSERT(dp != NULL);
	error = xfs_da_get_buf(args->trans, args->dp, blkno, -1, &bp,
	error = xfs_da_get_buf(args->trans, args->dp, blkno, -1, &bp,
@@ -948,6 +964,8 @@ xfs_attr_leaf_split(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk,
	xfs_dablk_t blkno;
	xfs_dablk_t blkno;
	int error;
	int error;


	trace_xfs_attr_leaf_split(state->args);

	/*
	/*
	 * Allocate space for a new leaf node.
	 * Allocate space for a new leaf node.
	 */
	 */
@@ -977,10 +995,13 @@ xfs_attr_leaf_split(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk,
	 *
	 *
	 * Insert the "new" entry in the correct block.
	 * Insert the "new" entry in the correct block.
	 */
	 */
	if (state->inleaf)
	if (state->inleaf) {
		trace_xfs_attr_leaf_add_old(state->args);
		error = xfs_attr_leaf_add(oldblk->bp, state->args);
		error = xfs_attr_leaf_add(oldblk->bp, state->args);
	else
	} else {
		trace_xfs_attr_leaf_add_new(state->args);
		error = xfs_attr_leaf_add(newblk->bp, state->args);
		error = xfs_attr_leaf_add(newblk->bp, state->args);
	}


	/*
	/*
	 * Update last hashval in each block since we added the name.
	 * Update last hashval in each block since we added the name.
@@ -1001,6 +1022,8 @@ xfs_attr_leaf_add(xfs_dabuf_t *bp, xfs_da_args_t *args)
	xfs_attr_leaf_map_t *map;
	xfs_attr_leaf_map_t *map;
	int tablesize, entsize, sum, tmp, i;
	int tablesize, entsize, sum, tmp, i;


	trace_xfs_attr_leaf_add(args);

	leaf = bp->data;
	leaf = bp->data;
	ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
	ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
	ASSERT((args->index >= 0)
	ASSERT((args->index >= 0)
@@ -1128,8 +1151,6 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
	       (be32_to_cpu(entry->hashval) <= be32_to_cpu((entry+1)->hashval)));
	       (be32_to_cpu(entry->hashval) <= be32_to_cpu((entry+1)->hashval)));


	/*
	/*
	 * Copy the attribute name and value into the new space.
	 *
	 * For "remote" attribute values, simply note that we need to
	 * For "remote" attribute values, simply note that we need to
	 * allocate space for the "remote" value.  We can't actually
	 * allocate space for the "remote" value.  We can't actually
	 * allocate the extents in this transaction, and we can't decide
	 * allocate the extents in this transaction, and we can't decide
@@ -1265,6 +1286,8 @@ xfs_attr_leaf_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
	ASSERT(leaf2->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
	ASSERT(leaf2->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
	args = state->args;
	args = state->args;


	trace_xfs_attr_leaf_rebalance(args);

	/*
	/*
	 * Check ordering of blocks, reverse if it makes things simpler.
	 * Check ordering of blocks, reverse if it makes things simpler.
	 *
	 *
@@ -1810,6 +1833,8 @@ xfs_attr_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
	xfs_mount_t *mp;
	xfs_mount_t *mp;
	char *tmpbuffer;
	char *tmpbuffer;


	trace_xfs_attr_leaf_unbalance(state->args);

	/*
	/*
	 * Set up environment.
	 * Set up environment.
	 */
	 */
@@ -1919,6 +1944,8 @@ xfs_attr_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args)
	int probe, span;
	int probe, span;
	xfs_dahash_t hashval;
	xfs_dahash_t hashval;


	trace_xfs_attr_leaf_lookup(args);

	leaf = bp->data;
	leaf = bp->data;
	ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
	ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
	ASSERT(be16_to_cpu(leaf->hdr.count)
	ASSERT(be16_to_cpu(leaf->hdr.count)
@@ -2445,6 +2472,7 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args)
	char *name;
	char *name;
#endif /* DEBUG */
#endif /* DEBUG */


	trace_xfs_attr_leaf_clearflag(args);
	/*
	/*
	 * Set up the operation.
	 * Set up the operation.
	 */
	 */
@@ -2509,6 +2537,8 @@ xfs_attr_leaf_setflag(xfs_da_args_t *args)
	xfs_dabuf_t *bp;
	xfs_dabuf_t *bp;
	int error;
	int error;


	trace_xfs_attr_leaf_setflag(args);

	/*
	/*
	 * Set up the operation.
	 * Set up the operation.
	 */
	 */
@@ -2565,6 +2595,8 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args)
	char *name1, *name2;
	char *name1, *name2;
#endif /* DEBUG */
#endif /* DEBUG */


	trace_xfs_attr_leaf_flipflags(args);

	/*
	/*
	 * Read the block containing the "old" attr
	 * Read the block containing the "old" attr
	 */
	 */
+9 −0
Original line number Original line Diff line number Diff line
@@ -5124,6 +5124,15 @@ xfs_bunmapi(
		cur->bc_private.b.flags = 0;
		cur->bc_private.b.flags = 0;
	} else
	} else
		cur = NULL;
		cur = NULL;

	if (isrt) {
		/*
		 * Synchronize by locking the bitmap inode.
		 */
		xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
		xfs_trans_ijoin(tp, mp->m_rbmip, XFS_ILOCK_EXCL);
	}

	extno = 0;
	extno = 0;
	while (bno != (xfs_fileoff_t)-1 && bno >= start && lastx >= 0 &&
	while (bno != (xfs_fileoff_t)-1 && bno >= start && lastx >= 0 &&
	       (nexts == 0 || extno < nexts)) {
	       (nexts == 0 || extno < nexts)) {
Loading