Commit 13059ff0 authored by Nathan Scott's avatar Nathan Scott

[XFS] Reverse the sense of COMPAT_ATTR and ATTR2, keeps it simple and

consistent.

SGI-PV: 941645
SGI-Modid: xfs-linux-melb:xfs-kern:202961a
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent e13a73f0
...@@ -128,7 +128,7 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes) ...@@ -128,7 +128,7 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes)
return (offset >= minforkoff) ? minforkoff : 0; return (offset >= minforkoff) ? minforkoff : 0;
} }
if (unlikely(mp->m_flags & XFS_MOUNT_COMPAT_ATTR)) { if (!(mp->m_flags & XFS_MOUNT_ATTR2)) {
if (bytes <= XFS_IFORK_ASIZE(dp)) if (bytes <= XFS_IFORK_ASIZE(dp))
return mp->m_attroffset >> 3; return mp->m_attroffset >> 3;
return 0; return 0;
...@@ -157,7 +157,7 @@ xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp) ...@@ -157,7 +157,7 @@ xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp)
{ {
unsigned long s; unsigned long s;
if (!(mp->m_flags & XFS_MOUNT_COMPAT_ATTR) && if ((mp->m_flags & XFS_MOUNT_ATTR2) &&
!(XFS_SB_VERSION_HASATTR2(&mp->m_sb))) { !(XFS_SB_VERSION_HASATTR2(&mp->m_sb))) {
s = XFS_SB_LOCK(mp); s = XFS_SB_LOCK(mp);
if (!XFS_SB_VERSION_HASATTR2(&mp->m_sb)) { if (!XFS_SB_VERSION_HASATTR2(&mp->m_sb)) {
...@@ -311,7 +311,7 @@ xfs_attr_shortform_remove(xfs_da_args_t *args) ...@@ -311,7 +311,7 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
*/ */
totsize -= size; totsize -= size;
if (totsize == sizeof(xfs_attr_sf_hdr_t) && !args->addname && if (totsize == sizeof(xfs_attr_sf_hdr_t) && !args->addname &&
!(mp->m_flags & XFS_MOUNT_COMPAT_ATTR)) { (mp->m_flags & XFS_MOUNT_ATTR2)) {
/* /*
* Last attribute now removed, revert to original * Last attribute now removed, revert to original
* inode format making all literal area available * inode format making all literal area available
...@@ -330,7 +330,7 @@ xfs_attr_shortform_remove(xfs_da_args_t *args) ...@@ -330,7 +330,7 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize); dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize);
ASSERT(dp->i_d.di_forkoff); ASSERT(dp->i_d.di_forkoff);
ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) || args->addname || ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) || args->addname ||
(mp->m_flags & XFS_MOUNT_COMPAT_ATTR)); !(mp->m_flags & XFS_MOUNT_ATTR2));
dp->i_afp->if_ext_max = dp->i_afp->if_ext_max =
XFS_IFORK_ASIZE(dp) / (uint)sizeof(xfs_bmbt_rec_t); XFS_IFORK_ASIZE(dp) / (uint)sizeof(xfs_bmbt_rec_t);
dp->i_df.if_ext_max = dp->i_df.if_ext_max =
...@@ -739,7 +739,7 @@ xfs_attr_shortform_allfit(xfs_dabuf_t *bp, xfs_inode_t *dp) ...@@ -739,7 +739,7 @@ xfs_attr_shortform_allfit(xfs_dabuf_t *bp, xfs_inode_t *dp)
+ name_loc->namelen + name_loc->namelen
+ INT_GET(name_loc->valuelen, ARCH_CONVERT); + INT_GET(name_loc->valuelen, ARCH_CONVERT);
} }
if (!(dp->i_mount->m_flags & XFS_MOUNT_COMPAT_ATTR) && if ((dp->i_mount->m_flags & XFS_MOUNT_ATTR2) &&
(bytes == sizeof(struct xfs_attr_sf_hdr))) (bytes == sizeof(struct xfs_attr_sf_hdr)))
return(-1); return(-1);
return(xfs_attr_shortform_bytesfit(dp, bytes)); return(xfs_attr_shortform_bytesfit(dp, bytes));
...@@ -778,7 +778,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff) ...@@ -778,7 +778,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
goto out; goto out;
if (forkoff == -1) { if (forkoff == -1) {
ASSERT(!(dp->i_mount->m_flags & XFS_MOUNT_COMPAT_ATTR)); ASSERT(dp->i_mount->m_flags & XFS_MOUNT_ATTR2);
/* /*
* Last attribute was removed, revert to original * Last attribute was removed, revert to original
......
...@@ -3948,7 +3948,7 @@ xfs_bmap_add_attrfork( ...@@ -3948,7 +3948,7 @@ xfs_bmap_add_attrfork(
ip->i_d.di_forkoff = xfs_attr_shortform_bytesfit(ip, size); ip->i_d.di_forkoff = xfs_attr_shortform_bytesfit(ip, size);
if (!ip->i_d.di_forkoff) if (!ip->i_d.di_forkoff)
ip->i_d.di_forkoff = mp->m_attroffset >> 3; ip->i_d.di_forkoff = mp->m_attroffset >> 3;
else if (!(mp->m_flags & XFS_MOUNT_COMPAT_ATTR)) else if (mp->m_flags & XFS_MOUNT_ATTR2)
version = 2; version = 2;
break; break;
default: default:
...@@ -4096,13 +4096,13 @@ xfs_bmap_compute_maxlevels( ...@@ -4096,13 +4096,13 @@ xfs_bmap_compute_maxlevels(
*/ */
if (whichfork == XFS_DATA_FORK) { if (whichfork == XFS_DATA_FORK) {
maxleafents = MAXEXTNUM; maxleafents = MAXEXTNUM;
sz = (mp->m_flags & XFS_MOUNT_COMPAT_ATTR) ? sz = (mp->m_flags & XFS_MOUNT_ATTR2) ?
mp->m_attroffset : XFS_BMDR_SPACE_CALC(MINDBTPTRS); XFS_BMDR_SPACE_CALC(MINDBTPTRS) : mp->m_attroffset;
} else { } else {
maxleafents = MAXAEXTNUM; maxleafents = MAXAEXTNUM;
sz = (mp->m_flags & XFS_MOUNT_COMPAT_ATTR) ? sz = (mp->m_flags & XFS_MOUNT_ATTR2) ?
mp->m_sb.sb_inodesize - mp->m_attroffset : XFS_BMDR_SPACE_CALC(MINABTPTRS) :
XFS_BMDR_SPACE_CALC(MINABTPTRS); mp->m_sb.sb_inodesize - mp->m_attroffset;
} }
maxrootrecs = (int)XFS_BTREE_BLOCK_MAXRECS(sz, xfs_bmdr, 0); maxrootrecs = (int)XFS_BTREE_BLOCK_MAXRECS(sz, xfs_bmdr, 0);
minleafrecs = mp->m_bmap_dmnr[0]; minleafrecs = mp->m_bmap_dmnr[0];
......
...@@ -57,7 +57,7 @@ struct xfs_mount_args { ...@@ -57,7 +57,7 @@ struct xfs_mount_args {
/* /*
* XFS mount option flags -- args->flags1 * XFS mount option flags -- args->flags1
*/ */
#define XFSMNT_COMPAT_ATTR 0x00000001 /* do not use ATTR2 format */ #define XFSMNT_ATTR2 0x00000001 /* allow ATTR2 EA format */
#define XFSMNT_WSYNC 0x00000002 /* safe mode nfs mount #define XFSMNT_WSYNC 0x00000002 /* safe mode nfs mount
* compatible */ * compatible */
#define XFSMNT_INO64 0x00000004 /* move inode numbers up #define XFSMNT_INO64 0x00000004 /* move inode numbers up
......
...@@ -176,7 +176,7 @@ xfs_dir_mount(xfs_mount_t *mp) ...@@ -176,7 +176,7 @@ xfs_dir_mount(xfs_mount_t *mp)
uint shortcount, leafcount, count; uint shortcount, leafcount, count;
mp->m_dirversion = 1; mp->m_dirversion = 1;
if (mp->m_flags & XFS_MOUNT_COMPAT_ATTR) { if (!(mp->m_flags & XFS_MOUNT_ATTR2)) {
shortcount = (mp->m_attroffset - shortcount = (mp->m_attroffset -
(uint)sizeof(xfs_dir_sf_hdr_t)) / (uint)sizeof(xfs_dir_sf_hdr_t)) /
(uint)sizeof(xfs_dir_sf_entry_t); (uint)sizeof(xfs_dir_sf_entry_t);
......
...@@ -393,7 +393,7 @@ typedef struct xfs_mount { ...@@ -393,7 +393,7 @@ typedef struct xfs_mount {
user */ user */
#define XFS_MOUNT_NOALIGN (1ULL << 7) /* turn off stripe alignment #define XFS_MOUNT_NOALIGN (1ULL << 7) /* turn off stripe alignment
allocations */ allocations */
#define XFS_MOUNT_COMPAT_ATTR (1ULL << 8) /* do not use attr2 format */ #define XFS_MOUNT_ATTR2 (1ULL << 8) /* allow use of attr2 format */
/* (1ULL << 9) -- currently unused */ /* (1ULL << 9) -- currently unused */
#define XFS_MOUNT_NORECOVERY (1ULL << 10) /* no recovery - dirty fs */ #define XFS_MOUNT_NORECOVERY (1ULL << 10) /* no recovery - dirty fs */
#define XFS_MOUNT_SHARED (1ULL << 11) /* shared mount */ #define XFS_MOUNT_SHARED (1ULL << 11) /* shared mount */
......
...@@ -291,8 +291,8 @@ xfs_start_flags( ...@@ -291,8 +291,8 @@ xfs_start_flags(
mp->m_flags |= XFS_MOUNT_IDELETE; mp->m_flags |= XFS_MOUNT_IDELETE;
if (ap->flags & XFSMNT_DIRSYNC) if (ap->flags & XFSMNT_DIRSYNC)
mp->m_flags |= XFS_MOUNT_DIRSYNC; mp->m_flags |= XFS_MOUNT_DIRSYNC;
if (ap->flags & XFSMNT_COMPAT_ATTR) if (ap->flags & XFSMNT_ATTR2)
mp->m_flags |= XFS_MOUNT_COMPAT_ATTR; mp->m_flags |= XFS_MOUNT_ATTR2;
if (ap->flags2 & XFSMNT2_COMPAT_IOSIZE) if (ap->flags2 & XFSMNT2_COMPAT_IOSIZE)
mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE; mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
...@@ -350,6 +350,10 @@ xfs_finish_flags( ...@@ -350,6 +350,10 @@ xfs_finish_flags(
} }
} }
if (XFS_SB_VERSION_HASATTR2(&mp->m_sb)) {
mp->m_flags |= XFS_MOUNT_ATTR2;
}
/* /*
* prohibit r/w mounts of read-only filesystems * prohibit r/w mounts of read-only filesystems
*/ */
...@@ -385,10 +389,6 @@ xfs_finish_flags( ...@@ -385,10 +389,6 @@ xfs_finish_flags(
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
if (XFS_SB_VERSION_HASATTR2(&mp->m_sb)) {
mp->m_flags &= ~XFS_MOUNT_COMPAT_ATTR;
}
return 0; return 0;
} }
...@@ -1690,7 +1690,6 @@ xfs_parseargs( ...@@ -1690,7 +1690,6 @@ xfs_parseargs(
int iosize; int iosize;
args->flags2 |= XFSMNT2_COMPAT_IOSIZE; args->flags2 |= XFSMNT2_COMPAT_IOSIZE;
args->flags |= XFSMNT_COMPAT_ATTR;
args->flags |= XFSMNT_BARRIER; args->flags |= XFSMNT_BARRIER;
#if 0 /* XXX: off by default, until some remaining issues ironed out */ #if 0 /* XXX: off by default, until some remaining issues ironed out */
...@@ -1828,9 +1827,9 @@ xfs_parseargs( ...@@ -1828,9 +1827,9 @@ xfs_parseargs(
} else if (!strcmp(this_char, MNTOPT_NOLARGEIO)) { } else if (!strcmp(this_char, MNTOPT_NOLARGEIO)) {
args->flags2 |= XFSMNT2_COMPAT_IOSIZE; args->flags2 |= XFSMNT2_COMPAT_IOSIZE;
} else if (!strcmp(this_char, MNTOPT_ATTR2)) { } else if (!strcmp(this_char, MNTOPT_ATTR2)) {
args->flags &= ~XFSMNT_COMPAT_ATTR; args->flags |= XFSMNT_ATTR2;
} else if (!strcmp(this_char, MNTOPT_NOATTR2)) { } else if (!strcmp(this_char, MNTOPT_NOATTR2)) {
args->flags |= XFSMNT_COMPAT_ATTR; args->flags &= ~XFSMNT_ATTR2;
} else if (!strcmp(this_char, "osyncisdsync")) { } else if (!strcmp(this_char, "osyncisdsync")) {
/* no-op, this is now the default */ /* no-op, this is now the default */
printk("XFS: osyncisdsync is now the default, option is deprecated.\n"); printk("XFS: osyncisdsync is now the default, option is deprecated.\n");
...@@ -1941,8 +1940,6 @@ xfs_showargs( ...@@ -1941,8 +1940,6 @@ xfs_showargs(
seq_printf(m, "," MNTOPT_SWIDTH "=%d", seq_printf(m, "," MNTOPT_SWIDTH "=%d",
(int)XFS_FSB_TO_BB(mp, mp->m_swidth)); (int)XFS_FSB_TO_BB(mp, mp->m_swidth));
if (!(mp->m_flags & XFS_MOUNT_COMPAT_ATTR))
seq_printf(m, "," MNTOPT_ATTR2);
if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)) if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE))
seq_printf(m, "," MNTOPT_LARGEIO); seq_printf(m, "," MNTOPT_LARGEIO);
if (!(mp->m_flags & XFS_MOUNT_BARRIER)) if (!(mp->m_flags & XFS_MOUNT_BARRIER))
......
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