[PATCH] Implictly set PROJID32BIT features2 bit when using 32bit project ids.
Arkadiusz Miśkiewicz
arekm at maven.pl
Thu Aug 26 01:49:11 CDT 2010
Set PROJID32BIT automaticly when trying to use 32bit quota project
identificator instead of requiring user to do that manually.
Signed-off-by: Arkadiusz Miśkiewicz <arekm at maven.pl>
---
fs/xfs/linux-2.6/xfs_ioctl.c | 17 ++++++++++++-----
fs/xfs/xfs_sb.h | 6 ++++++
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 6bc432f..285eeef 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -906,11 +906,6 @@ xfs_ioctl_setattr(
if (XFS_FORCED_SHUTDOWN(mp))
return XFS_ERROR(EIO);
- /* Make sure userspace passed projid will fit on disk */
- if (!xfs_sb_version_hasprojid32bit(&ip->i_mount->m_sb) &&
- fa->fsx_projid > (__uint16_t)-1)
- return XFS_ERROR(EINVAL);
-
/*
* If disk quotas is on, we make sure that the dquots do exist on disk,
* before we start any other transactions. Trying to do this later
@@ -951,6 +946,18 @@ xfs_ioctl_setattr(
goto error_return;
}
+ /* Switch on the PROJID32BIT superblock bit (implies also FEATURES2) */
+ if (!xfs_sb_version_hasprojid32bit(&ip->i_mount->m_sb) &&
+ fa->fsx_projid > (__uint16_t)-1) {
+ spin_lock(&ip->i_mount->m_sb_lock);
+ if (!xfs_sb_version_hasprojid32bit(&ip->i_mount->m_sb)) {
+ xfs_sb_version_addprojid32bit(&ip->i_mount->m_sb);
+ spin_unlock(&ip->i_mount->m_sb_lock);
+ xfs_mod_sb(tp, XFS_SB_VERSIONNUM | XFS_SB_FEATURES2);
+ } else
+ spin_unlock(&ip->i_mount->m_sb_lock);
+ }
+
/*
* Do a quota reservation only if projid is actually going to change.
*/
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h
index fe5b23c..bc3dc77 100644
--- a/fs/xfs/xfs_sb.h
+++ b/fs/xfs/xfs_sb.h
@@ -503,6 +503,12 @@ static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp)
(sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT);
}
+static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp)
+{
+ sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
+ sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT;
+}
+
/*
* end of superblock version macros
*/
--
1.7.1.1
More information about the xfs
mailing list