Commit 0560f31a authored by Dave Chinner's avatar Dave Chinner Committed by Darrick J. Wong

xfs: convert mount flags to features

Replace m_flags feature checks with xfs_has_<feature>() calls and
rework the setup code to set flags in m_features.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent 8970a5b8
...@@ -224,7 +224,7 @@ xfs_attr_try_sf_addname( ...@@ -224,7 +224,7 @@ xfs_attr_try_sf_addname(
if (!error && !(args->op_flags & XFS_DA_OP_NOTIME)) if (!error && !(args->op_flags & XFS_DA_OP_NOTIME))
xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG); xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
if (dp->i_mount->m_flags & XFS_MOUNT_WSYNC) if (xfs_has_wsync(dp->i_mount))
xfs_trans_set_sync(args->trans); xfs_trans_set_sync(args->trans);
return error; return error;
...@@ -808,7 +808,7 @@ xfs_attr_set( ...@@ -808,7 +808,7 @@ xfs_attr_set(
* If this is a synchronous mount, make sure that the * If this is a synchronous mount, make sure that the
* transaction goes to disk before returning to the user. * transaction goes to disk before returning to the user.
*/ */
if (mp->m_flags & XFS_MOUNT_WSYNC) if (xfs_has_wsync(mp))
xfs_trans_set_sync(args->trans); xfs_trans_set_sync(args->trans);
if (!(args->op_flags & XFS_DA_OP_NOTIME)) if (!(args->op_flags & XFS_DA_OP_NOTIME))
......
...@@ -568,7 +568,7 @@ xfs_attr_shortform_bytesfit( ...@@ -568,7 +568,7 @@ xfs_attr_shortform_bytesfit(
* literal area, but for the old format we are done if there is no * literal area, but for the old format we are done if there is no
* space in the fixed attribute fork. * space in the fixed attribute fork.
*/ */
if (!(mp->m_flags & XFS_MOUNT_ATTR2)) if (!xfs_has_attr2(mp))
return 0; return 0;
dsize = dp->i_df.if_bytes; dsize = dp->i_df.if_bytes;
...@@ -621,21 +621,27 @@ xfs_attr_shortform_bytesfit( ...@@ -621,21 +621,27 @@ xfs_attr_shortform_bytesfit(
} }
/* /*
* Switch on the ATTR2 superblock bit (implies also FEATURES2) * Switch on the ATTR2 superblock bit (implies also FEATURES2) unless:
* - noattr2 mount option is set,
* - on-disk version bit says it is already set, or
* - the attr2 mount option is not set to enable automatic upgrade from attr1.
*/ */
STATIC void STATIC void
xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp) xfs_sbversion_add_attr2(
struct xfs_mount *mp,
struct xfs_trans *tp)
{ {
if ((mp->m_flags & XFS_MOUNT_ATTR2) && if (xfs_has_noattr2(mp))
!(xfs_has_attr2(mp))) { return;
spin_lock(&mp->m_sb_lock); if (mp->m_sb.sb_features2 & XFS_SB_VERSION2_ATTR2BIT)
if (!xfs_has_attr2(mp)) { return;
xfs_add_attr2(mp); if (!xfs_has_attr2(mp))
spin_unlock(&mp->m_sb_lock); return;
xfs_log_sb(tp);
} else spin_lock(&mp->m_sb_lock);
spin_unlock(&mp->m_sb_lock); xfs_add_attr2(mp);
} spin_unlock(&mp->m_sb_lock);
xfs_log_sb(tp);
} }
/* /*
...@@ -810,8 +816,7 @@ xfs_attr_sf_removename( ...@@ -810,8 +816,7 @@ xfs_attr_sf_removename(
* Fix up the start offset of the attribute fork * Fix up the start offset of the attribute fork
*/ */
totsize -= size; totsize -= size;
if (totsize == sizeof(xfs_attr_sf_hdr_t) && if (totsize == sizeof(xfs_attr_sf_hdr_t) && xfs_has_attr2(mp) &&
(mp->m_flags & XFS_MOUNT_ATTR2) &&
(dp->i_df.if_format != XFS_DINODE_FMT_BTREE) && (dp->i_df.if_format != XFS_DINODE_FMT_BTREE) &&
!(args->op_flags & XFS_DA_OP_ADDNAME)) { !(args->op_flags & XFS_DA_OP_ADDNAME)) {
xfs_attr_fork_remove(dp, args->trans); xfs_attr_fork_remove(dp, args->trans);
...@@ -821,7 +826,7 @@ xfs_attr_sf_removename( ...@@ -821,7 +826,7 @@ xfs_attr_sf_removename(
ASSERT(dp->i_forkoff); ASSERT(dp->i_forkoff);
ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) || ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) ||
(args->op_flags & XFS_DA_OP_ADDNAME) || (args->op_flags & XFS_DA_OP_ADDNAME) ||
!(mp->m_flags & XFS_MOUNT_ATTR2) || !xfs_has_attr2(mp) ||
dp->i_df.if_format == XFS_DINODE_FMT_BTREE); dp->i_df.if_format == XFS_DINODE_FMT_BTREE);
xfs_trans_log_inode(args->trans, dp, xfs_trans_log_inode(args->trans, dp,
XFS_ILOG_CORE | XFS_ILOG_ADATA); XFS_ILOG_CORE | XFS_ILOG_ADATA);
...@@ -997,7 +1002,7 @@ xfs_attr_shortform_allfit( ...@@ -997,7 +1002,7 @@ xfs_attr_shortform_allfit(
bytes += xfs_attr_sf_entsize_byname(name_loc->namelen, bytes += xfs_attr_sf_entsize_byname(name_loc->namelen,
be16_to_cpu(name_loc->valuelen)); be16_to_cpu(name_loc->valuelen));
} }
if ((dp->i_mount->m_flags & XFS_MOUNT_ATTR2) && if (xfs_has_attr2(dp->i_mount) &&
(dp->i_df.if_format != XFS_DINODE_FMT_BTREE) && (dp->i_df.if_format != XFS_DINODE_FMT_BTREE) &&
(bytes == sizeof(struct xfs_attr_sf_hdr))) (bytes == sizeof(struct xfs_attr_sf_hdr)))
return -1; return -1;
...@@ -1122,7 +1127,7 @@ xfs_attr3_leaf_to_shortform( ...@@ -1122,7 +1127,7 @@ xfs_attr3_leaf_to_shortform(
goto out; goto out;
if (forkoff == -1) { if (forkoff == -1) {
ASSERT(dp->i_mount->m_flags & XFS_MOUNT_ATTR2); ASSERT(xfs_has_attr2(dp->i_mount));
ASSERT(dp->i_df.if_format != XFS_DINODE_FMT_BTREE); ASSERT(dp->i_df.if_format != XFS_DINODE_FMT_BTREE);
xfs_attr_fork_remove(dp, args->trans); xfs_attr_fork_remove(dp, args->trans);
goto out; goto out;
......
...@@ -1047,7 +1047,7 @@ xfs_bmap_set_attrforkoff( ...@@ -1047,7 +1047,7 @@ xfs_bmap_set_attrforkoff(
ip->i_forkoff = xfs_attr_shortform_bytesfit(ip, size); ip->i_forkoff = xfs_attr_shortform_bytesfit(ip, size);
if (!ip->i_forkoff) if (!ip->i_forkoff)
ip->i_forkoff = default_size; ip->i_forkoff = default_size;
else if ((ip->i_mount->m_flags & XFS_MOUNT_ATTR2) && version) else if (xfs_has_attr2(ip->i_mount) && version)
*version = 2; *version = 2;
break; break;
default: default:
...@@ -3422,7 +3422,7 @@ xfs_bmap_compute_alignments( ...@@ -3422,7 +3422,7 @@ xfs_bmap_compute_alignments(
int stripe_align = 0; int stripe_align = 0;
/* stripe alignment for allocation is determined by mount parameters */ /* stripe alignment for allocation is determined by mount parameters */
if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC)) if (mp->m_swidth && xfs_has_swalloc(mp))
stripe_align = mp->m_swidth; stripe_align = mp->m_swidth;
else if (mp->m_dalign) else if (mp->m_dalign)
stripe_align = mp->m_dalign; stripe_align = mp->m_dalign;
......
...@@ -712,7 +712,7 @@ xfs_ialloc_ag_alloc( ...@@ -712,7 +712,7 @@ xfs_ialloc_ag_alloc(
*/ */
isaligned = 0; isaligned = 0;
if (igeo->ialloc_align) { if (igeo->ialloc_align) {
ASSERT(!(args.mp->m_flags & XFS_MOUNT_NOALIGN)); ASSERT(!xfs_has_noalign(args.mp));
args.alignment = args.mp->m_dalign; args.alignment = args.mp->m_dalign;
isaligned = 1; isaligned = 1;
} else } else
...@@ -1953,8 +1953,7 @@ xfs_difree_inobt( ...@@ -1953,8 +1953,7 @@ xfs_difree_inobt(
* remove the chunk if the block size is large enough for multiple inode * remove the chunk if the block size is large enough for multiple inode
* chunks (that might not be free). * chunks (that might not be free).
*/ */
if (!(mp->m_flags & XFS_MOUNT_IKEEP) && if (!xfs_has_ikeep(mp) && rec.ir_free == XFS_INOBT_ALL_FREE &&
rec.ir_free == XFS_INOBT_ALL_FREE &&
mp->m_sb.sb_inopblock <= XFS_INODES_PER_CHUNK) { mp->m_sb.sb_inopblock <= XFS_INODES_PER_CHUNK) {
struct xfs_perag *pag = agbp->b_pag; struct xfs_perag *pag = agbp->b_pag;
...@@ -2098,9 +2097,8 @@ xfs_difree_finobt( ...@@ -2098,9 +2097,8 @@ xfs_difree_finobt(
* enough for multiple chunks. Leave the finobt record to remain in sync * enough for multiple chunks. Leave the finobt record to remain in sync
* with the inobt. * with the inobt.
*/ */
if (rec.ir_free == XFS_INOBT_ALL_FREE && if (!xfs_has_ikeep(mp) && rec.ir_free == XFS_INOBT_ALL_FREE &&
mp->m_sb.sb_inopblock <= XFS_INODES_PER_CHUNK && mp->m_sb.sb_inopblock <= XFS_INODES_PER_CHUNK) {
!(mp->m_flags & XFS_MOUNT_IKEEP)) {
error = xfs_btree_delete(cur, &i); error = xfs_btree_delete(cur, &i);
if (error) if (error)
goto error; goto error;
......
...@@ -480,7 +480,7 @@ xfs_scrub_metadata( ...@@ -480,7 +480,7 @@ xfs_scrub_metadata(
if (XFS_FORCED_SHUTDOWN(mp)) if (XFS_FORCED_SHUTDOWN(mp))
goto out; goto out;
error = -ENOTRECOVERABLE; error = -ENOTRECOVERABLE;
if (mp->m_flags & XFS_MOUNT_NORECOVERY) if (xfs_has_norecovery(mp))
goto out; goto out;
error = xchk_validate_inputs(mp, sm); error = xchk_validate_inputs(mp, sm);
......
...@@ -232,7 +232,7 @@ xfs_acl_set_mode( ...@@ -232,7 +232,7 @@ xfs_acl_set_mode(
inode->i_ctime = current_time(inode); inode->i_ctime = current_time(inode);
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
if (mp->m_flags & XFS_MOUNT_WSYNC) if (xfs_has_wsync(mp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
return xfs_trans_commit(tp); return xfs_trans_commit(tp);
} }
......
...@@ -1822,7 +1822,7 @@ xfs_swap_extents( ...@@ -1822,7 +1822,7 @@ xfs_swap_extents(
* If this is a synchronous mount, make sure that the * If this is a synchronous mount, make sure that the
* transaction goes to disk before returning to the user. * transaction goes to disk before returning to the user.
*/ */
if (mp->m_flags & XFS_MOUNT_WSYNC) if (xfs_has_wsync(mp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
error = xfs_trans_commit(tp); error = xfs_trans_commit(tp);
......
...@@ -169,7 +169,7 @@ xfs_ioc_trim( ...@@ -169,7 +169,7 @@ xfs_ioc_trim(
* We haven't recovered the log, so we cannot use our bnobt-guided * We haven't recovered the log, so we cannot use our bnobt-guided
* storage zapping commands. * storage zapping commands.
*/ */
if (mp->m_flags & XFS_MOUNT_NORECOVERY) if (xfs_has_norecovery(mp))
return -EROFS; return -EROFS;
if (copy_from_user(&range, urange, sizeof(range))) if (copy_from_user(&range, urange, sizeof(range)))
......
...@@ -63,7 +63,7 @@ xfs_fs_encode_fh( ...@@ -63,7 +63,7 @@ xfs_fs_encode_fh(
* large enough filesystem may contain them, thus the slightly * large enough filesystem may contain them, thus the slightly
* confusing looking conditional below. * confusing looking conditional below.
*/ */
if (!(XFS_M(inode->i_sb)->m_flags & XFS_MOUNT_SMALL_INUMS) || if (!xfs_has_small_inums(XFS_M(inode->i_sb)) ||
(XFS_M(inode->i_sb)->m_flags & XFS_MOUNT_32BITINODES)) (XFS_M(inode->i_sb)->m_flags & XFS_MOUNT_32BITINODES))
fileid_type |= XFS_FILEID_TYPE_64FLAG; fileid_type |= XFS_FILEID_TYPE_64FLAG;
......
...@@ -1122,7 +1122,7 @@ static inline bool xfs_file_sync_writes(struct file *filp) ...@@ -1122,7 +1122,7 @@ static inline bool xfs_file_sync_writes(struct file *filp)
{ {
struct xfs_inode *ip = XFS_I(file_inode(filp)); struct xfs_inode *ip = XFS_I(file_inode(filp));
if (ip->i_mount->m_flags & XFS_MOUNT_WSYNC) if (xfs_has_wsync(ip->i_mount))
return true; return true;
if (filp->f_flags & (__O_SYNC | O_DSYNC)) if (filp->f_flags & (__O_SYNC | O_DSYNC))
return true; return true;
......
...@@ -21,7 +21,7 @@ static inline int ...@@ -21,7 +21,7 @@ static inline int
xfs_inode_is_filestream( xfs_inode_is_filestream(
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
return (ip->i_mount->m_flags & XFS_MOUNT_FILESTREAMS) || return xfs_has_filestreams(ip->i_mount) ||
(ip->i_diflags & XFS_DIFLAG_FILESTREAM); (ip->i_diflags & XFS_DIFLAG_FILESTREAM);
} }
......
...@@ -602,7 +602,7 @@ xfs_iget_cache_miss( ...@@ -602,7 +602,7 @@ xfs_iget_cache_miss(
/* /*
* For version 5 superblocks, if we are initialising a new inode and we * For version 5 superblocks, if we are initialising a new inode and we
* are not utilising the XFS_MOUNT_IKEEP inode cluster mode, we can * are not utilising the XFS_FEAT_IKEEP inode cluster mode, we can
* simply build the new inode core with a random generation number. * simply build the new inode core with a random generation number.
* *
* For version 4 (and older) superblocks, log recovery is dependent on * For version 4 (and older) superblocks, log recovery is dependent on
...@@ -611,7 +611,7 @@ xfs_iget_cache_miss( ...@@ -611,7 +611,7 @@ xfs_iget_cache_miss(
* initializing new inodes. * initializing new inodes.
*/ */
if (xfs_has_v3inodes(mp) && if (xfs_has_v3inodes(mp) &&
(flags & XFS_IGET_CREATE) && !(mp->m_flags & XFS_MOUNT_IKEEP)) { (flags & XFS_IGET_CREATE) && !xfs_has_ikeep(mp)) {
VFS_I(ip)->i_generation = prandom_u32(); VFS_I(ip)->i_generation = prandom_u32();
} else { } else {
struct xfs_buf *bp; struct xfs_buf *bp;
...@@ -967,8 +967,7 @@ static inline bool ...@@ -967,8 +967,7 @@ static inline bool
xfs_want_reclaim_sick( xfs_want_reclaim_sick(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
return (mp->m_flags & XFS_MOUNT_UNMOUNTING) || return (mp->m_flags & XFS_MOUNT_UNMOUNTING) || xfs_has_norecovery(mp) ||
(mp->m_flags & XFS_MOUNT_NORECOVERY) ||
XFS_FORCED_SHUTDOWN(mp); XFS_FORCED_SHUTDOWN(mp);
} }
......
...@@ -826,8 +826,7 @@ xfs_init_new_inode( ...@@ -826,8 +826,7 @@ xfs_init_new_inode(
inode->i_rdev = rdev; inode->i_rdev = rdev;
ip->i_projid = prid; ip->i_projid = prid;
if (dir && !(dir->i_mode & S_ISGID) && if (dir && !(dir->i_mode & S_ISGID) && xfs_has_grpid(mp)) {
(mp->m_flags & XFS_MOUNT_GRPID)) {
inode_fsuid_set(inode, mnt_userns); inode_fsuid_set(inode, mnt_userns);
inode->i_gid = dir->i_gid; inode->i_gid = dir->i_gid;
inode->i_mode = mode; inode->i_mode = mode;
...@@ -1068,7 +1067,7 @@ xfs_create( ...@@ -1068,7 +1067,7 @@ xfs_create(
* create transaction goes to disk before returning to * create transaction goes to disk before returning to
* the user. * the user.
*/ */
if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) if (xfs_has_wsync(mp) || xfs_has_dirsync(mp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
/* /*
...@@ -1160,7 +1159,7 @@ xfs_create_tmpfile( ...@@ -1160,7 +1159,7 @@ xfs_create_tmpfile(
if (error) if (error)
goto out_trans_cancel; goto out_trans_cancel;
if (mp->m_flags & XFS_MOUNT_WSYNC) if (xfs_has_wsync(mp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
/* /*
...@@ -1294,7 +1293,7 @@ xfs_link( ...@@ -1294,7 +1293,7 @@ xfs_link(
* link transaction goes to disk before returning to * link transaction goes to disk before returning to
* the user. * the user.
*/ */
if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) if (xfs_has_wsync(mp) || xfs_has_dirsync(mp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
return xfs_trans_commit(tp); return xfs_trans_commit(tp);
...@@ -1679,7 +1678,7 @@ xfs_inode_needs_inactive( ...@@ -1679,7 +1678,7 @@ xfs_inode_needs_inactive(
return false; return false;
/* If the log isn't running, push inodes straight to reclaim. */ /* If the log isn't running, push inodes straight to reclaim. */
if (XFS_FORCED_SHUTDOWN(mp) || (mp->m_flags & XFS_MOUNT_NORECOVERY)) if (XFS_FORCED_SHUTDOWN(mp) || xfs_has_norecovery(mp))
return false; return false;
/* Metadata inodes require explicit resource cleanup. */ /* Metadata inodes require explicit resource cleanup. */
...@@ -2855,7 +2854,7 @@ xfs_remove( ...@@ -2855,7 +2854,7 @@ xfs_remove(
* remove transaction goes to disk before returning to * remove transaction goes to disk before returning to
* the user. * the user.
*/ */
if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) if (xfs_has_wsync(mp) || xfs_has_dirsync(mp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
error = xfs_trans_commit(tp); error = xfs_trans_commit(tp);
...@@ -2932,7 +2931,7 @@ xfs_finish_rename( ...@@ -2932,7 +2931,7 @@ xfs_finish_rename(
* If this is a synchronous mount, make sure that the rename transaction * If this is a synchronous mount, make sure that the rename transaction
* goes to disk before returning to the user. * goes to disk before returning to the user.
*/ */
if (tp->t_mountp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) if (xfs_has_wsync(tp->t_mountp) || xfs_has_dirsync(tp->t_mountp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
return xfs_trans_commit(tp); return xfs_trans_commit(tp);
......
...@@ -400,8 +400,7 @@ enum layout_break_reason { ...@@ -400,8 +400,7 @@ enum layout_break_reason {
* new subdirectory gets S_ISGID bit from parent. * new subdirectory gets S_ISGID bit from parent.
*/ */
#define XFS_INHERIT_GID(pip) \ #define XFS_INHERIT_GID(pip) \
(((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \ (xfs_has_grpid((pip)->i_mount) || (VFS_I(pip)->i_mode & S_ISGID))
(VFS_I(pip)->i_mode & S_ISGID))
int xfs_release(struct xfs_inode *ip); int xfs_release(struct xfs_inode *ip);
void xfs_inactive(struct xfs_inode *ip); void xfs_inactive(struct xfs_inode *ip);
......
...@@ -1237,8 +1237,7 @@ xfs_ioctl_setattr_prepare_dax( ...@@ -1237,8 +1237,7 @@ xfs_ioctl_setattr_prepare_dax(
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
return; return;
if ((mp->m_flags & XFS_MOUNT_DAX_ALWAYS) || if (xfs_has_dax_always(mp) || xfs_has_dax_never(mp))
(mp->m_flags & XFS_MOUNT_DAX_NEVER))
return; return;
if (((fa->fsx_xflags & FS_XFLAG_DAX) && if (((fa->fsx_xflags & FS_XFLAG_DAX) &&
...@@ -1274,7 +1273,7 @@ xfs_ioctl_setattr_get_trans( ...@@ -1274,7 +1273,7 @@ xfs_ioctl_setattr_get_trans(
if (error) if (error)
goto out_error; goto out_error;
if (mp->m_flags & XFS_MOUNT_WSYNC) if (xfs_has_wsync(mp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
return tp; return tp;
......
...@@ -132,7 +132,7 @@ xfs_eof_alignment( ...@@ -132,7 +132,7 @@ xfs_eof_alignment(
* If mounted with the "-o swalloc" option the alignment is * If mounted with the "-o swalloc" option the alignment is
* increased from the strip unit size to the stripe width. * increased from the strip unit size to the stripe width.
*/ */
if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC)) if (mp->m_swidth && xfs_has_swalloc(mp))
align = mp->m_swidth; align = mp->m_swidth;
else if (mp->m_dalign) else if (mp->m_dalign)
align = mp->m_dalign; align = mp->m_dalign;
...@@ -994,7 +994,7 @@ xfs_buffered_write_iomap_begin( ...@@ -994,7 +994,7 @@ xfs_buffered_write_iomap_begin(
* Determine the initial size of the preallocation. * Determine the initial size of the preallocation.
* We clean up any extra preallocation when the file is closed. * We clean up any extra preallocation when the file is closed.
*/ */
if (mp->m_flags & XFS_MOUNT_ALLOCSIZE) if (xfs_has_allocsize(mp))
prealloc_blocks = mp->m_allocsize_blocks; prealloc_blocks = mp->m_allocsize_blocks;
else else
prealloc_blocks = xfs_iomap_prealloc_size(ip, allocfork, prealloc_blocks = xfs_iomap_prealloc_size(ip, allocfork,
......
...@@ -558,10 +558,10 @@ xfs_stat_blksize( ...@@ -558,10 +558,10 @@ xfs_stat_blksize(
* default buffered I/O size, return that, otherwise return the compat * default buffered I/O size, return that, otherwise return the compat
* default. * default.
*/ */
if (mp->m_flags & XFS_MOUNT_LARGEIO) { if (xfs_has_large_iosize(mp)) {
if (mp->m_swidth) if (mp->m_swidth)
return XFS_FSB_TO_B(mp, mp->m_swidth); return XFS_FSB_TO_B(mp, mp->m_swidth);
if (mp->m_flags & XFS_MOUNT_ALLOCSIZE) if (xfs_has_allocsize(mp))
return 1U << mp->m_allocsize_log; return 1U << mp->m_allocsize_log;
} }
...@@ -808,7 +808,7 @@ xfs_setattr_nonsize( ...@@ -808,7 +808,7 @@ xfs_setattr_nonsize(
XFS_STATS_INC(mp, xs_ig_attrchg); XFS_STATS_INC(mp, xs_ig_attrchg);
if (mp->m_flags & XFS_MOUNT_WSYNC) if (xfs_has_wsync(mp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
error = xfs_trans_commit(tp); error = xfs_trans_commit(tp);
...@@ -1037,7 +1037,7 @@ xfs_setattr_size( ...@@ -1037,7 +1037,7 @@ xfs_setattr_size(
XFS_STATS_INC(mp, xs_ig_attrchg); XFS_STATS_INC(mp, xs_ig_attrchg);
if (mp->m_flags & XFS_MOUNT_WSYNC) if (xfs_has_wsync(mp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
error = xfs_trans_commit(tp); error = xfs_trans_commit(tp);
...@@ -1287,11 +1287,11 @@ xfs_inode_should_enable_dax( ...@@ -1287,11 +1287,11 @@ xfs_inode_should_enable_dax(
{ {
if (!IS_ENABLED(CONFIG_FS_DAX)) if (!IS_ENABLED(CONFIG_FS_DAX))
return false; return false;
if (ip->i_mount->m_flags & XFS_MOUNT_DAX_NEVER) if (xfs_has_dax_never(ip->i_mount))
return false; return false;
if (!xfs_inode_supports_dax(ip)) if (!xfs_inode_supports_dax(ip))
return false; return false;
if (ip->i_mount->m_flags & XFS_MOUNT_DAX_ALWAYS) if (xfs_has_dax_always(ip->i_mount))
return true; return true;
if (ip->i_diflags2 & XFS_DIFLAG2_DAX) if (ip->i_diflags2 & XFS_DIFLAG2_DAX)
return true; return true;
......
...@@ -356,7 +356,7 @@ xfs_log_writable( ...@@ -356,7 +356,7 @@ xfs_log_writable(
* mounts allow internal writes for log recovery and unmount purposes, * mounts allow internal writes for log recovery and unmount purposes,
* so don't restrict that case. * so don't restrict that case.
*/ */
if (mp->m_flags & XFS_MOUNT_NORECOVERY) if (xfs_has_norecovery(mp))
return false; return false;
if (xfs_readonly_buftarg(mp->m_ddev_targp)) if (xfs_readonly_buftarg(mp->m_ddev_targp))
return false; return false;
...@@ -633,7 +633,7 @@ xfs_log_mount( ...@@ -633,7 +633,7 @@ xfs_log_mount(
int error = 0; int error = 0;
int min_logfsbs; int min_logfsbs;
if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) { if (!xfs_has_norecovery(mp)) {
xfs_notice(mp, "Mounting V%d Filesystem", xfs_notice(mp, "Mounting V%d Filesystem",
XFS_SB_VERSION_NUM(&mp->m_sb)); XFS_SB_VERSION_NUM(&mp->m_sb));
} else { } else {
...@@ -719,8 +719,8 @@ xfs_log_mount( ...@@ -719,8 +719,8 @@ xfs_log_mount(
* skip log recovery on a norecovery mount. pretend it all * skip log recovery on a norecovery mount. pretend it all
* just worked. * just worked.
*/ */
if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) { if (!xfs_has_norecovery(mp)) {
int readonly = (mp->m_flags & XFS_MOUNT_RDONLY); bool readonly = (mp->m_flags & XFS_MOUNT_RDONLY);
if (readonly) if (readonly)
mp->m_flags &= ~XFS_MOUNT_RDONLY; mp->m_flags &= ~XFS_MOUNT_RDONLY;
...@@ -780,8 +780,8 @@ xfs_log_mount_finish( ...@@ -780,8 +780,8 @@ xfs_log_mount_finish(
bool readonly = (mp->m_flags & XFS_MOUNT_RDONLY); bool readonly = (mp->m_flags & XFS_MOUNT_RDONLY);
int error = 0; int error = 0;
if (mp->m_flags & XFS_MOUNT_NORECOVERY) { if (xfs_has_norecovery(mp)) {
ASSERT(mp->m_flags & XFS_MOUNT_RDONLY); ASSERT(readonly);
return 0; return 0;
} else if (readonly) { } else if (readonly) {
/* Allow unlinked processing to proceed */ /* Allow unlinked processing to proceed */
...@@ -3941,7 +3941,7 @@ xfs_log_check_lsn( ...@@ -3941,7 +3941,7 @@ xfs_log_check_lsn(
* resets the in-core LSN. We can't validate in this mode, but * resets the in-core LSN. We can't validate in this mode, but
* modifications are not allowed anyways so just return true. * modifications are not allowed anyways so just return true.
*/ */
if (mp->m_flags & XFS_MOUNT_NORECOVERY) if (xfs_has_norecovery(mp))
return true; return true;
/* /*
......
...@@ -571,7 +571,7 @@ xlog_discard_busy_extents( ...@@ -571,7 +571,7 @@ xlog_discard_busy_extents(
struct blk_plug plug; struct blk_plug plug;
int error = 0; int error = 0;
ASSERT(mp->m_flags & XFS_MOUNT_DISCARD); ASSERT(xfs_has_discard(mp));
blk_start_plug(&plug); blk_start_plug(&plug);
list_for_each_entry(busyp, list, list) { list_for_each_entry(busyp, list, list) {
...@@ -633,7 +633,7 @@ xlog_cil_committed( ...@@ -633,7 +633,7 @@ xlog_cil_committed(
xfs_extent_busy_sort(&ctx->busy_extents); xfs_extent_busy_sort(&ctx->busy_extents);
xfs_extent_busy_clear(mp, &ctx->busy_extents, xfs_extent_busy_clear(mp, &ctx->busy_extents,
(mp->m_flags & XFS_MOUNT_DISCARD) && !abort); xfs_has_discard(mp) && !abort);
spin_lock(&ctx->cil->xc_push_lock); spin_lock(&ctx->cil->xc_push_lock);
list_del(&ctx->committing); list_del(&ctx->committing);
......
...@@ -62,7 +62,7 @@ xfs_uuid_mount( ...@@ -62,7 +62,7 @@ xfs_uuid_mount(
/* Publish UUID in struct super_block */ /* Publish UUID in struct super_block */
uuid_copy(&mp->m_super->s_uuid, uuid); uuid_copy(&mp->m_super->s_uuid, uuid);
if (mp->m_flags & XFS_MOUNT_NOUUID) if (xfs_has_nouuid(mp))
return 0; return 0;
if (uuid_is_null(uuid)) { if (uuid_is_null(uuid)) {
...@@ -104,7 +104,7 @@ xfs_uuid_unmount( ...@@ -104,7 +104,7 @@ xfs_uuid_unmount(
uuid_t *uuid = &mp->m_sb.sb_uuid; uuid_t *uuid = &mp->m_sb.sb_uuid;
int i; int i;
if (mp->m_flags & XFS_MOUNT_NOUUID) if (xfs_has_nouuid(mp))
return; return;
mutex_lock(&xfs_uuid_table_mutex); mutex_lock(&xfs_uuid_table_mutex);
...@@ -350,8 +350,7 @@ xfs_update_alignment( ...@@ -350,8 +350,7 @@ xfs_update_alignment(
sbp->sb_unit = mp->m_dalign; sbp->sb_unit = mp->m_dalign;
sbp->sb_width = mp->m_swidth; sbp->sb_width = mp->m_swidth;
mp->m_update_sb = true; mp->m_update_sb = true;
} else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN && } else if (!xfs_has_noalign(mp) && xfs_has_dalign(mp)) {
xfs_has_dalign(mp)) {
mp->m_dalign = sbp->sb_unit; mp->m_dalign = sbp->sb_unit;
mp->m_swidth = sbp->sb_width; mp->m_swidth = sbp->sb_width;
} }
...@@ -783,12 +782,15 @@ xfs_mountfs( ...@@ -783,12 +782,15 @@ xfs_mountfs(
/* /*
* Now that we've recovered any pending superblock feature bit * Now that we've recovered any pending superblock feature bit
* additions, we can finish setting up the attr2 behaviour for the * additions, we can finish setting up the attr2 behaviour for the
* mount. If no attr2 mount options were specified, the we use the * mount. The noattr2 option overrides the superblock flag, so only
* behaviour specified by the superblock feature bit. * check the superblock feature flag if the mount option is not set.
*/ */
if (!(mp->m_flags & (XFS_MOUNT_ATTR2|XFS_MOUNT_NOATTR2)) && if (xfs_has_noattr2(mp)) {
xfs_has_attr2(mp)) mp->m_features &= ~XFS_FEAT_ATTR2;
mp->m_flags |= XFS_MOUNT_ATTR2; } else if (!xfs_has_attr2(mp) &&
(mp->m_sb.sb_features2 & XFS_SB_VERSION2_ATTR2BIT)) {
mp->m_features |= XFS_FEAT_ATTR2;
}
/* /*
* Get and sanity-check the root inode. * Get and sanity-check the root inode.
...@@ -890,10 +892,8 @@ xfs_mountfs( ...@@ -890,10 +892,8 @@ xfs_mountfs(
* We use the same quiesce mechanism as the rw->ro remount, as they are * We use the same quiesce mechanism as the rw->ro remount, as they are
* semantically identical operations. * semantically identical operations.
*/ */
if ((mp->m_flags & (XFS_MOUNT_RDONLY|XFS_MOUNT_NORECOVERY)) == if ((mp->m_flags & XFS_MOUNT_RDONLY) && !xfs_has_norecovery(mp))
XFS_MOUNT_RDONLY) {
xfs_log_clean(mp); xfs_log_clean(mp);
}
/* /*
* Complete the quota initialisation, post-log-replay component. * Complete the quota initialisation, post-log-replay component.
......
...@@ -370,32 +370,12 @@ __XFS_HAS_FEAT(nouuid, NOUUID) ...@@ -370,32 +370,12 @@ __XFS_HAS_FEAT(nouuid, NOUUID)
must be synchronous except must be synchronous except
for space allocations */ for space allocations */
#define XFS_MOUNT_UNMOUNTING (1ULL << 1) /* filesystem is unmounting */ #define XFS_MOUNT_UNMOUNTING (1ULL << 1) /* filesystem is unmounting */
#define XFS_MOUNT_WAS_CLEAN (1ULL << 3) #define XFS_MOUNT_WAS_CLEAN (1ULL << 2)
#define XFS_MOUNT_FS_SHUTDOWN (1ULL << 4) /* atomic stop of all filesystem #define XFS_MOUNT_FS_SHUTDOWN (1ULL << 3) /* atomic stop of all filesystem
operations, typically for operations, typically for
disk errors in metadata */ disk errors in metadata */
#define XFS_MOUNT_DISCARD (1ULL << 5) /* discard unused blocks */
#define XFS_MOUNT_NOALIGN (1ULL << 7) /* turn off stripe alignment
allocations */
#define XFS_MOUNT_ATTR2 (1ULL << 8) /* allow use of attr2 format */
#define XFS_MOUNT_GRPID (1ULL << 9) /* group-ID assigned from directory */
#define XFS_MOUNT_NORECOVERY (1ULL << 10) /* no recovery - dirty fs */
#define XFS_MOUNT_ALLOCSIZE (1ULL << 12) /* specified allocation size */
#define XFS_MOUNT_SMALL_INUMS (1ULL << 14) /* user wants 32bit inodes */
#define XFS_MOUNT_32BITINODES (1ULL << 15) /* inode32 allocator active */ #define XFS_MOUNT_32BITINODES (1ULL << 15) /* inode32 allocator active */
#define XFS_MOUNT_NOUUID (1ULL << 16) /* ignore uuid during mount */ #define XFS_MOUNT_RDONLY (1ULL << 4) /* read-only fs */
#define XFS_MOUNT_IKEEP (1ULL << 18) /* keep empty inode clusters*/
#define XFS_MOUNT_SWALLOC (1ULL << 19) /* turn on stripe width
* allocation */
#define XFS_MOUNT_RDONLY (1ULL << 20) /* read-only fs */
#define XFS_MOUNT_DIRSYNC (1ULL << 21) /* synchronous directory ops */
#define XFS_MOUNT_LARGEIO (1ULL << 22) /* report large preferred
* I/O size in stat() */
#define XFS_MOUNT_FILESTREAMS (1ULL << 24) /* enable the filestreams
allocator */
#define XFS_MOUNT_NOATTR2 (1ULL << 25) /* disable use of attr2 format */
#define XFS_MOUNT_DAX_ALWAYS (1ULL << 26)
#define XFS_MOUNT_DAX_NEVER (1ULL << 27)
/* /*
* If set, inactivation worker threads will be scheduled to process queued * If set, inactivation worker threads will be scheduled to process queued
......
This diff is collapsed.
...@@ -321,9 +321,8 @@ xfs_symlink( ...@@ -321,9 +321,8 @@ xfs_symlink(
* symlink transaction goes to disk before returning to * symlink transaction goes to disk before returning to
* the user. * the user.
*/ */
if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) { if (xfs_has_wsync(mp) || xfs_has_dirsync(mp))
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
}
error = xfs_trans_commit(tp); error = xfs_trans_commit(tp);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment