Skip to content

Commit

Permalink
Merge branch 'xfs-4.10-misc-fixes-4' into for-next
Browse files Browse the repository at this point in the history
  • Loading branch information
dchinner committed Dec 9, 2016
2 parents a444d72 + 9875258 commit 9807b77
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 173 deletions.
12 changes: 4 additions & 8 deletions Documentation/filesystems/xfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ default behaviour.
CRC enabled filesystems always use the attr2 format, and so
will reject the noattr2 mount option if it is set.

barrier (*)
nobarrier
Enables/disables the use of block layer write barriers for
writes into the journal and for data integrity operations.
This allows for drive level write caching to be enabled, for
devices that support write barriers.

discard
nodiscard (*)
Enable/disable the issuing of commands to let the block
Expand Down Expand Up @@ -228,7 +221,10 @@ default behaviour.
Deprecated Mount Options
========================

None at present.
Name Removal Schedule
---- ----------------
barrier no earlier than v4.15
nobarrier no earlier than v4.15


Removed Mount Options
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/libxfs/xfs_alloc_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ xfs_allocbt_init_cursor(

ASSERT(btnum == XFS_BTNUM_BNO || btnum == XFS_BTNUM_CNT);

cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_SLEEP);
cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_NOFS);

cur->bc_tp = tp;
cur->bc_mp = mp;
Expand Down
8 changes: 7 additions & 1 deletion fs/xfs/libxfs/xfs_attr_leaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ xfs_attr3_leaf_verify(
{
struct xfs_mount *mp = bp->b_target->bt_mount;
struct xfs_attr_leafblock *leaf = bp->b_addr;
struct xfs_perag *pag = bp->b_pag;
struct xfs_attr3_icleaf_hdr ichdr;

xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
Expand All @@ -273,7 +274,12 @@ xfs_attr3_leaf_verify(
if (ichdr.magic != XFS_ATTR_LEAF_MAGIC)
return false;
}
if (ichdr.count == 0)
/*
* In recovery there is a transient state where count == 0 is valid
* because we may have transitioned an empty shortform attr to a leaf
* if the attr didn't fit in shortform.
*/
if (pag && pag->pagf_init && ichdr.count == 0)
return false;

/* XXX: need to range check rest of attr header values */
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/libxfs/xfs_bmap_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ xfs_bmbt_init_cursor(
struct xfs_btree_cur *cur;
ASSERT(whichfork != XFS_COW_FORK);

cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_SLEEP);
cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_NOFS);

cur->bc_tp = tp;
cur->bc_mp = mp;
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/libxfs/xfs_ialloc_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ xfs_inobt_init_cursor(
struct xfs_agi *agi = XFS_BUF_TO_AGI(agbp);
struct xfs_btree_cur *cur;

cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_SLEEP);
cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_NOFS);

cur->bc_tp = tp;
cur->bc_mp = mp;
Expand Down
3 changes: 1 addition & 2 deletions fs/xfs/xfs_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1737,8 +1737,7 @@ xfs_free_buftarg(
percpu_counter_destroy(&btp->bt_io_count);
list_lru_destroy(&btp->bt_lru);

if (mp->m_flags & XFS_MOUNT_BARRIER)
xfs_blkdev_issue_flush(btp);
xfs_blkdev_issue_flush(btp);

kmem_free(btp);
}
Expand Down
29 changes: 12 additions & 17 deletions fs/xfs/xfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,16 @@ xfs_file_fsync(

xfs_iflags_clear(ip, XFS_ITRUNCATED);

if (mp->m_flags & XFS_MOUNT_BARRIER) {
/*
* If we have an RT and/or log subvolume we need to make sure
* to flush the write cache the device used for file data
* first. This is to ensure newly written file data make
* it to disk before logging the new inode size in case of
* an extending write.
*/
if (XFS_IS_REALTIME_INODE(ip))
xfs_blkdev_issue_flush(mp->m_rtdev_targp);
else if (mp->m_logdev_targp != mp->m_ddev_targp)
xfs_blkdev_issue_flush(mp->m_ddev_targp);
}
/*
* If we have an RT and/or log subvolume we need to make sure to flush
* the write cache the device used for file data first. This is to
* ensure newly written file data make it to disk before logging the new
* inode size in case of an extending write.
*/
if (XFS_IS_REALTIME_INODE(ip))
xfs_blkdev_issue_flush(mp->m_rtdev_targp);
else if (mp->m_logdev_targp != mp->m_ddev_targp)
xfs_blkdev_issue_flush(mp->m_ddev_targp);

/*
* All metadata updates are logged, which means that we just have to
Expand Down Expand Up @@ -196,10 +193,8 @@ xfs_file_fsync(
* an already allocated file and thus do not have any metadata to
* commit.
*/
if ((mp->m_flags & XFS_MOUNT_BARRIER) &&
mp->m_logdev_targp == mp->m_ddev_targp &&
!XFS_IS_REALTIME_INODE(ip) &&
!log_flushed)
if (!log_flushed && !XFS_IS_REALTIME_INODE(ip) &&
mp->m_logdev_targp == mp->m_ddev_targp)
xfs_blkdev_issue_flush(mp->m_ddev_targp);

return error;
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ xfs_vn_setattr(
return error;

xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
error = xfs_setattr_size(ip, iattr);
error = xfs_vn_setattr_size(dentry, iattr);
xfs_iunlock(ip, XFS_MMAPLOCK_EXCL);
} else {
error = xfs_vn_setattr_nonsize(dentry, iattr);
Expand Down
39 changes: 16 additions & 23 deletions fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -1862,26 +1862,21 @@ xlog_sync(

bp->b_io_length = BTOBB(count);
bp->b_fspriv = iclog;
bp->b_flags &= ~(XBF_FUA | XBF_FLUSH);
bp->b_flags |= (XBF_ASYNC | XBF_SYNCIO | XBF_WRITE);
bp->b_flags &= ~XBF_FLUSH;
bp->b_flags |= (XBF_ASYNC | XBF_SYNCIO | XBF_WRITE | XBF_FUA);

if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) {
bp->b_flags |= XBF_FUA;

/*
* Flush the data device before flushing the log to make
* sure all meta data written back from the AIL actually made
* it to disk before stamping the new log tail LSN into the
* log buffer. For an external log we need to issue the
* flush explicitly, and unfortunately synchronously here;
* for an internal log we can simply use the block layer
* state machine for preflushes.
*/
if (log->l_mp->m_logdev_targp != log->l_mp->m_ddev_targp)
xfs_blkdev_issue_flush(log->l_mp->m_ddev_targp);
else
bp->b_flags |= XBF_FLUSH;
}
/*
* Flush the data device before flushing the log to make sure all meta
* data written back from the AIL actually made it to disk before
* stamping the new log tail LSN into the log buffer. For an external
* log we need to issue the flush explicitly, and unfortunately
* synchronously here; for an internal log we can simply use the block
* layer state machine for preflushes.
*/
if (log->l_mp->m_logdev_targp != log->l_mp->m_ddev_targp)
xfs_blkdev_issue_flush(log->l_mp->m_ddev_targp);
else
bp->b_flags |= XBF_FLUSH;

ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1);
ASSERT(XFS_BUF_ADDR(bp) + BTOBB(count) <= log->l_logBBsize);
Expand All @@ -1906,10 +1901,8 @@ xlog_sync(
xfs_buf_associate_memory(bp,
(char *)&iclog->ic_header + count, split);
bp->b_fspriv = iclog;
bp->b_flags &= ~(XBF_FUA | XBF_FLUSH);
bp->b_flags |= (XBF_ASYNC | XBF_SYNCIO | XBF_WRITE);
if (log->l_mp->m_flags & XFS_MOUNT_BARRIER)
bp->b_flags |= XBF_FUA;
bp->b_flags &= ~XBF_FLUSH;
bp->b_flags |= (XBF_ASYNC | XBF_SYNCIO | XBF_WRITE | XBF_FUA);

ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1);
ASSERT(XFS_BUF_ADDR(bp) + BTOBB(count) <= log->l_logBBsize);
Expand Down
25 changes: 16 additions & 9 deletions fs/xfs/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ static const match_table_t tokens = {
{Opt_sysvgroups,"sysvgroups"}, /* group-ID from current process */
{Opt_allocsize, "allocsize=%s"},/* preferred allocation size */
{Opt_norecovery,"norecovery"}, /* don't run XFS recovery */
{Opt_barrier, "barrier"}, /* use writer barriers for log write and
* unwritten extent conversion */
{Opt_nobarrier, "nobarrier"}, /* .. disable */
{Opt_inode64, "inode64"}, /* inodes can be allocated anywhere */
{Opt_inode32, "inode32"}, /* inode allocation limited to
* XFS_MAXINUMBER_32 */
Expand Down Expand Up @@ -134,6 +131,12 @@ static const match_table_t tokens = {
{Opt_nodiscard, "nodiscard"}, /* Do not discard unused blocks */

{Opt_dax, "dax"}, /* Enable direct access to bdev pages */

/* Deprecated mount options scheduled for removal */
{Opt_barrier, "barrier"}, /* use writer barriers for log write and
* unwritten extent conversion */
{Opt_nobarrier, "nobarrier"}, /* .. disable */

{Opt_err, NULL},
};

Expand Down Expand Up @@ -301,12 +304,6 @@ xfs_parseargs(
case Opt_nouuid:
mp->m_flags |= XFS_MOUNT_NOUUID;
break;
case Opt_barrier:
mp->m_flags |= XFS_MOUNT_BARRIER;
break;
case Opt_nobarrier:
mp->m_flags &= ~XFS_MOUNT_BARRIER;
break;
case Opt_ikeep:
mp->m_flags |= XFS_MOUNT_IKEEP;
break;
Expand Down Expand Up @@ -374,6 +371,14 @@ xfs_parseargs(
mp->m_flags |= XFS_MOUNT_DAX;
break;
#endif
case Opt_barrier:
xfs_warn(mp, "%s option is deprecated, ignoring.", p);
mp->m_flags |= XFS_MOUNT_BARRIER;
break;
case Opt_nobarrier:
xfs_warn(mp, "%s option is deprecated, ignoring.", p);
mp->m_flags &= ~XFS_MOUNT_BARRIER;
break;
default:
xfs_warn(mp, "unknown mount option [%s].", p);
return -EINVAL;
Expand Down Expand Up @@ -1238,9 +1243,11 @@ xfs_fs_remount(
token = match_token(p, tokens, args);
switch (token) {
case Opt_barrier:
xfs_warn(mp, "%s option is deprecated, ignoring.", p);
mp->m_flags |= XFS_MOUNT_BARRIER;
break;
case Opt_nobarrier:
xfs_warn(mp, "%s option is deprecated, ignoring.", p);
mp->m_flags &= ~XFS_MOUNT_BARRIER;
break;
case Opt_inode64:
Expand Down
Loading

0 comments on commit 9807b77

Please sign in to comment.