Commit b7b26110 authored by Dave Chinner's avatar Dave Chinner
Browse files

Merge branch 'xfs-4.10-misc-fixes-2' into for-next

parents ed24bee6 f782088c
Loading
Loading
Loading
Loading
+36 −4
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@
#include "xfs_rmap.h"
#include "xfs_ag_resv.h"
#include "xfs_refcount.h"
#include "xfs_rmap_btree.h"
#include "xfs_icache.h"


kmem_zone_t		*xfs_bmap_free_item_zone;
@@ -190,8 +192,12 @@ xfs_bmap_worst_indlen(
	int		maxrecs;	/* maximum record count at this level */
	xfs_mount_t	*mp;		/* mount structure */
	xfs_filblks_t	rval;		/* return value */
	xfs_filblks_t   orig_len;

	mp = ip->i_mount;

	/* Calculate the worst-case size of the bmbt. */
	orig_len = len;
	maxrecs = mp->m_bmap_dmxr[0];
	for (level = 0, rval = 0;
	     level < XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK);
@@ -199,12 +205,20 @@ xfs_bmap_worst_indlen(
		len += maxrecs - 1;
		do_div(len, maxrecs);
		rval += len;
		if (len == 1)
			return rval + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) -
		if (len == 1) {
			rval += XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) -
				level - 1;
			break;
		}
		if (level == 0)
			maxrecs = mp->m_bmap_dmxr[1];
	}

	/* Calculate the worst-case size of the rmapbt. */
	if (xfs_sb_version_hasrmapbt(&mp->m_sb))
		rval += 1 + xfs_rmapbt_calc_size(mp, orig_len) +
				mp->m_rmap_maxlevels;

	return rval;
}

@@ -4141,8 +4155,9 @@ int
xfs_bmapi_reserve_delalloc(
	struct xfs_inode	*ip,
	int			whichfork,
	xfs_fileoff_t		aoff,
	xfs_fileoff_t		off,
	xfs_filblks_t		len,
	xfs_filblks_t		prealloc,
	struct xfs_bmbt_irec	*got,
	xfs_extnum_t		*lastx,
	int			eof)
@@ -4154,10 +4169,17 @@ xfs_bmapi_reserve_delalloc(
	char			rt = XFS_IS_REALTIME_INODE(ip);
	xfs_extlen_t		extsz;
	int			error;
	xfs_fileoff_t		aoff = off;

	alen = XFS_FILBLKS_MIN(len, MAXEXTLEN);
	/*
	 * Cap the alloc length. Keep track of prealloc so we know whether to
	 * tag the inode before we return.
	 */
	alen = XFS_FILBLKS_MIN(len + prealloc, MAXEXTLEN);
	if (!eof)
		alen = XFS_FILBLKS_MIN(alen, got->br_startoff - aoff);
	if (prealloc && alen >= len)
		prealloc = alen - len;

	/* Figure out the extent size, adjust alen */
	if (whichfork == XFS_COW_FORK)
@@ -4223,6 +4245,16 @@ xfs_bmapi_reserve_delalloc(
	 */
	xfs_bmbt_get_all(xfs_iext_get_ext(ifp, *lastx), got);

	/*
	 * Tag the inode if blocks were preallocated. Note that COW fork
	 * preallocation can occur at the start or end of the extent, even when
	 * prealloc == 0, so we must also check the aligned offset and length.
	 */
	if (whichfork == XFS_DATA_FORK && prealloc)
		xfs_inode_set_eofblocks_tag(ip);
	if (whichfork == XFS_COW_FORK && (prealloc || aoff < off || alen > len))
		xfs_inode_set_cowblocks_tag(ip);

	ASSERT(got->br_startoff <= aoff);
	ASSERT(got->br_startoff + got->br_blockcount >= aoff + alen);
	ASSERT(isnullstartblock(got->br_startblock));
+1 −1
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ int xfs_bmap_shift_extents(struct xfs_trans *tp, struct xfs_inode *ip,
		int num_exts);
int	xfs_bmap_split_extent(struct xfs_inode *ip, xfs_fileoff_t split_offset);
int	xfs_bmapi_reserve_delalloc(struct xfs_inode *ip, int whichfork,
		xfs_fileoff_t aoff, xfs_filblks_t len,
		xfs_fileoff_t off, xfs_filblks_t len, xfs_filblks_t prealloc,
		struct xfs_bmbt_irec *got, xfs_extnum_t *lastx, int eof);

enum xfs_bmap_intent_type {
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ xfs_ascii_ci_compname(
	return result;
}

static struct xfs_nameops xfs_ascii_ci_nameops = {
static const struct xfs_nameops xfs_ascii_ci_nameops = {
	.hashname	= xfs_ascii_ci_hashname,
	.compname	= xfs_ascii_ci_compname,
};
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ typedef unsigned int xfs_buf_flags_t;
	{ XBF_READ,		"READ" }, \
	{ XBF_WRITE,		"WRITE" }, \
	{ XBF_READ_AHEAD,	"READ_AHEAD" }, \
	{ XBF_NO_IOACCT,	"NO_IOACCT" }, \
	{ XBF_ASYNC,		"ASYNC" }, \
	{ XBF_DONE,		"DONE" }, \
	{ XBF_STALE,		"STALE" }, \
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ xfs_icreate_item_committing(
/*
 * This is the ops vector shared by all buf log items.
 */
static struct xfs_item_ops xfs_icreate_item_ops = {
static const struct xfs_item_ops xfs_icreate_item_ops = {
	.iop_size	= xfs_icreate_item_size,
	.iop_format	= xfs_icreate_item_format,
	.iop_pin	= xfs_icreate_item_pin,
Loading