Merge branch 'xfs-misc-fixes-for-4.3-3' into for-next

This commit is contained in:
Dave Chinner 2015-08-25 10:13:35 +10:00
commit 70b33a7466
7 changed files with 34 additions and 24 deletions

View File

@ -1937,7 +1937,7 @@ xfs_alloc_fix_freelist(
struct xfs_alloc_arg targs; /* local allocation arguments */ struct xfs_alloc_arg targs; /* local allocation arguments */
xfs_agblock_t bno; /* freelist block */ xfs_agblock_t bno; /* freelist block */
xfs_extlen_t need; /* total blocks needed in freelist */ xfs_extlen_t need; /* total blocks needed in freelist */
int error; int error = 0;
if (!pag->pagf_init) { if (!pag->pagf_init) {
error = xfs_alloc_read_agf(mp, tp, args->agno, flags, &agbp); error = xfs_alloc_read_agf(mp, tp, args->agno, flags, &agbp);

View File

@ -2131,6 +2131,7 @@ xfs_dir2_node_replace(
int error; /* error return value */ int error; /* error return value */
int i; /* btree level */ int i; /* btree level */
xfs_ino_t inum; /* new inode number */ xfs_ino_t inum; /* new inode number */
int ftype; /* new file type */
xfs_dir2_leaf_t *leaf; /* leaf structure */ xfs_dir2_leaf_t *leaf; /* leaf structure */
xfs_dir2_leaf_entry_t *lep; /* leaf entry being changed */ xfs_dir2_leaf_entry_t *lep; /* leaf entry being changed */
int rval; /* internal return value */ int rval; /* internal return value */
@ -2144,7 +2145,14 @@ xfs_dir2_node_replace(
state = xfs_da_state_alloc(); state = xfs_da_state_alloc();
state->args = args; state->args = args;
state->mp = args->dp->i_mount; state->mp = args->dp->i_mount;
/*
* We have to save new inode number and ftype since
* xfs_da3_node_lookup_int() is going to overwrite them
*/
inum = args->inumber; inum = args->inumber;
ftype = args->filetype;
/* /*
* Lookup the entry to change in the btree. * Lookup the entry to change in the btree.
*/ */
@ -2182,7 +2190,7 @@ xfs_dir2_node_replace(
* Fill in the new inode number and log the entry. * Fill in the new inode number and log the entry.
*/ */
dep->inumber = cpu_to_be64(inum); dep->inumber = cpu_to_be64(inum);
args->dp->d_ops->data_put_ftype(dep, args->filetype); args->dp->d_ops->data_put_ftype(dep, ftype);
xfs_dir2_data_log_entry(args, state->extrablk.bp, dep); xfs_dir2_data_log_entry(args, state->extrablk.bp, dep);
rval = 0; rval = 0;
} }

View File

@ -438,7 +438,6 @@ _xfs_buf_find(
xfs_buf_flags_t flags, xfs_buf_flags_t flags,
xfs_buf_t *new_bp) xfs_buf_t *new_bp)
{ {
size_t numbytes;
struct xfs_perag *pag; struct xfs_perag *pag;
struct rb_node **rbp; struct rb_node **rbp;
struct rb_node *parent; struct rb_node *parent;
@ -450,10 +449,9 @@ _xfs_buf_find(
for (i = 0; i < nmaps; i++) for (i = 0; i < nmaps; i++)
numblks += map[i].bm_len; numblks += map[i].bm_len;
numbytes = BBTOB(numblks);
/* Check for IOs smaller than the sector size / not sector aligned */ /* Check for IOs smaller than the sector size / not sector aligned */
ASSERT(!(numbytes < btp->bt_meta_sectorsize)); ASSERT(!(BBTOB(numblks) < btp->bt_meta_sectorsize));
ASSERT(!(BBTOB(blkno) & (xfs_off_t)btp->bt_meta_sectormask)); ASSERT(!(BBTOB(blkno) & (xfs_off_t)btp->bt_meta_sectormask));
/* /*

View File

@ -746,13 +746,13 @@ xfs_buf_item_free_format(
* buffer (see xfs_buf_attach_iodone() below), then put the * buffer (see xfs_buf_attach_iodone() below), then put the
* buf log item at the front. * buf log item at the front.
*/ */
void int
xfs_buf_item_init( xfs_buf_item_init(
xfs_buf_t *bp, struct xfs_buf *bp,
xfs_mount_t *mp) struct xfs_mount *mp)
{ {
xfs_log_item_t *lip = bp->b_fspriv; struct xfs_log_item *lip = bp->b_fspriv;
xfs_buf_log_item_t *bip; struct xfs_buf_log_item *bip;
int chunks; int chunks;
int map_size; int map_size;
int error; int error;
@ -766,12 +766,11 @@ xfs_buf_item_init(
*/ */
ASSERT(bp->b_target->bt_mount == mp); ASSERT(bp->b_target->bt_mount == mp);
if (lip != NULL && lip->li_type == XFS_LI_BUF) if (lip != NULL && lip->li_type == XFS_LI_BUF)
return; return 0;
bip = kmem_zone_zalloc(xfs_buf_item_zone, KM_SLEEP); bip = kmem_zone_zalloc(xfs_buf_item_zone, KM_SLEEP);
xfs_log_item_init(mp, &bip->bli_item, XFS_LI_BUF, &xfs_buf_item_ops); xfs_log_item_init(mp, &bip->bli_item, XFS_LI_BUF, &xfs_buf_item_ops);
bip->bli_buf = bp; bip->bli_buf = bp;
xfs_buf_hold(bp);
/* /*
* chunks is the number of XFS_BLF_CHUNK size pieces the buffer * chunks is the number of XFS_BLF_CHUNK size pieces the buffer
@ -784,6 +783,11 @@ xfs_buf_item_init(
*/ */
error = xfs_buf_item_get_format(bip, bp->b_map_count); error = xfs_buf_item_get_format(bip, bp->b_map_count);
ASSERT(error == 0); ASSERT(error == 0);
if (error) { /* to stop gcc throwing set-but-unused warnings */
kmem_zone_free(xfs_buf_item_zone, bip);
return error;
}
for (i = 0; i < bip->bli_format_count; i++) { for (i = 0; i < bip->bli_format_count; i++) {
chunks = DIV_ROUND_UP(BBTOB(bp->b_maps[i].bm_len), chunks = DIV_ROUND_UP(BBTOB(bp->b_maps[i].bm_len),
@ -803,6 +807,8 @@ xfs_buf_item_init(
if (bp->b_fspriv) if (bp->b_fspriv)
bip->bli_item.li_bio_list = bp->b_fspriv; bip->bli_item.li_bio_list = bp->b_fspriv;
bp->b_fspriv = bip; bp->b_fspriv = bip;
xfs_buf_hold(bp);
return 0;
} }

View File

@ -61,7 +61,7 @@ typedef struct xfs_buf_log_item {
struct xfs_buf_log_format __bli_format; /* embedded in-log header */ struct xfs_buf_log_format __bli_format; /* embedded in-log header */
} xfs_buf_log_item_t; } xfs_buf_log_item_t;
void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
void xfs_buf_item_relse(struct xfs_buf *); void xfs_buf_item_relse(struct xfs_buf *);
void xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint); void xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint);
uint xfs_buf_item_dirty(xfs_buf_log_item_t *); uint xfs_buf_item_dirty(xfs_buf_log_item_t *);

View File

@ -362,7 +362,13 @@ int xfs_lots_retries;
int xfs_lock_delays; int xfs_lock_delays;
#endif #endif
#ifdef CONFIG_LOCKDEP /*
* xfs_lockdep_subclass_ok() is only used in an ASSERT, so is only called when
* DEBUG or XFS_WARN is set. And MAX_LOCKDEP_SUBCLASSES is then only defined
* when CONFIG_LOCKDEP is set. Hence the complex define below to avoid build
* errors and warnings.
*/
#if (defined(DEBUG) || defined(XFS_WARN)) && defined(CONFIG_LOCKDEP)
static bool static bool
xfs_lockdep_subclass_ok( xfs_lockdep_subclass_ok(
int subclass) int subclass)

View File

@ -261,16 +261,8 @@ xfs_parseargs(
mp->m_rtname = kstrndup(value, MAXNAMELEN, GFP_KERNEL); mp->m_rtname = kstrndup(value, MAXNAMELEN, GFP_KERNEL);
if (!mp->m_rtname) if (!mp->m_rtname)
return -ENOMEM; return -ENOMEM;
} else if (!strcmp(this_char, MNTOPT_BIOSIZE)) { } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE) ||
if (!value || !*value) { !strcmp(this_char, MNTOPT_BIOSIZE)) {
xfs_warn(mp, "%s option requires an argument",
this_char);
return -EINVAL;
}
if (kstrtoint(value, 10, &iosize))
return -EINVAL;
iosizelog = ffs(iosize) - 1;
} else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
if (!value || !*value) { if (!value || !*value) {
xfs_warn(mp, "%s option requires an argument", xfs_warn(mp, "%s option requires an argument",
this_char); this_char);