Allow pquota and gquota to be used together
Subsystems (3)
v10 cover Allow pquota and gquota to be used together
Hello All,
This is the version 10 of the changes to allow pquota and gquota to be used together.
Patchset applies cleanly on top of 80a4049813a2ae0977d8e5db78e711c7f21c420b in xfs git tree.
Ran xfstests against it with DEBUG and do not see any regressions.
---
Chandra Seetharaman (11):
xfs: Define a new function xfs_is_quota_inode()
xfs: Replace macro XFS_DQUOT_TREE with a function
xfs: Replace macro XFS_DQ_TO_QIP with a function
xfs: Code cleanup and removal of some typedef usage
xfs: Do some whitespace cleanup in the data structure xfs_quotainfo
xfs: Change xfs_dquot_acct to be a 2-dimensional array
xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD
xfs: Add pquota fields where gquota is used.
xfs: Start using pquotaino from the superblock.
xfs: Add proper versioning support to fs_quota_stat
xfs: Use new qs_pquota field in fs_quota_stat for Q_XGETQSTAT
fs/gfs2/quota.c | 3 - fs/quota/quota.c | 49 +++++- fs/xfs/xfs_dquot.c | 31 ++- fs/xfs/xfs_dquot.h | 11 +- fs/xfs/xfs_fsops.c | 3 +- fs/xfs/xfs_icache.c | 4 +- fs/xfs/xfs_inode.h | 1 + fs/xfs/xfs_ioctl.c | 14 +- fs/xfs/xfs_iops.c | 4 +- fs/xfs/xfs_itable.c | 2 +- fs/xfs/xfs_mount.c | 83 ++++++++ fs/xfs/xfs_qm.c | 409 ++++++++++++++++++++++++++-------------- fs/xfs/xfs_qm.h | 143 +++++++++----- fs/xfs/xfs_qm_bhv.c | 2 +- fs/xfs/xfs_qm_syscalls.c | 126 ++++++++---- fs/xfs/xfs_quota.h | 79 +++++---- fs/xfs/xfs_quotaops.c | 6 +- fs/xfs/xfs_sb.h | 20 ++ fs/xfs/xfs_super.c | 35 ++-- fs/xfs/xfs_symlink.c | 13 +- fs/xfs/xfs_trans_dquot.c | 113 ++++++------ fs/xfs/xfs_vnodeops.c | 13 +- include/uapi/linux/dqblk_xfs.h | 54 +++++- 23 files changed, 821 insertions(+), 397 deletions(-)
---
Changes from version 9 to version 10:
- Split prep into 6 patches as per Ben and Dave's suggestion
- Added xfs_sb_quota_from_disk() as per Dave's suggestion
- Made u/g/p ordering consistent
- Fixed fields in fs_quota_stat as per Dave's suggestion
- Moved few ASSERTs to be inside error check as per Ben's suggestion
- Few cosmetic changes
Version 9 can be found at:
http://oss.sgi.com/archives/xfs/2013-06/msg00770.html
Changes from verion 8 to version 9:
- Made all the changes suggested by Dave
- Rearranged code to make the functional changes to not be cluttered.
Version 8 can be found at:
http://oss.sgi.com/archives/xfs/2013-05/msg00296.html
Changes from version 7 to version 8:
- Rebased to the current code.
- Modified code to use the new pquotino field in version 5 of the superblock.
Version 7 can be found at:
http://oss.sgi.com/archives/xfs/2013-03/msg00671.html
Changes from version 6 to version 7:
- Made all the changes suggested by Dave Chinner
- Added padding to fs_quota_stat, which made the new data structure field ordering different from the old data structure field ordering. So, copied the old version to be _v1 version and used that if old version of data structure was provided from user space.
Version 6 can be found at:
http://oss.sgi.com/archives/xfs/2012-07/msg00286.html
Changes from version 5 to version 6:
- Use radix tree instead of hash table
Version 5 can be found at:
http://oss.sgi.com/archives/xfs/2012-03/msg00310.html
Changes fron version 4 to version 5:
rebase with the current tree one simple change.
Version 4 can be found at
http://oss.sgi.com/archives/xfs/2012-02/msg00528.html
Changes from version 3 to version 4:
- Remove save_flags with storing the value (in to superblock) based on field type info
- fix checkpatch.pl warnings and errors
Version 3 of the posting can be found at
http://oss.sgi.com/archives/xfs/2012-01/msg00309.html
Changes from version 2 to version 3:
- hash table for pquota is added.
- changes to apply cleanly with the latest tree
version 2 of the posting can be found at
http://oss.sgi.com/archives/xfs/2011-10/msg00470.html
Changes from version 1 to version 2:
- Created a new prep patch to accomodate some generic changes that ease the later patches.
- Created a new patch to add a new field qs_pquota to fs_quota_stat with appropriate versioning changes
- Changed the logic to allow XFS_OQUOTA.* flags to be allowed only in the older versions.
- Changed couple of places where PQUOTA checking was on the else if construct so as to allow both GQUOTA and PQUOTA in those places.
- Fixed comments in xfs_quota.h to reflect the current changes.
- Changed the name of the macro XFS_SB_VERSION2_SEPER_PQUOTA to XFS_SB_VERSION2_NO_OQUOTA
- got rid of the macros XFS_MOUNT_QUOTA_SET1 and XFS_MOUNT_QUOTA_SET2
- added a new inline function xfs_inode_dquot(ip, type) to simplify the error path in xfs_qm_dqget()
- got rid of the macro XFS_IS_THIS_QUOTA_OFF
- added comment to explain why sb_qflags is saved and restored in xfs_sb_to_disk()
version 1 of the posting can be found at
http://oss.sgi.com/archives/xfs/2011-10/msg00341.html
Thanks & Regards,
chandra
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 1/11 xfs: Define a new function xfs_is_quota_inode()
In preparation for combined pquota/gquota support, define a new function to check if the fiven inode is a quota inode.
--- fs/xfs/xfs_itable.c | 2 +- fs/xfs/xfs_qm.c | 8 +++----- fs/xfs/xfs_sb.h | 6 ++++++ fs/xfs/xfs_trans_dquot.c | 6 ++---- 4 files changed, 12 insertions(+), 10 deletions(-)
fs/xfs/xfs_itable.c +1 -1
@@ -43,7 +43,7 @@ xfs_internal_inum( {return (ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || (xfs_sb_version_hasquota (&mp->m_sb) && - (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino))); +xfs_is_quota_inode (&mp->m_sb, ino))); }/*
fs/xfs/xfs_qm.c +3 -5
@@ -489,8 +489,7 @@ xfs_qm_need_dqattach(return false;if (!XFS_NOT_DQATTACHED (mp, ip))return false; -if (ip->i_ino == mp->m_sb.sb_uquotino || - ip->i_ino == mp->m_sb.sb_gquotino) +if (xfs_is_quota_inode (&mp->m_sb, ip->i_ino))return false;return true; }
@@ -606,8 +605,7 @@ xfs_qm_dqdetach(trace_xfs_dquot_dqdetach (ip); -ASSERT (ip->i_ino != ip->i_mount->m_sb.sb_uquotino); -ASSERT (ip->i_ino != ip->i_mount->m_sb.sb_gquotino); +ASSERT (!xfs_is_quota_inode (&ip->i_mount->m_sb, ip->i_ino));if (ip->i_udquot) {xfs_qm_dqrele (ip->i_udquot); ip->i_udquot =NULL ;
@@ -1152,7 +1150,7 @@ xfs_qm_dqusage_adjust(* rootino must have its resources accounted for, not so with the quota * inodes. */ -if (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino) { +if (xfs_is_quota_inode (&mp->m_sb, ino)) { *res =BULKSTAT_RV_NOTHING ;return XFS_ERROR (EINVAL ); }
fs/xfs/xfs_sb.h +6 -0
@@ -618,6 +618,12 @@ xfs_sb_has_incompat_log_feature(return (sbp->sb_features_log_incompat & feature) !=0 ; } +static inline bool +xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +{ +return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +} +/* * end of superblock version macros */
fs/xfs/xfs_trans_dquot.c +2 -4
@@ -157,8 +157,7 @@ xfs_trans_mod_dquot_byino(if (!XFS_IS_QUOTA_RUNNING (mp) || !XFS_IS_QUOTA_ON (mp) || - ip->i_ino == mp->m_sb.sb_uquotino || - ip->i_ino == mp->m_sb.sb_gquotino) +xfs_is_quota_inode (&mp->m_sb, ip->i_ino))return ;if (tp->t_dqinfo ==NULL )
@@ -816,8 +815,7 @@ xfs_trans_reserve_quota_nblks(if (XFS_IS_PQUOTA_ON (mp)) flags |=XFS_QMOPT_ENOSPC ; -ASSERT (ip->i_ino != mp->m_sb.sb_uquotino); -ASSERT (ip->i_ino != mp->m_sb.sb_gquotino); +ASSERT (!xfs_is_quota_inode (&mp->m_sb, ip->i_ino));ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL )); ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) ==
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 01/11] xfs: Define a new function xfs_is_quota_inode()
Quoted 4 lines · Chandra Seetharaman
In preparation for combined pquota/gquota support, define a new function to check if the fiven inode is a quota inode.
Signed-off-by Chandra Seetharaman <[email protected]>
Looks great.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 2/11 xfs: Replace macro XFS_DQUOT_TREE with a function
In reply to Chandra SeetharamanIn preparation for combined pquota/gquota support, for the sake of readability, change the macro to an inline function.
--- fs/xfs/xfs_dquot.c | 2 +- fs/xfs/xfs_qm.c | 6 +++--- fs/xfs/xfs_qm.h | 22 ++++++++++++++++------ 3 files changed, 20 insertions(+), 10 deletions(-)
fs/xfs/xfs_dquot.c +1 -1
@@ -804,7 +804,7 @@ xfs_qm_dqget( xfs_dquot_t **O_dqpp) /* OUT : locked incore dquot */ {struct xfs_quotainfo *qi = mp->m_quotainfo; -struct radix_tree_root *tree =XFS_DQUOT_TREE (qi, type); +struct radix_tree_root *tree =xfs_dquot_tree (qi, type);struct xfs_dquot *dqp;int error;
fs/xfs/xfs_qm.c +3 -3
@@ -70,7 +70,7 @@ xfs_qm_dquot_walk( void *data) {struct xfs_quotainfo *qi = mp->m_quotainfo; -struct radix_tree_root *tree =XFS_DQUOT_TREE (qi, type); +struct radix_tree_root *tree =xfs_dquot_tree (qi, type);uint32_t next_index;int last_error =0 ;int skipped;
@@ -189,7 +189,7 @@ xfs_qm_dqpurge(xfs_dqfunlock (dqp);xfs_dqunlock (dqp); -radix_tree_delete (XFS_DQUOT_TREE (qi, dqp->q_core.d_flags), +radix_tree_delete (xfs_dquot_tree (qi, dqp->q_core.d_flags),be32_to_cpu (dqp->q_core.d_id)); qi->qi_dquots--;
@@ -1471,7 +1471,7 @@ xfs_qm_dqfree_one(struct xfs_quotainfo *qi = mp->m_quotainfo;mutex_lock (&qi->qi_tree_lock); -radix_tree_delete (XFS_DQUOT_TREE (qi, dqp->q_core.d_flags), +radix_tree_delete (xfs_dquot_tree (qi, dqp->q_core.d_flags),be32_to_cpu (dqp->q_core.d_id)); qi->qi_dquots--;
fs/xfs/xfs_qm.h +16 -6
@@ -69,12 +69,22 @@ typedef struct xfs_quotainfo {struct shrinker qi_shrinker; } xfs_quotainfo_t; -#define XFS_DQUOT_TREE (qi, type) \ - ((type & XFS_DQ_USER) ? \ - &((qi)->qi_uquota_tree) : \ - &((qi)->qi_gquota_tree)) - - +static inline struct radix_tree_root * +xfs_dquot_tree ( +struct xfs_quotainfo *qi, +int type) +{ +switch (type) { +case XFS_DQ_USER : +return &qi->qi_uquota_tree; +case XFS_DQ_GROUP : +case XFS_DQ_PROJ : +return &qi->qi_gquota_tree; +default : +ASSERT (0 ); + } +return NULL ; +}extern int xfs_qm_calc_dquots_per_chunk (struct xfs_mount *mp,unsigned int nbblks);extern void xfs_trans_mod_dquot (xfs_trans_t *,xfs_dquot_t *,uint ,long );
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 02/11] xfs: Replace macro XFS_DQUOT_TREE with a function
Quoted 4 lines · Chandra Seetharaman
In preparation for combined pquota/gquota support, for the sake of readability, change the macro to an inline function.
Signed-off-by Chandra Seetharaman <[email protected]>
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 3/11 xfs: Replace macro XFS_DQ_TO_QIP with a function
In reply to Chandra SeetharamanIn preparation for combined pquota/gquota support, for the sake of readability, change the macro to an inline function.
--- fs/xfs/xfs_dquot.c | 2 +- fs/xfs/xfs_dquot.h | 4 ---- fs/xfs/xfs_qm.h | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-)
fs/xfs/xfs_dquot.c +1 -1
@@ -573,7 +573,7 @@ xfs_qm_dqtobp(xfs_bmbt_irec_t map;int nmaps =1 , error;xfs_buf_t *bp; -xfs_inode_t *quotip =XFS_DQ_TO_QIP (dqp); +struct xfs_inode *quotip =xfs_dq_to_quota_inode (dqp);xfs_mount_t *mp = dqp->q_mount;xfs_dqid_t id =be32_to_cpu (dqp->q_core.d_id);xfs_trans_t *tp = (tpp ? *tpp :NULL );
fs/xfs/xfs_dquot.h +0 -4
@@ -143,10 +143,6 @@ static inline xfs_dquot_t *xfs_inode_dquot(struct xfs_inode *ip, int type)#define XFS_QM_ISUDQ (dqp) ((dqp)->dq_flags & XFS_DQ_USER)#define XFS_QM_ISPDQ (dqp) ((dqp)->dq_flags & XFS_DQ_PROJ)#define XFS_QM_ISGDQ (dqp) ((dqp)->dq_flags & XFS_DQ_GROUP) -#define XFS_DQ_TO_QINF (dqp) ((dqp)->q_mount->m_quotainfo) -#define XFS_DQ_TO_QIP (dqp) (XFS_QM_ISUDQ(dqp) ? \ - XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \ - XFS_DQ_TO_QINF(dqp)->qi_gquotaip)extern int xfs_qm_dqread (struct xfs_mount *,xfs_dqid_t ,uint ,uint ,struct xfs_dquot **);
fs/xfs/xfs_qm.h +16 -0
@@ -85,6 +85,22 @@ xfs_dquot_tree( }return NULL ; } + +static inline struct xfs_inode * +xfs_dq_to_quota_inode (struct xfs_dquot *dqp) +{ +switch (dqp->dq_flags &XFS_DQ_ALLTYPES ) { +case XFS_DQ_USER : +return dqp->q_mount->m_quotainfo->qi_uquotaip; +case XFS_DQ_GROUP : +case XFS_DQ_PROJ : +return dqp->q_mount->m_quotainfo->qi_gquotaip; +default : +ASSERT (0 ); + } +return NULL ; +} +extern int xfs_qm_calc_dquots_per_chunk (struct xfs_mount *mp,unsigned int nbblks);extern void xfs_trans_mod_dquot (xfs_trans_t *,xfs_dquot_t *,uint ,long );
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 03/11] xfs: Replace macro XFS_DQ_TO_QIP with a function
Quoted 4 lines · Chandra Seetharaman
In preparation for combined pquota/gquota support, for the sake of readability, change the macro to an inline function.
Signed-off-by Chandra Seetharaman <[email protected]>
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 4/11 xfs: Code cleanup and removal of some typedef usage
In reply to Chandra SeetharamanIn preparation for combined pquota/gquota support, for the sake of readability, do some code cleanup surrounding the affected code.
--- fs/xfs/xfs_dquot.c | 12 ++-- fs/xfs/xfs_icache.c | 3 +- fs/xfs/xfs_qm.c | 152 ++++++++++++++++++++++++---------------------- fs/xfs/xfs_qm.h | 37 ++++++----- fs/xfs/xfs_qm_syscalls.c | 8 +- fs/xfs/xfs_symlink.c | 3 +- fs/xfs/xfs_trans_dquot.c | 46 ++++++-------- 7 files changed, 135 insertions(+), 126 deletions(-)
fs/xfs/xfs_dquot.c +6 -6
@@ -570,13 +570,13 @@ xfs_qm_dqtobp( xfs_buf_t **O_bpp, uint flags) { -xfs_bmbt_irec_t map; -int nmaps =1 , error; -xfs_buf_t *bp; +struct xfs_bmbt_irec map; +int nmaps =1 , error; +struct xfs_buf *bp;struct xfs_inode *quotip =xfs_dq_to_quota_inode (dqp); -xfs_mount_t *mp = dqp->q_mount; -xfs_dqid_t id =be32_to_cpu (dqp->q_core.d_id); -xfs_trans_t *tp = (tpp ? *tpp :NULL ); +struct xfs_mount *mp = dqp->q_mount; +xfs_dqid_t id =be32_to_cpu (dqp->q_core.d_id); +struct xfs_trans *tp = (tpp ? *tpp :NULL ); dqp->q_fileoffset = (xfs_fileoff_t )id / mp->m_quotainfo->qi_dqperchunk;
fs/xfs/xfs_icache.c +2 -1
@@ -335,7 +335,8 @@ xfs_iget_cache_miss( iflags =XFS_INEW ;if (flags &XFS_IGET_DONTCACHE ) iflags |=XFS_IDONTCACHE ; - ip->i_udquot = ip->i_gdquot =NULL ; + ip->i_udquot =NULL ; + ip->i_gdquot =NULL ;xfs_iflags_set (ip, iflags);/* insert the new inode */
fs/xfs/xfs_qm.c +80 -72
304 lines not on this page · raw message
fs/xfs/xfs_qm.h +20 -17
@@ -103,11 +103,13 @@ xfs_dq_to_quota_inode(struct xfs_dquot *dqp)extern int xfs_qm_calc_dquots_per_chunk (struct xfs_mount *mp,unsigned int nbblks); -extern void xfs_trans_mod_dquot (xfs_trans_t *,xfs_dquot_t *,uint ,long ); -extern int xfs_trans_reserve_quota_bydquots (xfs_trans_t *,xfs_mount_t *, -xfs_dquot_t *,xfs_dquot_t *,long ,long ,uint ); -extern void xfs_trans_dqjoin (xfs_trans_t *,xfs_dquot_t *); -extern void xfs_trans_log_dquot (xfs_trans_t *,xfs_dquot_t *); +extern void xfs_trans_mod_dquot (struct xfs_trans *, +struct xfs_dquot *,uint ,long ); +extern int xfs_trans_reserve_quota_bydquots (struct xfs_trans *, +struct xfs_mount *,struct xfs_dquot *, +struct xfs_dquot *,long ,long ,uint ); +extern void xfs_trans_dqjoin (struct xfs_trans *,struct xfs_dquot *); +extern void xfs_trans_log_dquot (struct xfs_trans *,struct xfs_dquot *);/* * We keep the usr and grp dquots separately so that locking will be easier
@@ -132,22 +134,23 @@ typedef struct xfs_dquot_acct {#define XFS_QM_IWARNLIMIT 5#define XFS_QM_RTBWARNLIMIT 5 -extern void xfs_qm_destroy_quotainfo (xfs_mount_t *); -extern int xfs_qm_quotacheck (xfs_mount_t *); -extern int xfs_qm_write_sb_changes (xfs_mount_t *,__int64_t ); +extern void xfs_qm_destroy_quotainfo (struct xfs_mount *); +extern int xfs_qm_quotacheck (struct xfs_mount *); +extern int xfs_qm_write_sb_changes (struct xfs_mount *,__int64_t );/* dquot stuff */ -extern void xfs_qm_dqpurge_all (xfs_mount_t *,uint ); -extern void xfs_qm_dqrele_all_inodes (xfs_mount_t *,uint ); +extern void xfs_qm_dqpurge_all (struct xfs_mount *,uint ); +extern void xfs_qm_dqrele_all_inodes (struct xfs_mount *,uint );/* quota ops */ -extern int xfs_qm_scall_trunc_qfiles (xfs_mount_t *,uint ); -extern int xfs_qm_scall_getquota (xfs_mount_t *,xfs_dqid_t ,uint , -fs_disk_quota_t *); +extern int xfs_qm_scall_trunc_qfiles (struct xfs_mount *,uint ); +extern int xfs_qm_scall_getquota (struct xfs_mount *,xfs_dqid_t , +uint ,struct fs_disk_quota *);extern int xfs_qm_scall_setqlim (struct xfs_mount *,xfs_dqid_t ,uint , -fs_disk_quota_t *); -extern int xfs_qm_scall_getqstat (xfs_mount_t *,fs_quota_stat_t *); -extern int xfs_qm_scall_quotaon (xfs_mount_t *,uint ); -extern int xfs_qm_scall_quotaoff (xfs_mount_t *,uint ); +struct fs_disk_quota *); +extern int xfs_qm_scall_getqstat (struct xfs_mount *, +struct fs_quota_stat *); +extern int xfs_qm_scall_quotaon (struct xfs_mount *,uint ); +extern int xfs_qm_scall_quotaoff (struct xfs_mount *,uint );#endif /* __XFS_QM_H__ */
fs/xfs/xfs_qm_syscalls.c +4 -4
@@ -407,11 +407,11 @@ xfs_qm_scall_getqstat( struct fs_quota_stat *out) {struct xfs_quotainfo *q = mp->m_quotainfo; -struct xfs_inode *uip, *gip; -bool tempuqip, tempgqip; +struct xfs_inode *uip =NULL ; +struct xfs_inode *gip =NULL ; +bool tempuqip = false; +bool tempgqip = false; - uip = gip =NULL ; - tempuqip = tempgqip = false;memset (out,0 ,sizeof (fs_quota_stat_t)); out->qs_version =FS_QSTAT_VERSION ;
fs/xfs/xfs_symlink.c +2 -1
@@ -358,7 +358,8 @@ xfs_symlink(int n;xfs_buf_t *bp;prid_t prid; -struct xfs_dquot *udqp, *gdqp; +struct xfs_dquot *udqp =NULL ; +struct xfs_dquot *gdqp =NULL ;uint resblks; *ipp =NULL ;
fs/xfs/xfs_trans_dquot.c +21 -25
77 lines not on this page · raw message
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 04/11] xfs: Code cleanup and removal of some typedef usage
Quoted 5 lines · Chandra Seetharaman
In preparation for combined pquota/gquota support, for the sake of readability, do some code cleanup surrounding the affected code.
Signed-off-by Chandra Seetharaman <[email protected]>
Looks great. Thanks for addressing my nit regarding the error asserts.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 5/11 xfs: Do some whitespace cleanup in the data structure xfs_quotainfo
In reply to Chandra SeetharamanIn preparation for combined pquota/gquota support, do some whitespace cleanups.
--- fs/xfs/xfs_qm.h | 50 +++++++++++++++++++++++++------------------------- 1 files changed, 25 insertions(+), 25 deletions(-)
fs/xfs/xfs_qm.h +25 -25
@@ -42,31 +42,31 @@ extern struct kmem_zone *xfs_qm_dqtrxzone;* The mount structure keeps a pointer to this. */ typedef struct xfs_quotainfo { -struct radix_tree_root qi_uquota_tree; -struct radix_tree_root qi_gquota_tree; -struct mutex qi_tree_lock; -xfs_inode_t *qi_uquotaip;/* user quota inode */ -xfs_inode_t *qi_gquotaip;/* group quota inode */ -struct list_head qi_lru_list; -struct mutex qi_lru_lock; -int qi_lru_count; -int qi_dquots; -time_t qi_btimelimit;/* limit for blks timer */ -time_t qi_itimelimit;/* limit for inodes timer */ -time_t qi_rtbtimelimit;/* limit for rt blks timer */ -xfs_qwarncnt_t qi_bwarnlimit;/* limit for blks warnings */ -xfs_qwarncnt_t qi_iwarnlimit;/* limit for inodes warnings */ -xfs_qwarncnt_t qi_rtbwarnlimit;/* limit for rt blks warnings */ -struct mutex qi_quotaofflock;/* to serialize quotaoff */ -xfs_filblks_t qi_dqchunklen;/* # BBs in a chunk of dqs */ -uint qi_dqperchunk;/* # ondisk dqs in above chunk */ -xfs_qcnt_t qi_bhardlimit;/* default data blk hard limit */ -xfs_qcnt_t qi_bsoftlimit;/* default data blk soft limit */ -xfs_qcnt_t qi_ihardlimit;/* default inode count hard limit */ -xfs_qcnt_t qi_isoftlimit;/* default inode count soft limit */ -xfs_qcnt_t qi_rtbhardlimit;/* default realtime blk hard limit */ -xfs_qcnt_t qi_rtbsoftlimit;/* default realtime blk soft limit */ -struct shrinker qi_shrinker; +struct radix_tree_root qi_uquota_tree; +struct radix_tree_root qi_gquota_tree; +struct mutex qi_tree_lock; +struct xfs_inode *qi_uquotaip; +struct xfs_inode *qi_gquotaip; +struct list_head qi_lru_list; +struct mutex qi_lru_lock; +int qi_lru_count; +int qi_dquots; +time_t qi_btimelimit; +time_t qi_itimelimit; +time_t qi_rtbtimelimit; +xfs_qwarncnt_t qi_bwarnlimit; +xfs_qwarncnt_t qi_iwarnlimit; +xfs_qwarncnt_t qi_rtbwarnlimit; +struct mutex qi_quotaofflock;/* to serialize quotaoff */ +xfs_filblks_t qi_dqchunklen;/* #BBs in a chunk of dqs */ +uint qi_dqperchunk;/* #ondisk dqs in above chunk */ +xfs_qcnt_t qi_bhardlimit; +xfs_qcnt_t qi_bsoftlimit; +xfs_qcnt_t qi_ihardlimit; +xfs_qcnt_t qi_isoftlimit; +xfs_qcnt_t qi_rtbhardlimit; +xfs_qcnt_t qi_rtbsoftlimit; +struct shrinker qi_shrinker; }xfs_quotainfo_t ; static inline struct radix_tree_root *
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 05/11] xfs: Do some whitespace cleanup in the data structure xfs_quotainfo
Hey Chandra,
Quoted 4 lines · Chandra Seetharaman
In preparation for combined pquota/gquota support, do some whitespace cleanups.
Signed-off-by Chandra Seetharaman <[email protected]>
Wow. Putting this in a patch by itself really puts it into stark relief.
If we pull this in we're representing that some tabs and the alignment of the fields is more valuable than the comments? I'm fairly certain I don't agree that's the case...
I'm sorry for your trouble, but I think I should pass on this one. Do you agree?
Thanks,
Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 05/11] xfs: Do some whitespace cleanup in the data structure xfs_quotainfo
Quoted 6 lines · Ben Myers
Hey Chandra,
Quoted 3 lines · Chandra Seetharaman
In preparation for combined pquota/gquota support, do some whitespace cleanups.
Quoted 7 lines
Quoted 1 line
Signed-off-by Chandra Seetharaman <[email protected]>Wow. Putting this in a patch by itself really puts it into stark relief.
If we pull this in we're representing that some tabs and the alignment of the fields is more valuable than the comments? I'm fairly certain I
If you put it that way, it does sound not correct, and I would agree with you too :).
But, IMO, it has to be more subjective than that. The comments removed, IMO, add no additional value (the field name conveys the same information). You can see that I left alone the comments that provide some value.
Quoted 5 lines
don't agree that's the case...
I'm sorry for your trouble, but I think I should pass on this one. Do you agree?
In effect, the code does look better (than I found it :) at the cost of removal of redundant comments.
If you still don't want to include, I would accept your decision.
Quoted 8 lines
Thanks,
Ben_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 05/11] xfs: Do some whitespace cleanup in the data structure xfs_quotainfo
Hey Chandra,
Quoted 16 lines · Chandra Seetharaman
Quoted 6 lines · Ben Myers
Hey Chandra,
Quoted 3 lines · Chandra Seetharaman
In preparation for combined pquota/gquota support, do some whitespace cleanups.
Quoted 7 lines
Quoted 1 line
Signed-off-by Chandra Seetharaman <[email protected]>Wow. Putting this in a patch by itself really puts it into stark relief.
If we pull this in we're representing that some tabs and the alignment of the fields is more valuable than the comments? I'm fairly certain I
Quoted 7 lines
If you put it that way, it does sound not correct, and I would agree with you too :).
But, IMO, it has to be more subjective than that. The comments removed, IMO, add no additional value (the field name conveys the same information). You can see that I left alone the comments that provide some value.
I did notice that you kept some of the comments. However, I am finding some of the removed ones to be useful too. I think if you try to look at this structure with the eyes of a newbie the comments do help you. e.g. di_btimelimit doesn't carry much meaning for me out of context, and the comment is helping me, at least. Not everyone is quite so moronic as me, though. ;)
Quoted 10 lines
Quoted 5 lines
don't agree that's the case...
I'm sorry for your trouble, but I think I should pass on this one. Do you agree?
In effect, the code does look better (than I found it :) at the cost of removal of redundant comments.
If you still don't want to include, I would accept your decision.
Thanks. I really would prefer to keep them. FWIW, the rest of your patch set doesn't appear to be adversely affected by doing so.
Regards,
Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 6/11 xfs: Change xfs_dquot_acct to be a 2-dimensional array
In reply to Chandra SeetharamanIn preparation for combined pquota/gquota support, for the sake of readability, change xfs_dquot_acct to be a 2-dimensional array.
--- fs/xfs/xfs_qm.h | 12 ++++++++---- fs/xfs/xfs_trans_dquot.c | 31 ++++++++++++------------------- 2 files changed, 20 insertions(+), 23 deletions(-)
fs/xfs/xfs_qm.h +8 -4
@@ -116,11 +116,15 @@ extern void xfs_trans_log_dquot(struct xfs_trans *, struct xfs_dquot *);* to do at commit time. All transactions that we know of at this point * affect no more than two dquots of one type. Hence, the TRANS_MAXDQS value. */ +enum { +XFS_QM_TRANS_USR =0 , +XFS_QM_TRANS_GRP , +XFS_QM_TRANS_DQTYPES +};#define XFS_QM_TRANS_MAXDQS 2 -typedef struct xfs_dquot_acct { -xfs_dqtrx_t dqa_usrdquots[XFS_QM_TRANS_MAXDQS ]; -xfs_dqtrx_t dqa_grpdquots[XFS_QM_TRANS_MAXDQS ]; -}xfs_dquot_acct_t ; +struct xfs_dquot_acct { +struct xfs_dqtrx dqs[XFS_QM_TRANS_DQTYPES ][XFS_QM_TRANS_MAXDQS ]; +};/* * Users are allowed to have a usage exceeding their softlimit for
fs/xfs/xfs_trans_dquot.c +12 -19
@@ -103,8 +103,6 @@ xfs_trans_dup_dqinfo(return ;xfs_trans_alloc_dqinfo (ntp); - oqa = otp->t_dqinfo->dqa_usrdquots; - nqa = ntp->t_dqinfo->dqa_usrdquots;/* * Because the quota blk reservation is carried forward,
@@ -113,7 +111,9 @@ xfs_trans_dup_dqinfo(if (otp->t_flags &XFS_TRANS_DQ_DIRTY ) ntp->t_flags |=XFS_TRANS_DQ_DIRTY ; -for (j =0 ; j <2 ; j++) { +for (j =0 ; j <XFS_QM_TRANS_DQTYPES ; j++) { + oqa = otp->t_dqinfo->dqs[j]; + nqa = ntp->t_dqinfo->dqs[j];for (i =0 ; i <XFS_QM_TRANS_MAXDQS ; i++) {if (oqa[i].qt_dquot ==NULL )break ;
@@ -138,8 +138,6 @@ xfs_trans_dup_dqinfo( oq->qt_ino_res = oq->qt_ino_res_used; } - oqa = otp->t_dqinfo->dqa_grpdquots; - nqa = ntp->t_dqinfo->dqa_grpdquots; } }
@@ -177,8 +175,10 @@ xfs_trans_get_dqtrx(int i;struct xfs_dqtrx *qa; - qa =XFS_QM_ISUDQ (dqp) ? - tp->t_dqinfo->dqa_usrdquots : tp->t_dqinfo->dqa_grpdquots; +if (XFS_QM_ISUDQ (dqp)) + qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_USR ]; +else + qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_GRP ];for (i =0 ; i <XFS_QM_TRANS_MAXDQS ; i++) { if (qa[i].qt_dquot == NULL ||
@@ -338,12 +338,10 @@ xfs_trans_apply_dquot_deltas(return ;ASSERT (tp->t_dqinfo); - qa = tp->t_dqinfo->dqa_usrdquots; -for (j =0 ; j <2 ; j++) { -if (qa[0 ].qt_dquot ==NULL ) { - qa = tp->t_dqinfo->dqa_grpdquots; +for (j =0 ; j <XFS_QM_TRANS_DQTYPES ; j++) { + qa = tp->t_dqinfo->dqs[j]; +if (qa[0 ].qt_dquot ==NULL )continue ; - }/* * Lock all of the dquots and join them to the transaction.
@@ -494,10 +492,6 @@ xfs_trans_apply_dquot_deltas(ASSERT (dqp->q_res_rtbcount >=be64_to_cpu (dqp->q_core.d_rtbcount)); } -/* -* Do the group quotas next -*/ - qa = tp->t_dqinfo->dqa_grpdquots; } }
@@ -520,9 +514,9 @@ xfs_trans_unreserve_and_mod_dquots(if (!tp->t_dqinfo || !(tp->t_flags &XFS_TRANS_DQ_DIRTY ))return ; - qa = tp->t_dqinfo->dqa_usrdquots; +for (j =0 ; j <XFS_QM_TRANS_DQTYPES ; j++) { + qa = tp->t_dqinfo->dqs[j]; -for (j =0 ; j <2 ; j++) {for (i =0 ; i <XFS_QM_TRANS_MAXDQS ; i++) { qtrx = &qa[i];/*
@@ -564,7 +558,6 @@ xfs_trans_unreserve_and_mod_dquots(xfs_dqunlock (dqp); } - qa = tp->t_dqinfo->dqa_grpdquots; } }
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 06/11] xfs: Change xfs_dquot_acct to be a 2-dimensional array
Quoted 4 lines · Chandra Seetharaman
In preparation for combined pquota/gquota support, for the sake of readability, change
xfs_dquot_acctto be a 2-dimensional array.Signed-off-by Chandra Seetharaman <[email protected]>
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 7/11 xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD
In reply to Chandra SeetharamanRemove all incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD. Instead, start using XFS_GQUOTA_.* XFS_PQUOTA_.* counterparts for GQUOTA and PQUOTA respectively.
On-disk copy still uses XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD.
Read and write of the superblock does the conversion from *OQUOTA* to *[PG]QUOTA*.
--- fs/xfs/xfs_mount.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_qm.c | 9 +++++-- fs/xfs/xfs_qm_syscalls.c | 43 ++++++++++++++++++++------------------ fs/xfs/xfs_quota.h | 47 ++++++++++++++++++++++++++---------------- fs/xfs/xfs_quotaops.c | 6 +++- fs/xfs/xfs_super.c | 16 +++++++------- fs/xfs/xfs_trans_dquot.c | 4 +- 7 files changed, 123 insertions(+), 53 deletions(-)
fs/xfs/xfs_mount.c +51 -0
@@ -336,6 +336,14 @@ xfs_mount_validate_sb(return XFS_ERROR (EWRONGFS ); } +if ((sbp->sb_qflags & (XFS_OQUOTA_ENFD |XFS_OQUOTA_CHKD )) && + (sbp->sb_qflags & (XFS_PQUOTA_ENFD |XFS_GQUOTA_ENFD | +XFS_PQUOTA_CHKD |XFS_GQUOTA_CHKD ))) { +xfs_notice (mp, +"Super block has XFS_OQUOTA bits along with XFS_PQUOTA and/or XFS_GQUOTA bits.\n" ); +return XFS_ERROR (EFSCORRUPTED ); + } +/* * Version 5 superblock feature mask validation. Reject combinations the * kernel cannot support up front before checking anything else. For
@@ -561,6 +569,18 @@ out_unwind:return error; } +static void +xfs_sb_quota_from_disk (struct xfs_sb *sbp) +{ +if (sbp->sb_qflags &XFS_OQUOTA_ENFD ) + sbp->sb_qflags |= (sbp->sb_qflags &XFS_PQUOTA_ACCT ) ? +XFS_PQUOTA_ENFD :XFS_GQUOTA_ENFD ; +if (sbp->sb_qflags &XFS_OQUOTA_CHKD ) + sbp->sb_qflags |= (sbp->sb_qflags &XFS_PQUOTA_ACCT ) ? +XFS_PQUOTA_CHKD :XFS_GQUOTA_CHKD ; + sbp->sb_qflags &= ~(XFS_OQUOTA_ENFD |XFS_OQUOTA_CHKD ); +} + void xfs_sb_from_disk( struct xfs_sb *to,
@@ -622,6 +642,35 @@ xfs_sb_from_disk( to->sb_lsn =be64_to_cpu (from->sb_lsn); } +static inline void +xfs_sb_quota_to_disk ( +xfs_dsb_t *to, +xfs_sb_t *from, +__int64_t *fields) +{ +__uint16_t qflags = from->sb_qflags; + +if (*fields &XFS_SB_QFLAGS ) { +/* +* The in-core version of sb_qflags do not have +* XFS_OQUOTA_* flags, whereas the on-disk version +* does. So, convert incore XFS_{PG}QUOTA_* flags +* to on-disk XFS_OQUOTA_* flags. +*/ + qflags &= ~(XFS_PQUOTA_ENFD |XFS_PQUOTA_CHKD | +XFS_GQUOTA_ENFD |XFS_GQUOTA_CHKD ); + +if (from->sb_qflags & + (XFS_PQUOTA_ENFD |XFS_GQUOTA_ENFD )) + qflags |=XFS_OQUOTA_ENFD ; +if (from->sb_qflags & + (XFS_PQUOTA_CHKD |XFS_GQUOTA_CHKD )) + qflags |=XFS_OQUOTA_CHKD ; + to->sb_qflags =cpu_to_be16 (qflags); + *fields &= ~XFS_SB_QFLAGS ; + } +} +/* * Copy in core superblock to ondisk one. *
@@ -643,6 +692,7 @@ xfs_sb_to_disk(if (!fields)return ; +xfs_sb_quota_to_disk (to, from, &fields);while (fields) { f = (xfs_sb_field_t )xfs_lowbit64 ((__uint64_t )fields); first = xfs_sb_info[f].offset;
@@ -835,6 +885,7 @@ reread:*/ xfs_sb_from_disk (&mp->m_sb,XFS_BUF_TO_SBP (bp)); +xfs_sb_quota_from_disk (&mp->m_sb);/* * We must be able to do sector-sized and sector-aligned IO. */
fs/xfs/xfs_qm.c +6 -3
@@ -299,8 +299,10 @@ xfs_qm_mount_quotas(*/ if (!XFS_IS_UQUOTA_ON (mp)) mp->m_qflags &= ~XFS_UQUOTA_CHKD ; -if (!(XFS_IS_GQUOTA_ON (mp) ||XFS_IS_PQUOTA_ON (mp))) - mp->m_qflags &= ~XFS_OQUOTA_CHKD ; +if (!XFS_IS_GQUOTA_ON (mp)) + mp->m_qflags &= ~XFS_GQUOTA_CHKD ; +if (!XFS_IS_PQUOTA_ON (mp)) + mp->m_qflags &= ~XFS_PQUOTA_CHKD ; write_changes:/*
@@ -1297,7 +1299,8 @@ xfs_qm_quotacheck( &buffer_list);if (error) goto error_return; - flags |=XFS_OQUOTA_CHKD ; + flags |=XFS_IS_GQUOTA_ON (mp) ? +XFS_GQUOTA_CHKD :XFS_PQUOTA_CHKD ; } do {
fs/xfs/xfs_qm_syscalls.c +23 -20
81 lines not on this page · raw message
fs/xfs/xfs_quota.h +29 -18
83 lines not on this page · raw message
fs/xfs/xfs_quotaops.c +4 -2
@@ -75,8 +75,10 @@ xfs_fs_set_xstate( flags |=XFS_GQUOTA_ACCT ;if (uflags &FS_QUOTA_UDQ_ENFD ) flags |=XFS_UQUOTA_ENFD ; -if (uflags & (FS_QUOTA_PDQ_ENFD |FS_QUOTA_GDQ_ENFD )) - flags |=XFS_OQUOTA_ENFD ; +if (uflags &FS_QUOTA_GDQ_ENFD ) + flags |=XFS_GQUOTA_ENFD ; +if (uflags &FS_QUOTA_PDQ_ENFD ) + flags |=XFS_PQUOTA_ENFD ;switch (op) {case Q_XQUOTAON :
fs/xfs/xfs_super.c +8 -8
@@ -359,17 +359,17 @@ xfs_parseargs( }else if (!strcmp (this_char,MNTOPT_PQUOTA ) || !strcmp (this_char,MNTOPT_PRJQUOTA )) { mp->m_qflags |= (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE | -XFS_OQUOTA_ENFD ); +XFS_PQUOTA_ENFD ); }else if (!strcmp (this_char,MNTOPT_PQUOTANOENF )) { mp->m_qflags |= (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE ); - mp->m_qflags &= ~XFS_OQUOTA_ENFD ; + mp->m_qflags &= ~XFS_PQUOTA_ENFD ; }else if (!strcmp (this_char,MNTOPT_GQUOTA ) || !strcmp (this_char,MNTOPT_GRPQUOTA )) { mp->m_qflags |= (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE | -XFS_OQUOTA_ENFD ); +XFS_GQUOTA_ENFD ); }else if (!strcmp (this_char,MNTOPT_GQUOTANOENF )) { mp->m_qflags |= (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE ); - mp->m_qflags &= ~XFS_OQUOTA_ENFD ; + mp->m_qflags &= ~XFS_GQUOTA_ENFD ; }else if (!strcmp (this_char,MNTOPT_DELAYLOG )) {xfs_warn (mp,"delaylog is the default now, option is deprecated." );
@@ -558,12 +558,12 @@ xfs_showargs(/* Either project or group quotas can be active, not both */ if (mp->m_qflags &XFS_PQUOTA_ACCT ) { -if (mp->m_qflags &XFS_OQUOTA_ENFD ) +if (mp->m_qflags &XFS_PQUOTA_ENFD )seq_puts (m,"," MNTOPT_PRJQUOTA );else seq_puts (m,"," MNTOPT_PQUOTANOENF ); }else if (mp->m_qflags &XFS_GQUOTA_ACCT ) { -if (mp->m_qflags &XFS_OQUOTA_ENFD ) +if (mp->m_qflags &XFS_GQUOTA_ENFD )seq_puts (m,"," MNTOPT_GRPQUOTA );else seq_puts (m,"," MNTOPT_GQUOTANOENF );
@@ -1131,8 +1131,8 @@ xfs_fs_statfs(spin_unlock (&mp->m_sb_lock);if ((ip->i_d.di_flags &XFS_DIFLAG_PROJINHERIT ) && - ((mp->m_qflags & (XFS_PQUOTA_ACCT |XFS_OQUOTA_ENFD ))) == - (XFS_PQUOTA_ACCT |XFS_OQUOTA_ENFD )) + ((mp->m_qflags & (XFS_PQUOTA_ACCT |XFS_PQUOTA_ENFD ))) == + (XFS_PQUOTA_ACCT |XFS_PQUOTA_ENFD ))xfs_qm_statvfs (ip, statp);return 0 ; }
fs/xfs/xfs_trans_dquot.c +2 -2
@@ -632,8 +632,8 @@ xfs_trans_dqresv(if ((flags &XFS_QMOPT_FORCE_RES ) ==0 && dqp->q_core.d_id && ((XFS_IS_UQUOTA_ENFORCED (dqp->q_mount) &&XFS_QM_ISUDQ (dqp)) || - (XFS_IS_OQUOTA_ENFORCED (dqp->q_mount) && - (XFS_QM_ISPDQ (dqp) ||XFS_QM_ISGDQ (dqp))))) { + (XFS_IS_GQUOTA_ENFORCED (dqp->q_mount) &&XFS_QM_ISGDQ (dqp)) || + (XFS_IS_PQUOTA_ENFORCED (dqp->q_mount) &&XFS_QM_ISPDQ (dqp)))) {if (nblks >0 ) {/* * dquot is locked already. See if we'd go over the
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 07/11] xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD
Quoted 10 lines · Chandra Seetharaman
Remove all incore use of
XFS_OQUOTA_ENFDandXFS_OQUOTA_CHKD. Instead, start using XFS_GQUOTA_.* XFS_PQUOTA_.* counterparts for GQUOTA and PQUOTA respectively.On-disk copy still uses
XFS_OQUOTA_ENFDandXFS_OQUOTA_CHKD.Read and write of the superblock does the conversion from *OQUOTA* to *[PG]QUOTA*.
Signed-off-by Chandra Seetharaman <[email protected]>
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 8/11 xfs: Add pquota fields where gquota is used.
In reply to Chandra SeetharamanAdd project quota changes to all the places where group quota field is used:
* add separate project quota members into various structures
* split project quota and group quotas so that instead of overriding the group quota members incore, the new project quota members are used instead
* get rid of usage of the OQUOTA flag incore, in favor of separate
* group and project quota flags.
* add a project dquot argument to various functions.
Not using the pquotino field from superblock yet.
--- fs/xfs/xfs_dquot.c | 15 +++- fs/xfs/xfs_dquot.h | 7 +- fs/xfs/xfs_icache.c | 1 + fs/xfs/xfs_inode.h | 1 + fs/xfs/xfs_ioctl.c | 14 ++-- fs/xfs/xfs_iops.c | 4 +- fs/xfs/xfs_qm.c | 241 +++++++++++++++++++++++++++++++++------------- fs/xfs/xfs_qm.h | 16 ++- fs/xfs/xfs_qm_bhv.c | 2 +- fs/xfs/xfs_qm_syscalls.c | 19 +++- fs/xfs/xfs_quota.h | 32 ++++--- fs/xfs/xfs_symlink.c | 10 ++- fs/xfs/xfs_trans_dquot.c | 26 ++++- fs/xfs/xfs_vnodeops.c | 13 ++- 14 files changed, 283 insertions(+), 118 deletions(-)
fs/xfs/xfs_dquot.c +12 -3
@@ -936,6 +936,7 @@ xfs_qm_dqput_final( {struct xfs_quotainfo *qi = dqp->q_mount->m_quotainfo;struct xfs_dquot *gdqp; +struct xfs_dquot *pdqp;trace_xfs_dqput_free (dqp);
@@ -949,21 +950,29 @@ xfs_qm_dqput_final(/* * If we just added a udquot to the freelist, then we want to release -* the gdquot reference that it (probably) has. Otherwise it'll keep -* the gdquot from getting reclaimed. +* the gdquot/pdquot reference that it (probably) has. Otherwise it'll +* keep the gdquot/pdquot from getting reclaimed. */ gdqp = dqp->q_gdquot;if (gdqp) {xfs_dqlock (gdqp); dqp->q_gdquot =NULL ; } + + pdqp = dqp->q_pdquot; +if (pdqp) { +xfs_dqlock (pdqp); + dqp->q_pdquot =NULL ; + }xfs_dqunlock (dqp);/* -* If we had a group quota hint, release it now. +* If we had a group/project quota hint, release it now. */ if (gdqp)xfs_qm_dqput (gdqp); +if (pdqp) +xfs_qm_dqput (pdqp); }/*
fs/xfs/xfs_dquot.h +5 -2
@@ -53,6 +53,7 @@ typedef struct xfs_dquot {xfs_fileoff_t q_fileoffset;/* offset in quotas file */ struct xfs_dquot *q_gdquot;/* group dquot, hint only */ +struct xfs_dquot *q_pdquot;/* project dquot, hint only */ xfs_disk_dquot_t q_core;/* actual usage & quotas */ xfs_dq_logitem_t q_logitem;/* dquot log item */ xfs_qcnt_t q_res_bcount;/* total regular nblks used+reserved */
@@ -118,8 +119,9 @@ static inline int xfs_this_quota_on(struct xfs_mount *mp, int type)case XFS_DQ_USER :return XFS_IS_UQUOTA_ON (mp);case XFS_DQ_GROUP : +return XFS_IS_GQUOTA_ON (mp);case XFS_DQ_PROJ : -return XFS_IS_OQUOTA_ON (mp); +return XFS_IS_PQUOTA_ON (mp);default :return 0 ; }
@@ -131,8 +133,9 @@ static inline xfs_dquot_t *xfs_inode_dquot(struct xfs_inode *ip, int type)case XFS_DQ_USER :return ip->i_udquot;case XFS_DQ_GROUP : -case XFS_DQ_PROJ :return ip->i_gdquot; +case XFS_DQ_PROJ : +return ip->i_pdquot;default :return NULL ; }
fs/xfs/xfs_icache.c +1 -0
@@ -337,6 +337,7 @@ xfs_iget_cache_miss( iflags |=XFS_IDONTCACHE ; ip->i_udquot =NULL ; ip->i_gdquot =NULL ; + ip->i_pdquot =NULL ;xfs_iflags_set (ip, iflags);/* insert the new inode */
fs/xfs/xfs_inode.h +1 -0
@@ -250,6 +250,7 @@ typedef struct xfs_inode {struct xfs_mount *i_mount;/* fs mount struct ptr */ struct xfs_dquot *i_udquot;/* user dquot */ struct xfs_dquot *i_gdquot;/* group dquot */ +struct xfs_dquot *i_pdquot;/* project dquot */ /* Inode location stuff */ xfs_ino_t i_ino;/* inode number (agno/agino)*/
fs/xfs/xfs_ioctl.c +7 -7
@@ -928,7 +928,7 @@ xfs_ioctl_setattr(struct xfs_trans *tp;unsigned int lock_flags =0 ;struct xfs_dquot *udqp =NULL ; -struct xfs_dquot *gdqp =NULL ; +struct xfs_dquot *pdqp =NULL ;struct xfs_dquot *olddquot =NULL ;int code;
@@ -957,7 +957,7 @@ xfs_ioctl_setattr(if (XFS_IS_QUOTA_ON (mp) && (mask &FSX_PROJID )) { code =xfs_qm_vop_dqalloc (ip, ip->i_d.di_uid, ip->i_d.di_gid, fa->fsx_projid, -XFS_QMOPT_PQUOTA , &udqp, &gdqp); +XFS_QMOPT_PQUOTA , &udqp,NULL , &pdqp);if (code)return code; }
@@ -994,8 +994,8 @@ xfs_ioctl_setattr( XFS_IS_PQUOTA_ON(mp) && xfs_get_projid(ip) != fa->fsx_projid) {ASSERT (tp); - code =xfs_qm_vop_chown_reserve (tp, ip, udqp, gdqp, -capable (CAP_FOWNER ) ? + code =xfs_qm_vop_chown_reserve (tp, ip, udqp,NULL , + pdqp,capable (CAP_FOWNER ) ?XFS_QMOPT_FORCE_RES :0 );if (code)/* out of quota */ goto error_return;
@@ -1113,7 +1113,7 @@ xfs_ioctl_setattr(if (xfs_get_projid (ip) != fa->fsx_projid) {if (XFS_IS_QUOTA_RUNNING (mp) &&XFS_IS_PQUOTA_ON (mp)) { olddquot =xfs_qm_vop_chown (tp, ip, - &ip->i_gdquot, gdqp); + &ip->i_pdquot, pdqp); }xfs_set_projid (ip, fa->fsx_projid);
@@ -1160,13 +1160,13 @@ xfs_ioctl_setattr(*/ xfs_qm_dqrele (olddquot);xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);return code; error_return:xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);xfs_trans_cancel (tp,0 );if (lock_flags)xfs_iunlock (ip, lock_flags);
fs/xfs/xfs_iops.c +2 -2
@@ -539,7 +539,7 @@ xfs_setattr_nonsize(ASSERT (udqp ==NULL );ASSERT (gdqp ==NULL ); error =xfs_qm_vop_dqalloc (ip, uid, gid,xfs_get_projid (ip), - qflags, &udqp, &gdqp); + qflags, &udqp, &gdqp,NULL );if (error)return error; }
@@ -575,7 +575,7 @@ xfs_setattr_nonsize( (XFS_IS_GQUOTA_ON(mp) && igid != gid))) {ASSERT (tp); error =xfs_qm_vop_chown_reserve (tp, ip, udqp, gdqp, -capable (CAP_FOWNER ) ? +NULL ,capable (CAP_FOWNER ) ?XFS_QMOPT_FORCE_RES :0 );if (error)/* out of quota */ goto out_trans_cancel;
fs/xfs/xfs_qm.c +172 -69
498 lines not on this page · raw message
fs/xfs/xfs_qm.h +11 -5
@@ -44,9 +44,11 @@ extern struct kmem_zone *xfs_qm_dqtrxzone; typedef struct xfs_quotainfo { struct radix_tree_root qi_uquota_tree; struct radix_tree_root qi_gquota_tree; + struct radix_tree_root qi_pquota_tree; struct mutex qi_tree_lock; struct xfs_inode *qi_uquotaip; struct xfs_inode *qi_gquotaip; + struct xfs_inode *qi_pquotaip; struct list_head qi_lru_list; struct mutex qi_lru_lock; int qi_lru_count;
@@ -78,8 +80,9 @@ xfs_dquot_tree(case XFS_DQ_USER :return &qi->qi_uquota_tree;case XFS_DQ_GROUP : -case XFS_DQ_PROJ :return &qi->qi_gquota_tree; +case XFS_DQ_PROJ : +return &qi->qi_pquota_tree;default :ASSERT (0 ); }
@@ -93,8 +96,9 @@ xfs_dq_to_quota_inode(struct xfs_dquot *dqp)case XFS_DQ_USER :return dqp->q_mount->m_quotainfo->qi_uquotaip;case XFS_DQ_GROUP : -case XFS_DQ_PROJ :return dqp->q_mount->m_quotainfo->qi_gquotaip; +case XFS_DQ_PROJ : +return dqp->q_mount->m_quotainfo->qi_pquotaip;default :ASSERT (0 ); }
@@ -107,18 +111,20 @@ extern void xfs_trans_mod_dquot(struct xfs_trans *, struct xfs_dquot *, uint, long);extern int xfs_trans_reserve_quota_bydquots (struct xfs_trans *,struct xfs_mount *,struct xfs_dquot *, -struct xfs_dquot *,long ,long ,uint ); +struct xfs_dquot *,struct xfs_dquot *, +long ,long ,uint );extern void xfs_trans_dqjoin (struct xfs_trans *,struct xfs_dquot *);extern void xfs_trans_log_dquot (struct xfs_trans *,struct xfs_dquot *);/* -* We keep the usr and grp dquots separately so that locking will be easier -* to do at commit time. All transactions that we know of at this point +* We keep the usr, grp, and prj dquots separately so that locking will be +* easier to do at commit time. All transactions that we know of at this point * affect no more than two dquots of one type. Hence, the TRANS_MAXDQS value. */ enum {XFS_QM_TRANS_USR =0 ,XFS_QM_TRANS_GRP , +XFS_QM_TRANS_PRJ ,XFS_QM_TRANS_DQTYPES };#define XFS_QM_TRANS_MAXDQS 2
fs/xfs/xfs_qm_bhv.c +1 -1
@@ -115,7 +115,7 @@ xfs_qm_newmount( (pquotaondisk && !XFS_IS_PQUOTA_ON(mp)) || (!pquotaondisk && XFS_IS_PQUOTA_ON(mp)) || (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) || - (!gquotaondisk && XFS_IS_OQUOTA_ON(mp))) && + (!gquotaondisk && XFS_IS_GQUOTA_ON(mp))) && xfs_dev_is_read_only(mp, "changing quota state")) { xfs_warn(mp, "please mount with%s%s%s%s.", (!quotaondisk ? "out quota" : ""),
fs/xfs/xfs_qm_syscalls.c +15 -4
@@ -119,7 +119,8 @@ xfs_qm_scall_quotaoff( dqtype |=XFS_QMOPT_GQUOTA ; flags |= (XFS_GQUOTA_CHKD |XFS_GQUOTA_ENFD ); inactivate_flags |=XFS_GQUOTA_ACTIVE ; - }else if (flags &XFS_PQUOTA_ACCT ) { + } +if (flags &XFS_PQUOTA_ACCT ) { dqtype |=XFS_QMOPT_PQUOTA ; flags |= (XFS_PQUOTA_CHKD |XFS_PQUOTA_ENFD ); inactivate_flags |=XFS_PQUOTA_ACTIVE ;
@@ -214,10 +215,14 @@ xfs_qm_scall_quotaoff(IRELE (q->qi_uquotaip); q->qi_uquotaip =NULL ; } -if ((dqtype & (XFS_QMOPT_GQUOTA |XFS_QMOPT_PQUOTA )) && q->qi_gquotaip) { +if ((dqtype &XFS_QMOPT_GQUOTA ) && q->qi_gquotaip) {IRELE (q->qi_gquotaip); q->qi_gquotaip =NULL ; } +if ((dqtype &XFS_QMOPT_PQUOTA ) && q->qi_pquotaip) { +IRELE (q->qi_pquotaip); + q->qi_pquotaip =NULL ; + } out_unlock:mutex_unlock (&q->qi_quotaofflock);
@@ -859,9 +864,11 @@ xfs_dqrele_inode( {/* skip quota inodes */ if (ip == ip->i_mount->m_quotainfo->qi_uquotaip || - ip == ip->i_mount->m_quotainfo->qi_gquotaip) { + ip == ip->i_mount->m_quotainfo->qi_gquotaip || + ip == ip->i_mount->m_quotainfo->qi_pquotaip) {ASSERT (ip->i_udquot ==NULL );ASSERT (ip->i_gdquot ==NULL ); +ASSERT (ip->i_pdquot ==NULL );return 0 ; }
@@ -870,10 +877,14 @@ xfs_dqrele_inode(xfs_qm_dqrele (ip->i_udquot); ip->i_udquot =NULL ; } -if (flags & (XFS_PQUOTA_ACCT |XFS_GQUOTA_ACCT ) && ip->i_gdquot) { +if ((flags &XFS_GQUOTA_ACCT ) && ip->i_gdquot) {xfs_qm_dqrele (ip->i_gdquot); ip->i_gdquot =NULL ; } +if ((flags &XFS_PQUOTA_ACCT ) && ip->i_pdquot) { +xfs_qm_dqrele (ip->i_pdquot); + ip->i_pdquot =NULL ; + }xfs_iunlock (ip,XFS_ILOCK_EXCL );return 0 ; }
fs/xfs/xfs_quota.h +18 -14
@@ -271,10 +271,10 @@ typedef struct xfs_qoff_logformat {* we didn't have the inode locked, the appropriate dquot(s) will be * attached atomically. */ -#define XFS_NOT_DQATTACHED (mp, ip) ((XFS_IS_UQUOTA_ON(mp) &&\ - (ip)->i_udquot == NULL) || \ - (XFS_IS_OQUOTA_ON(mp) && \ - (ip)->i_gdquot == NULL)) +#define XFS_NOT_DQATTACHED (mp, ip) \ + ((XFS_IS_UQUOTA_ON(mp) && (ip)->i_udquot == NULL) || \ + (XFS_IS_GQUOTA_ON(mp) && (ip)->i_gdquot == NULL) || \ + (XFS_IS_PQUOTA_ON(mp) && (ip)->i_pdquot == NULL))#define XFS_QM_NEED_QUOTACHECK (mp) \ ((XFS_IS_UQUOTA_ON(mp) && \
@@ -329,17 +329,18 @@ extern int xfs_trans_reserve_quota_nblks(struct xfs_trans *, struct xfs_inode *, long, long, uint);extern int xfs_trans_reserve_quota_bydquots (struct xfs_trans *,struct xfs_mount *,struct xfs_dquot *, -struct xfs_dquot *,long ,long ,uint ); +struct xfs_dquot *,struct xfs_dquot *,long ,long ,uint );extern int xfs_qm_vop_dqalloc (struct xfs_inode *,uid_t ,gid_t ,prid_t ,uint , -struct xfs_dquot **,struct xfs_dquot **); +struct xfs_dquot **,struct xfs_dquot **,struct xfs_dquot **);extern void xfs_qm_vop_create_dqattach (struct xfs_trans *,struct xfs_inode *, -struct xfs_dquot *,struct xfs_dquot *); +struct xfs_dquot *,struct xfs_dquot *,struct xfs_dquot *);extern int xfs_qm_vop_rename_dqattach (struct xfs_inode **);extern struct xfs_dquot *xfs_qm_vop_chown (struct xfs_trans *,struct xfs_inode *,struct xfs_dquot **,struct xfs_dquot *);extern int xfs_qm_vop_chown_reserve (struct xfs_trans *,struct xfs_inode *, -struct xfs_dquot *,struct xfs_dquot *,uint ); +struct xfs_dquot *,struct xfs_dquot *, +struct xfs_dquot *,uint );extern int xfs_qm_dqattach (struct xfs_inode *,uint );extern int xfs_qm_dqattach_locked (struct xfs_inode *,uint );extern void xfs_qm_dqdetach (struct xfs_inode *);
@@ -353,10 +354,12 @@ extern void xfs_qm_unmount_quotas(struct xfs_mount *);#else static inline int xfs_qm_vop_dqalloc (struct xfs_inode *ip,uid_t uid,gid_t gid,prid_t prid, -uint flags,struct xfs_dquot **udqp,struct xfs_dquot **gdqp) +uint flags,struct xfs_dquot **udqp,struct xfs_dquot **gdqp, +struct xfs_dquot **pdqp) { *udqp =NULL ; *gdqp =NULL ; + *pdqp =NULL ;return 0 ; }#define xfs_trans_dup_dqinfo (tp, tp2)
@@ -371,14 +374,15 @@ static inline int xfs_trans_reserve_quota_nblks(struct xfs_trans *tp, }static inline int xfs_trans_reserve_quota_bydquots (struct xfs_trans *tp,struct xfs_mount *mp,struct xfs_dquot *udqp, -struct xfs_dquot *gdqp,long nblks,long nions,uint flags) +struct xfs_dquot *gdqp,struct xfs_dquot *pdqp, +long nblks,long nions,uint flags) {return 0 ; } -#define xfs_qm_vop_create_dqattach (tp, ip, u, g) +#define xfs_qm_vop_create_dqattach (tp, ip, u, g, p)#define xfs_qm_vop_rename_dqattach (it) (0)#define xfs_qm_vop_chown (tp, ip, old, new) (NULL) -#define xfs_qm_vop_chown_reserve (tp, ip, u, g, fl) (0) +#define xfs_qm_vop_chown_reserve (tp, ip, u, g, p, fl) (0)#define xfs_qm_dqattach (ip, fl) (0)#define xfs_qm_dqattach_locked (ip, fl) (0)#define xfs_qm_dqdetach (ip)
@@ -392,8 +396,8 @@ static inline int xfs_trans_reserve_quota_bydquots(struct xfs_trans *tp,#define xfs_trans_unreserve_quota_nblks (tp, ip, nblks, ninos, flags) \ xfs_trans_reserve_quota_nblks(tp, ip, -(nblks), -(ninos), flags) -#define xfs_trans_reserve_quota (tp, mp, ud, gd, nb, ni, f) \ - xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, nb, ni, \ +#define xfs_trans_reserve_quota (tp, mp, ud, gd, pd, nb, ni, f) \ + xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, pd, nb, ni, \ f | XFS_QMOPT_RES_REGBLKS) extern int xfs_qm_dqcheck(struct xfs_mount *, xfs_disk_dquot_t *,
fs/xfs/xfs_symlink.c +7 -3
@@ -360,6 +360,7 @@ xfs_symlink(prid_t prid;struct xfs_dquot *udqp =NULL ;struct xfs_dquot *gdqp =NULL ; +struct xfs_dquot *pdqp =NULL ;uint resblks; *ipp =NULL ;
@@ -386,7 +387,7 @@ xfs_symlink(* Make sure that we have allocated dquot(s) on disk. */ error =xfs_qm_vop_dqalloc (dp,current_fsuid (),current_fsgid (), prid, -XFS_QMOPT_QUOTALL |XFS_QMOPT_INHERIT , &udqp, &gdqp); +XFS_QMOPT_QUOTALL |XFS_QMOPT_INHERIT , &udqp, &gdqp, &pdqp);if (error) goto std_return;
@@ -427,7 +428,8 @@ xfs_symlink(/* * Reserve disk quota : blocks and inode. */ - error =xfs_trans_reserve_quota (tp, mp, udqp, gdqp, resblks,1 ,0 ); + error =xfs_trans_reserve_quota (tp, mp, udqp, gdqp, + pdqp, resblks,1 ,0 );if (error) goto error_return;
@@ -465,7 +467,7 @@ xfs_symlink(/* * Also attach the dquot(s) to it, if applicable. */ -xfs_qm_vop_create_dqattach (tp, ip, udqp, gdqp); +xfs_qm_vop_create_dqattach (tp, ip, udqp, gdqp, pdqp);if (resblks) resblks -=XFS_IALLOC_SPACE_RES (mp);
@@ -563,6 +565,7 @@ xfs_symlink( error =xfs_trans_commit (tp,XFS_TRANS_RELEASE_LOG_RES );xfs_qm_dqrele (udqp);xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp); *ipp = ip;return 0 ;
@@ -576,6 +579,7 @@ xfs_symlink(xfs_trans_cancel (tp, cancel_flags);xfs_qm_dqrele (udqp);xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);if (unlock_dp_on_error)xfs_iunlock (dp,XFS_ILOCK_EXCL );
fs/xfs/xfs_trans_dquot.c +22 -4
@@ -163,8 +163,10 @@ xfs_trans_mod_dquot_byino(if (XFS_IS_UQUOTA_ON (mp) && ip->i_udquot) (void )xfs_trans_mod_dquot (tp, ip->i_udquot, field, delta); -if (XFS_IS_OQUOTA_ON (mp) && ip->i_gdquot) +if (XFS_IS_GQUOTA_ON (mp) && ip->i_gdquot) (void )xfs_trans_mod_dquot (tp, ip->i_gdquot, field, delta); +if (XFS_IS_PQUOTA_ON (mp) && ip->i_pdquot) + (void )xfs_trans_mod_dquot (tp, ip->i_pdquot, field, delta); } STATIC struct xfs_dqtrx *
@@ -177,8 +179,12 @@ xfs_trans_get_dqtrx(if (XFS_QM_ISUDQ (dqp)) qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_USR ]; -else +else if (XFS_QM_ISGDQ (dqp)) qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_GRP ]; +else if (XFS_QM_ISPDQ (dqp)) + qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_PRJ ]; +else +return NULL ;for (i =0 ; i <XFS_QM_TRANS_MAXDQS ; i++) { if (qa[i].qt_dquot == NULL ||
@@ -728,8 +734,8 @@ error_return:/* * Given dquot(s), make disk block and/or inode reservations against them. -* The fact that this does the reservation against both the usr and -* grp/prj quotas is important, because this follows a both-or-nothing +* The fact that this does the reservation against user, group and +* project quotas is important, because this follows a all-or-nothing * approach. * * flags = XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown.
@@ -744,6 +750,7 @@ xfs_trans_reserve_quota_bydquots(struct xfs_mount *mp, struct xfs_dquot *udqp, struct xfs_dquot *gdqp, + struct xfs_dquot *pdqp, long nblks, long ninos, uint flags)
@@ -771,11 +778,21 @@ xfs_trans_reserve_quota_bydquots( goto unwind_usr; } +if (pdqp) { + error =xfs_trans_dqresv (tp, mp, pdqp, nblks, ninos, flags); +if (error) + goto unwind_grp; + } +/* * Didn't change anything critical, so, no need to log */ return 0 ; +unwind_grp: + flags |=XFS_QMOPT_FORCE_RES ; +if (gdqp) +xfs_trans_dqresv (tp, mp, gdqp, -nblks, -ninos, flags); unwind_usr: flags |=XFS_QMOPT_FORCE_RES ;if (udqp)
@@ -817,6 +834,7 @@ xfs_trans_reserve_quota_nblks(*/ return xfs_trans_reserve_quota_bydquots (tp, mp, ip->i_udquot, ip->i_gdquot, + ip->i_pdquot, nblks, ninos, flags); }
fs/xfs/xfs_vnodeops.c +9 -4
@@ -489,6 +489,7 @@ xfs_create(prid_t prid;struct xfs_dquot *udqp =NULL ;struct xfs_dquot *gdqp =NULL ; +struct xfs_dquot *pdqp =NULL ;uint resblks;uint log_res;uint log_count;
@@ -507,7 +508,8 @@ xfs_create(* Make sure that we have allocated dquot(s) on disk. */ error =xfs_qm_vop_dqalloc (dp,current_fsuid (),current_fsgid (), prid, -XFS_QMOPT_QUOTALL |XFS_QMOPT_INHERIT , &udqp, &gdqp); +XFS_QMOPT_QUOTALL |XFS_QMOPT_INHERIT , + &udqp, &gdqp, &pdqp);if (error)return error;
@@ -559,7 +561,8 @@ xfs_create(/* * Reserve disk quota and the inode. */ - error =xfs_trans_reserve_quota (tp, mp, udqp, gdqp, resblks,1 ,0 ); + error =xfs_trans_reserve_quota (tp, mp, udqp, gdqp, + pdqp, resblks,1 ,0 );if (error) goto out_trans_cancel;
@@ -623,7 +626,7 @@ xfs_create(* These ids of the inode couldn't have changed since the new * inode has been locked ever since it was created. */ -xfs_qm_vop_create_dqattach (tp, ip, udqp, gdqp); +xfs_qm_vop_create_dqattach (tp, ip, udqp, gdqp, pdqp); error =xfs_bmap_finish (&tp, &free_list, &committed);if (error)
@@ -635,6 +638,7 @@ xfs_create(xfs_qm_dqrele (udqp);xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp); *ipp = ip;return 0 ;
@@ -656,6 +660,7 @@ xfs_create(xfs_qm_dqrele (udqp);xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);if (unlock_dp_on_error)xfs_iunlock (dp,XFS_ILOCK_EXCL );
@@ -1568,7 +1573,7 @@ xfs_free_file_space( }xfs_ilock (ip,XFS_ILOCK_EXCL ); error =xfs_trans_reserve_quota (tp, mp, - ip->i_udquot, ip->i_gdquot, + ip->i_udquot, ip->i_gdquot, ip->i_pdquot, resblks,0 ,XFS_QMOPT_RES_REGBLKS );if (error) goto error1;
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 08/11] xfs: Add pquota fields where gquota is used.
Hi Chandra,
Quoted 8 lines · Chandra Seetharaman
Add project quota changes to all the places where group quota field is used:
* add separate project quota members into various structures
* split project quota and group quotas so that instead of overriding the group quota members incore, the new project quota members are used instead
* get rid of usage of the OQUOTA flag incore, in favor of separate
* group and project quota flags.
^ * is extra?
Quoted 5 lines
* add a project dquot argument to various functions.
Not using the pquotino field from superblock yet.
Signed-off-by Chandra Seetharaman <[email protected]>
Patch looks good to me.
I had just a few tiny nits and questions I found in review. If you were not already planning to repost I suggest you ignore them. ;)
Regards,
Ben
Quoted 48 lines
fs/xfs/xfs_ioctl.c +6
-6@@ -928,7 +928,7 @@ xfs_ioctl_setattr(struct xfs_trans *tp;unsigned int lock_flags =0 ;struct xfs_dquot *udqp =NULL ; -struct xfs_dquot *gdqp =NULL ; +struct xfs_dquot *pdqp =NULL ;struct xfs_dquot *olddquot =NULL ;int code;@@ -957,7 +957,7 @@ xfs_ioctl_setattr(if (XFS_IS_QUOTA_ON (mp) && (mask &FSX_PROJID )) { code =xfs_qm_vop_dqalloc (ip, ip->i_d.di_uid, ip->i_d.di_gid, fa->fsx_projid, -XFS_QMOPT_PQUOTA , &udqp, &gdqp); +XFS_QMOPT_PQUOTA , &udqp,NULL , &pdqp);if (code)return code; }@@ -994,8 +994,8 @@ xfs_ioctl_setattr( XFS_IS_PQUOTA_ON(mp) && xfs_get_projid(ip) != fa->fsx_projid) {ASSERT (tp); - code =xfs_qm_vop_chown_reserve (tp, ip, udqp, gdqp, -capable (CAP_FOWNER ) ? + code =xfs_qm_vop_chown_reserve (tp, ip, udqp,NULL , + pdqp,capable (CAP_FOWNER ) ?XFS_QMOPT_FORCE_RES :0 );if (code)/* out of quota */ goto error_return;@@ -1113,7 +1113,7 @@ xfs_ioctl_setattr(if (xfs_get_projid (ip) != fa->fsx_projid) {if (XFS_IS_QUOTA_RUNNING (mp) &&XFS_IS_PQUOTA_ON (mp)) { olddquot =xfs_qm_vop_chown (tp, ip, - &ip->i_gdquot, gdqp); + &ip->i_pdquot, pdqp); }xfs_set_projid (ip, fa->fsx_projid);@@ -1160,13 +1160,13 @@ xfs_ioctl_setattr(*/ xfs_qm_dqrele (olddquot);xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);
fs/xfs/xfs_ioctl.c xfs_ioctl_setattr( · line 1172
Quoted 10 lines
fs/xfs/xfs_ioctl.c +1
-1return code; error_return:xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);xfs_trans_cancel (tp,0 );if (lock_flags)xfs_iunlock (ip, lock_flags);
Here in xfs_ioctl_setattr, I'm not clear on why we're messing with the user dquot at all. Could it be removed entirely? A change in project id doesn't effect user quota, right?
Maybe that's an idea for a separate patch.
fs/xfs/xfs_ioctl.c
Quoted 10 lines
STATIC void
fs/xfs/xfs_ioctl.c +4
-4-xfs_qm_dqattach_grouphint ( - xfs_dquot_t *udq, - xfs_dquot_t *gdq) +xfs_qm_dqattach_hint( + struct xfs_inode *ip, + int type) { -xfs_dquot_t *tmp; +struct xfs_dquot **dqhint;
Maybe clearer as dqhintp.
fs/xfs/xfs_ioctl.c
Quoted 8 lines
fs/xfs/xfs_ioctl.c +2
-3+struct xfs_dquot *dqp; +struct xfs_dquot *udq = ip->i_udquot;xfs_dqlock (udq); - tmp = udq->q_gdquot; -if (tmp) { -if (tmp == gdq)
If I understand this xfs_qm_dqattach_hint correctly, this might be nice:
ASSERT(type == XFS_DQ_GROUP || type == XFS_DQ_PROJ);
fs/xfs/xfs_qm_bhv.c xfs_qm_newmount( · line 118
Quoted 10 lines
fs/xfs/xfs_qm_bhv.c +1
-1@@ -115,7 +115,7 @@ xfs_qm_newmount( (pquotaondisk && !XFS_IS_PQUOTA_ON (mp)) || (!pquotaondisk &&XFS_IS_PQUOTA_ON (mp)) || (gquotaondisk && !XFS_IS_GQUOTA_ON (mp)) || - (!gquotaondisk && XFS_IS_OQUOTA_ON(mp))) && + (!gquotaondisk && XFS_IS_GQUOTA_ON(mp))) &&
These are not in the usual user/group/project order, and so are some other checks in this function. Could be cleaned up. Maybe a different patch too.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 08/11] xfs: Add pquota fields where gquota is used.
I am rolling up a new set with changes based on David's comments and Jan's comments.
Will address your comments too.
Quoted 12 lines · Ben Myers
Hi Chandra,
Quoted 8 lines · Chandra Seetharaman
Add project quota changes to all the places where group quota field is used:
* add separate project quota members into various structures
* split project quota and group quotas so that instead of overriding the group quota members incore, the new project quota members are used instead
* get rid of usage of the OQUOTA flag incore, in favor of separate
* group and project quota flags.
Quoted 1 line
^ * is extra?
will fix
Quoted 80 lines
Quoted 6 lines
* add a project dquot argument to various functions.
Not using the pquotino field from superblock yet.
Signed-off-by Chandra Seetharaman <[email protected]>Patch looks good to me.
Reviewed-by Ben Myers <[email protected]>I had just a few tiny nits and questions I found in review. If you were not already planning to repost I suggest you ignore them. ;)
Regards,
BenQuoted 48 lines
fs/xfs/xfs_ioctl.c +6
-6@@ -928,7 +928,7 @@ xfs_ioctl_setattr(struct xfs_trans *tp;unsigned int lock_flags =0 ;struct xfs_dquot *udqp =NULL ; -struct xfs_dquot *gdqp =NULL ; +struct xfs_dquot *pdqp =NULL ;struct xfs_dquot *olddquot =NULL ;int code;@@ -957,7 +957,7 @@ xfs_ioctl_setattr(if (XFS_IS_QUOTA_ON (mp) && (mask &FSX_PROJID )) { code =xfs_qm_vop_dqalloc (ip, ip->i_d.di_uid, ip->i_d.di_gid, fa->fsx_projid, -XFS_QMOPT_PQUOTA , &udqp, &gdqp); +XFS_QMOPT_PQUOTA , &udqp,NULL , &pdqp);if (code)return code; }@@ -994,8 +994,8 @@ xfs_ioctl_setattr( XFS_IS_PQUOTA_ON(mp) && xfs_get_projid(ip) != fa->fsx_projid) {ASSERT (tp); - code =xfs_qm_vop_chown_reserve (tp, ip, udqp, gdqp, -capable (CAP_FOWNER ) ? + code =xfs_qm_vop_chown_reserve (tp, ip, udqp,NULL , + pdqp,capable (CAP_FOWNER ) ?XFS_QMOPT_FORCE_RES :0 );if (code)/* out of quota */ goto error_return;@@ -1113,7 +1113,7 @@ xfs_ioctl_setattr(if (xfs_get_projid (ip) != fa->fsx_projid) {if (XFS_IS_QUOTA_RUNNING (mp) &&XFS_IS_PQUOTA_ON (mp)) { olddquot =xfs_qm_vop_chown (tp, ip, - &ip->i_gdquot, gdqp); + &ip->i_pdquot, pdqp); }xfs_set_projid (ip, fa->fsx_projid);@@ -1160,13 +1160,13 @@ xfs_ioctl_setattr(*/ xfs_qm_dqrele (olddquot);xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);fs/xfs/xfs_ioctl.c xfs_ioctl_setattr( · line 1172
Quoted 10 lines
fs/xfs/xfs_ioctl.c +1
-1return code; error_return:xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);xfs_trans_cancel (tp,0 );if (lock_flags)xfs_iunlock (ip, lock_flags);Here in
xfs_ioctl_setattr, I'm not clear on why we're messing with the user dquot at all. Could it be removed entirely? A change in project id doesn't effect user quota, right?
Quoted 1 line
Maybe that's an idea for a separate patch.
I will look into that after these get in :)
Quoted 14 lines
fs/xfs/xfs_ioctl.c
Quoted 11 lines
STATIC void
fs/xfs/xfs_ioctl.c +4
-4-xfs_qm_dqattach_grouphint ( - xfs_dquot_t *udq, - xfs_dquot_t *gdq) +xfs_qm_dqattach_hint( + struct xfs_inode *ip, + int type) { -xfs_dquot_t *tmp; +struct xfs_dquot **dqhint;Maybe clearer as dqhintp.
sure.
Quoted 5 lines
Quoted 5 lines
fs/xfs/xfs_ioctl.c +2
-0+struct xfs_dquot *dqp; +struct xfs_dquot *udq = ip->i_udquot;xfs_dqlock (udq);
Quoted 7 lines
fs/xfs/xfs_ioctl.c
Quoted 3 lines
fs/xfs/xfs_ioctl.c +0
-3- tmp = udq->q_gdquot; -if (tmp) { -if (tmp == gdq)If I understand this
xfs_qm_dqattach_hintcorrectly, this might be nice:ASSERT(type == XFS_DQ_GROUP || type == XFS_DQ_PROJ);
will do.
Quoted 15 lines
fs/xfs/xfs_qm_bhv.c xfs_qm_newmount( · line 118
Quoted 11 lines
fs/xfs/xfs_qm_bhv.c +1
-1@@ -115,7 +115,7 @@ xfs_qm_newmount( (pquotaondisk && !XFS_IS_PQUOTA_ON (mp)) || (!pquotaondisk &&XFS_IS_PQUOTA_ON (mp)) || (gquotaondisk && !XFS_IS_GQUOTA_ON (mp)) || - (!gquotaondisk && XFS_IS_OQUOTA_ON(mp))) && + (!gquotaondisk && XFS_IS_GQUOTA_ON(mp))) &&These are not in the usual user/group/project order, and so are some other checks in this function. Could be cleaned up. Maybe a different patch too.
I thought I fixed all of them around. Will fix this too.
Quoted 5 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 08/11] xfs: Add pquota fields where gquota is used.
Quoted 21 lines · Chandra Seetharaman
Quoted 21 lines
Quoted 6 lines
fs/xfs/xfs_ioctl.c +1
-1@@ -1160,13 +1160,13 @@ xfs_ioctl_setattr(*/ xfs_qm_dqrele (olddquot);xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);fs/xfs/xfs_ioctl.c xfs_ioctl_setattr( · line 1172
Quoted 10 lines
fs/xfs/xfs_ioctl.c +1
-1return code; error_return:xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);xfs_trans_cancel (tp,0 );if (lock_flags)xfs_iunlock (ip, lock_flags);Here in
xfs_ioctl_setattr, I'm not clear on why we're messing with the user dquot at all. Could it be removed entirely? A change in project id doesn't effect user quota, right?
Quoted 3 lines
Quoted 1 line
Maybe that's an idea for a separate patch.
I will look into that after these get in :)
The user dquot may have group and/or project dquot hints attached to it. Therefore if we are changing project quota and user quotas are enabled, then we may have to remove the hint from the user dquot that points to the old project dquot....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 08/11] xfs: Add pquota fields where gquota is used.
Quoted 22 lines · Dave Chinner
Quoted 21 lines · Chandra Seetharaman
Quoted 21 lines
Quoted 6 lines
fs/xfs/xfs_ioctl.c +1
-1@@ -1160,13 +1160,13 @@ xfs_ioctl_setattr(*/ xfs_qm_dqrele (olddquot);xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);fs/xfs/xfs_ioctl.c xfs_ioctl_setattr( · line 1172
Quoted 10 lines
fs/xfs/xfs_ioctl.c +1
-1return code; error_return:xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp);xfs_trans_cancel (tp,0 );if (lock_flags)xfs_iunlock (ip, lock_flags);Here in
xfs_ioctl_setattr, I'm not clear on why we're messing with the user dquot at all. Could it be removed entirely? A change in project id doesn't effect user quota, right?
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Maybe that's an idea for a separate patch.
I will look into that after these get in :)
The user dquot may have group and/or project dquot hints attached to it. Therefore if we are changing project quota and user quotas are enabled, then we may have to remove the hint from the user dquot that points to the old project dquot....
Thanks for the explanation Dave.
Quoted 4 lines
Cheers,
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 9/11 xfs: Start using pquotaino from the superblock.
In reply to Chandra SeetharamanStart using pquotino and define a macro to check if the superblock has pquotino.
Keep backward compatibilty by alowing mount of older superblock with no separate pquota inode.
--- fs/xfs/xfs_fsops.c | 3 +- fs/xfs/xfs_mount.c | 44 ++++++++++++++++++++++++++++++++++----- fs/xfs/xfs_qm.c | 29 ++++++++++++++++---------- fs/xfs/xfs_qm_syscalls.c | 24 +++++++++++++++++++-- fs/xfs/xfs_quota.h | 8 ------- fs/xfs/xfs_sb.h | 16 +++++++++++++- fs/xfs/xfs_super.c | 14 +++++++----- include/uapi/linux/dqblk_xfs.h | 1 + 8 files changed, 103 insertions(+), 36 deletions(-)
fs/xfs/xfs_fsops.c +2 -1
@@ -501,7 +501,8 @@ xfs_growfs_data_private( error, agno);break ; } -xfs_sb_to_disk (XFS_BUF_TO_SBP (bp), &mp->m_sb,XFS_SB_ALL_BITS ); +xfs_sb_to_disk (XFS_BUF_TO_SBP (bp), &mp->m_sb, +xfs_sb_all_bits (&mp->m_sb));/* * If we get an error writing out the alternate superblocks,
fs/xfs/xfs_mount.c +38 -6
74 lines not on this page · raw message
fs/xfs/xfs_qm.c +18 -11
@@ -857,22 +857,21 @@ xfs_qm_qino_alloc(spin_lock (&mp->m_sb_lock);if (flags &XFS_QMOPT_SBVERSION ) {ASSERT (!xfs_sb_version_hasquota (&mp->m_sb)); -ASSERT ((sbfields & (XFS_SB_VERSIONNUM |XFS_SB_UQUOTINO | -XFS_SB_GQUOTINO |XFS_SB_QFLAGS )) == - (XFS_SB_VERSIONNUM |XFS_SB_UQUOTINO | -XFS_SB_GQUOTINO |XFS_SB_QFLAGS ));xfs_sb_version_addquota (&mp->m_sb); mp->m_sb.sb_uquotino =NULLFSINO ; mp->m_sb.sb_gquotino =NULLFSINO ; + mp->m_sb.sb_pquotino =NULLFSINO ;/* qflags will get updated _after_ quotacheck */ mp->m_sb.sb_qflags =0 ; }if (flags &XFS_QMOPT_UQUOTA ) mp->m_sb.sb_uquotino = (*ip)->i_ino; -else +else if (flags &XFS_QMOPT_GQUOTA ) mp->m_sb.sb_gquotino = (*ip)->i_ino; +else + mp->m_sb.sb_pquotino = (*ip)->i_ino;spin_unlock (&mp->m_sb_lock);xfs_mod_sb (tp, sbfields);
@@ -1482,11 +1481,10 @@ xfs_qm_init_quotainos(if (error) goto error_rele; } -/* XXX: Use gquotino for now */ if (XFS_IS_PQUOTA_ON (mp) && - mp->m_sb.sb_gquotino !=NULLFSINO ) { -ASSERT (mp->m_sb.sb_gquotino >0 ); - error =xfs_iget (mp,NULL , mp->m_sb.sb_gquotino, + mp->m_sb.sb_pquotino !=NULLFSINO ) { +ASSERT (mp->m_sb.sb_pquotino >0 ); + error =xfs_iget (mp,NULL , mp->m_sb.sb_pquotino,0 ,0 , &pip);if (error) goto error_rele;
@@ -1495,6 +1493,8 @@ xfs_qm_init_quotainos( flags |=XFS_QMOPT_SBVERSION ; sbflags |= (XFS_SB_VERSIONNUM |XFS_SB_UQUOTINO |XFS_SB_GQUOTINO |XFS_SB_QFLAGS ); +if (xfs_sb_version_has_pquota (&mp->m_sb)) + sbflags |=XFS_SB_PQUOTINO ; }/*
@@ -1522,9 +1522,16 @@ xfs_qm_init_quotainos( flags &= ~XFS_QMOPT_SBVERSION ; }if (XFS_IS_PQUOTA_ON (mp) && pip ==NULL ) { -/* XXX: Use XFS_SB_GQUOTINO for now */ +if (!xfs_sb_version_has_pquota (&mp->m_sb)) +/* +* If our superblock is an earlier version, we can +* use either XFS_SB_GQUOTINO or XFS_SB_PQUOTINO +* but not both. Clear XFS_SB_GQUOTINO as it might +* be set above. +*/ + sbflags &= ~XFS_SB_GQUOTINO ; error =xfs_qm_qino_alloc (mp, &pip, - sbflags |XFS_SB_GQUOTINO , + sbflags |XFS_SB_PQUOTINO , flags |XFS_QMOPT_PQUOTA );if (error) goto error_rele;
fs/xfs/xfs_qm_syscalls.c +21 -3
@@ -201,8 +201,7 @@ xfs_qm_scall_quotaoff(/* * If quotas is completely disabled, close shop. */ -if (((flags &XFS_MOUNT_QUOTA_ALL ) ==XFS_MOUNT_QUOTA_SET1 ) || - ((flags &XFS_MOUNT_QUOTA_ALL ) ==XFS_MOUNT_QUOTA_SET2 )) { +if ((flags &XFS_MOUNT_QUOTA_ALL ) ==XFS_MOUNT_QUOTA_ALL ) {mutex_unlock (&q->qi_quotaofflock);xfs_qm_destroy_quotainfo (mp);return (0 );
@@ -297,8 +296,10 @@ xfs_qm_scall_trunc_qfiles(if (flags &XFS_DQ_USER ) error =xfs_qm_scall_trunc_qfile (mp, mp->m_sb.sb_uquotino); -if (flags & (XFS_DQ_GROUP |XFS_DQ_PROJ )) +if (flags &XFS_DQ_GROUP ) error2 =xfs_qm_scall_trunc_qfile (mp, mp->m_sb.sb_gquotino); +if (flags &XFS_DQ_PROJ ) + error2 =xfs_qm_scall_trunc_qfile (mp, mp->m_sb.sb_pquotino);return error ? error : error2; }
@@ -414,8 +415,10 @@ xfs_qm_scall_getqstat(struct xfs_quotainfo *q = mp->m_quotainfo;struct xfs_inode *uip =NULL ;struct xfs_inode *gip =NULL ; +struct xfs_inode *pip =NULL ;bool tempuqip = false;bool tempgqip = false; +bool temppqip = false;memset (out,0 ,sizeof (fs_quota_stat_t));
@@ -423,6 +426,7 @@ xfs_qm_scall_getqstat(if (!xfs_sb_version_hasquota (&mp->m_sb)) { out->qs_uquota.qfs_ino =NULLFSINO ; out->qs_gquota.qfs_ino =NULLFSINO ; + out->qs_pquota.qfs_ino =NULLFSINO ;return (0 ); } out->qs_flags = (__uint16_t) xfs_qm_export_flags(mp->m_qflags &
@@ -431,10 +435,13 @@ xfs_qm_scall_getqstat( out->qs_pad =0 ; out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino; +if (&out->qs_gquota != &out->qs_pquota) + out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino;if (q) { uip = q->qi_uquotaip; gip = q->qi_gquotaip; + pip = q->qi_pquotaip; }if (!uip && mp->m_sb.sb_uquotino !=NULLFSINO ) { if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
@@ -446,6 +453,11 @@ xfs_qm_scall_getqstat( 0, 0, &gip) == 0) tempgqip = true; } +if (!pip && mp->m_sb.sb_pquotino !=NULLFSINO ) { +if (xfs_iget (mp,NULL , mp->m_sb.sb_pquotino, +0 ,0 , &pip) ==0 ) + temppqip = true; + }if (uip) { out->qs_uquota.qfs_nblks = uip->i_d.di_nblocks; out->qs_uquota.qfs_nextents = uip->i_d.di_nextents;
@@ -458,6 +470,12 @@ xfs_qm_scall_getqstat(if (tempgqip)IRELE (gip); } +if (pip) { + out->qs_pquota.qfs_nblks = pip->i_d.di_nblocks; + out->qs_pquota.qfs_nextents = pip->i_d.di_nextents; +if (temppqip) +IRELE (pip); + }if (q) { out->qs_incoredqs = q->qi_dquots; out->qs_btimelimit = q->qi_btimelimit;
fs/xfs/xfs_quota.h +0 -8
@@ -284,14 +284,6 @@ typedef struct xfs_qoff_logformat { (XFS_IS_PQUOTA_ON(mp) && \ (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD) == 0)) -#define XFS_MOUNT_QUOTA_SET1 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ - XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\ - XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD) - -#define XFS_MOUNT_QUOTA_SET2 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ - XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ - XFS_PQUOTA_ENFD|XFS_PQUOTA_CHKD) -#define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\ XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD|\
fs/xfs/xfs_sb.h +15 -1
@@ -621,7 +621,21 @@ xfs_sb_has_incompat_log_feature(static inline bool xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) { -return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +return (ino == sbp->sb_uquotino || + ino == sbp->sb_gquotino || + ino == sbp->sb_pquotino); +} + +static inline int xfs_sb_version_has_pquota (xfs_sb_t *sbp) +{ +return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; +} + +static inline __int64_t xfs_sb_all_bits (xfs_sb_t *sbp) +{ +if (xfs_sb_version_has_pquota (sbp)) +return XFS_SB_ALL_BITS ; +return XFS_SB_ALL_BITS & ~XFS_SB_PQUOTINO ; }/*
fs/xfs/xfs_super.c +8 -6
@@ -420,12 +420,6 @@ xfs_parseargs( }#endif -if ((mp->m_qflags & (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE )) && - (mp->m_qflags & (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE ))) { -xfs_warn (mp,"cannot mount with both project and group quota" ); -return EINVAL ; - } -if ((dsunit && !dswidth) || (!dsunit && dswidth)) {xfs_warn (mp,"sunit and swidth must be specified together" );return EINVAL ;
@@ -1395,6 +1389,14 @@ xfs_finish_flags(return XFS_ERROR (EROFS ); } +if ((mp->m_qflags & (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE )) && + (mp->m_qflags & (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE )) && + !xfs_sb_version_has_pquota (&mp->m_sb)) { +xfs_warn (mp, +"Super block does not support project and group quota together" ); +return XFS_ERROR (EINVAL ); + } +return 0 ; }
include/uapi/linux/dqblk_xfs.h +1 -0
@@ -155,6 +155,7 @@ typedef struct fs_quota_stat {__s8 qs_pad;/* unused */ fs_qfilestat_t qs_uquota;/* user quota storage information */ fs_qfilestat_t qs_gquota;/* group quota storage information */ +#define qs_pquota qs_gquota__u32 qs_incoredqs;/* number of dquots incore */ __s32 qs_btimelimit;/* limit for blks timer */ __s32 qs_itimelimit;/* limit for inodes timer */
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 09/11] xfs: Start using pquotaino from the superblock.
Quoted 7 lines · Chandra Seetharaman
Start using pquotino and define a macro to check if the superblock has pquotino.
Keep backward compatibilty by alowing mount of older superblock with no separate pquota inode.
Signed-off-by Chandra Seetharaman <[email protected]>
This is unchanged from the previous version, so all of my review comments from here:
http://oss.sgi.com/pipermail/xfs/2013-June/027637.html
are still unaddressed.
Also:
Quoted 7 lines
fs/xfs/xfs_mount.c +3
-0@@ -885,6 +905,18 @@ reread:*/ xfs_sb_from_disk (&mp->m_sb,XFS_BUF_TO_SBP (bp)); +if (!xfs_sb_version_has_pquota (&mp->m_sb) && (XFS_IS_PQUOTA_ON (mp))) { +/* +* On disk superblock only has sb_gquotino, and incore
fs/xfs/xfs_mount.c reread: · line 920
Quoted 10 lines
fs/xfs/xfs_mount.c +9
-0+* superblock has both sb_gquotino and sb_pquotino. +* But, only one them is supported at any point of time. +* So, if PQUOTA is set in disk superblock, copy over +* sb_gquotino to sb_pquotino. +*/ + mp->m_sb.sb_pquotino = mp->m_sb.sb_gquotino; + mp->m_sb.sb_gquotino =NULLFSINO ; + } +xfs_sb_quota_from_disk (&mp->m_sb);
This code should be inside xfs_sb_quota_from_disk()....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 09/11] xfs: Start using pquotaino from the superblock.
Quoted 7 lines · Dave Chinner
Quoted 6 lines · Chandra Seetharaman
Start using pquotino and define a macro to check if the superblock has pquotino.
Keep backward compatibilty by alowing mount of older superblock with no separate pquota inode.
Quoted 8 lines
Quoted 1 line
Signed-off-by Chandra Seetharaman <[email protected]>This is unchanged from the previous version, so all of my review comments from here:
http://oss.sgi.com/pipermail/xfs/2013-June/027637.html
are still unaddressed.
See the other email I sent on this context.
Quoted 7 lines
Also:
Quoted 4 lines
fs/xfs/xfs_mount.c +0
-0@@ -885,6 +905,18 @@ reread:*/ xfs_sb_from_disk (&mp->m_sb,XFS_BUF_TO_SBP (bp));
Quoted 15 lines
fs/xfs/xfs_mount.c reread: · line 920
Quoted 13 lines
fs/xfs/xfs_mount.c +12
-0+if (!xfs_sb_version_has_pquota (&mp->m_sb) && (XFS_IS_PQUOTA_ON (mp))) { +/* +* On disk superblock only has sb_gquotino, and incore +* superblock has both sb_gquotino and sb_pquotino. +* But, only one them is supported at any point of time. +* So, if PQUOTA is set in disk superblock, copy over +* sb_gquotino to sb_pquotino. +*/ + mp->m_sb.sb_pquotino = mp->m_sb.sb_gquotino; + mp->m_sb.sb_gquotino =NULLFSINO ; + } +xfs_sb_quota_from_disk (&mp->m_sb);This code should be inside
xfs_sb_quota_from_disk()....
will move.
Quoted 4 lines
Cheers,
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 09/11] xfs: Start using pquotaino from the superblock.
Hi Dave,
Any comments ?
Thanks
Chandra
Quoted 45 lines · Chandra Seetharaman
Quoted 7 lines · Dave Chinner
Quoted 6 lines · Chandra Seetharaman
Start using pquotino and define a macro to check if the superblock has pquotino.
Keep backward compatibilty by alowing mount of older superblock with no separate pquota inode.
Quoted 8 lines
Quoted 1 line
Signed-off-by Chandra Seetharaman <[email protected]>This is unchanged from the previous version, so all of my review comments from here:
http://oss.sgi.com/pipermail/xfs/2013-June/027637.html
are still unaddressed.
See the other email I sent on this context.
Quoted 7 lines
Also:
Quoted 4 lines
fs/xfs/xfs_mount.c +0
-0@@ -885,6 +905,18 @@ reread:*/ xfs_sb_from_disk (&mp->m_sb,XFS_BUF_TO_SBP (bp));Quoted 15 lines
fs/xfs/xfs_mount.c reread: · line 920
Quoted 13 lines
fs/xfs/xfs_mount.c +12
-0+if (!xfs_sb_version_has_pquota (&mp->m_sb) && (XFS_IS_PQUOTA_ON (mp))) { +/* +* On disk superblock only has sb_gquotino, and incore +* superblock has both sb_gquotino and sb_pquotino. +* But, only one them is supported at any point of time. +* So, if PQUOTA is set in disk superblock, copy over +* sb_gquotino to sb_pquotino. +*/ + mp->m_sb.sb_pquotino = mp->m_sb.sb_gquotino; + mp->m_sb.sb_gquotino =NULLFSINO ; + } +xfs_sb_quota_from_disk (&mp->m_sb);This code should be inside
xfs_sb_quota_from_disk()....will move.
Quoted 3 lines
Cheers,
Quoted 8 lines
Quoted 1 line
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 09/11] xfs: Start using pquotaino from the superblock.
Quoted 3 lines · Chandra Seetharaman
Hi Dave,
Any comments ?
Patience, please. Some of us have more than one problem to solve at a time. I've responded in the other thread.
FWIW, I just found out that SGI are on holidays this week(*), so it will be next week before there's any chance of this being merged. You've got plenty of time to revise and repost it... ;)
Cheers,
Dave.
(*) I'm a bit annoyed that maintainers didn't think to tell us that they would be absent this week. I've been wondering why they'd been silent since last Friday given the 3.11 merge window opened a few days ago...
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 10/11 quota: Add proper versioning support to fs_quota_stat
In reply to Chandra SeetharamanAdded appropriate pads and code for backward compatibility.
Copied over the old version as it is different from the newer padded version.
New callers of the system call have to set the version of the data structure being passed, and kernel will fill as much data as requested.
--- fs/gfs2/quota.c | 3 -- fs/quota/quota.c | 49 ++++++++++++++++++++++++++++++++++- fs/xfs/xfs_qm_syscalls.c | 4 --- fs/xfs/xfs_super.c | 5 +-- include/uapi/linux/dqblk_xfs.h | 55 ++++++++++++++++++++++++++++++++++----- 5 files changed, 97 insertions(+), 19 deletions(-)
fs/gfs2/quota.c +0 -3
@@ -1443,9 +1443,6 @@ static int gfs2_quota_get_xstate(struct super_block *sb, {struct gfs2_sbd *sdp = sb->s_fs_info; -memset (fqs,0 ,sizeof (struct fs_quota_stat )); - fqs->qs_version =FS_QSTAT_VERSION ; -switch (sdp->sd_args.ar_quota) {case GFS2_QUOTA_ON : fqs->qs_flags |= (FS_QUOTA_UDQ_ENFD |FS_QUOTA_GDQ_ENFD );
fs/quota/quota.c +47 -2
59 lines not on this page · raw message
fs/xfs/xfs_qm_syscalls.c +0 -4
@@ -420,9 +420,6 @@ xfs_qm_scall_getqstat(bool tempgqip = false;bool temppqip = false; -memset (out,0 ,sizeof (fs_quota_stat_t)); - - out->qs_version =FS_QSTAT_VERSION ;if (!xfs_sb_version_hasquota (&mp->m_sb)) { out->qs_uquota.qfs_ino =NULLFSINO ; out->qs_gquota.qfs_ino =NULLFSINO ;
@@ -432,7 +429,6 @@ xfs_qm_scall_getqstat( out->qs_flags = (__uint16_t )xfs_qm_export_flags (mp->m_qflags & (XFS_ALL_QUOTA_ACCT |XFS_ALL_QUOTA_ENFD )); - out->qs_pad =0 ; out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino;if (&out->qs_gquota != &out->qs_pquota)
fs/xfs/xfs_super.c +2 -3
@@ -549,14 +549,13 @@ xfs_showargs(else if (mp->m_qflags &XFS_UQUOTA_ACCT )seq_puts (m,"," MNTOPT_UQUOTANOENF ); -/* Either project or group quotas can be active, not both */ -if (mp->m_qflags &XFS_PQUOTA_ACCT ) {if (mp->m_qflags &XFS_PQUOTA_ENFD )seq_puts (m,"," MNTOPT_PRJQUOTA );else seq_puts (m,"," MNTOPT_PQUOTANOENF ); - }else if (mp->m_qflags &XFS_GQUOTA_ACCT ) { + } +if (mp->m_qflags &XFS_GQUOTA_ACCT ) {if (mp->m_qflags &XFS_GQUOTA_ENFD )seq_puts (m,"," MNTOPT_GRPQUOTA );else
include/uapi/linux/dqblk_xfs.h +48 -7
85 lines not on this page · raw message
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
Hey Chandra,
Quoted 9 lines · Chandra Seetharaman
Added appropriate pads and code for backward compatibility.
Copied over the old version as it is different from the newer padded version.
New callers of the system call have to set the version of the data structure being passed, and kernel will fill as much data as requested.
Signed-off-by Chandra Seetharaman <[email protected]>
I think we also need to
on this one, since he maintains the quota subsystem.
Regards,
Ben
Quoted 227 lines
--- fs/gfs2/quota.c | 3 -- fs/quota/quota.c | 49 ++++++++++++++++++++++++++++++++++- fs/xfs/xfs_qm_syscalls.c | 4 --- fs/xfs/xfs_super.c | 5 +-- include/uapi/linux/dqblk_xfs.h | 55 ++++++++++++++++++++++++++++++++++----- 5 files changed, 97 insertions(+), 19 deletions(-)fs/gfs2/quota.c +0
-3@@ -1443,9 +1443,6 @@ static int gfs2_quota_get_xstate(struct super_block *sb, {struct gfs2_sbd *sdp = sb->s_fs_info; -memset (fqs,0 ,sizeof (struct fs_quota_stat )); - fqs->qs_version =FS_QSTAT_VERSION ; -switch (sdp->sd_args.ar_quota) {case GFS2_QUOTA_ON : fqs->qs_flags |= (FS_QUOTA_UDQ_ENFD |FS_QUOTA_GDQ_ENFD );fs/quota/quota.c +47
-2@@ -207,12 +207,57 @@ static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)static int quota_getxstate (struct super_block *sb,void __user *addr) {struct fs_quota_stat fqs; -int ret; +struct fs_quota_stat_v1 fqs_v1; +int ret, size; +void *fqsp;if (!sb->s_qcop->get_xstate)return -ENOSYS ; + +memset (&fqs,0 ,sizeof (struct fs_quota_stat )); +if (copy_from_user (&fqs, addr,1 ))/* just get the version */ +return -EFAULT ; + +switch (fqs.qs_version) { +case FS_QSTAT_VERSION_2 : + size =FS_QSTAT_V2_SIZE ; +break ; +default : + fqs.qs_version =FS_QSTAT_VERSION ; +/* fallthrough */ +case FS_QSTAT_VERSION : + size =FS_QSTAT_V1_SIZE ; +break ; + } + ret = sb->s_qcop->get_xstate (sb, &fqs); -if (!ret &©_to_user (addr, &fqs,sizeof (fqs))) +if (ret) +return ret; + +if (fqs.qs_version ==FS_QSTAT_VERSION ) { + fqs_v1.qs_version = fqs.qs_version; + fqs_v1.qs_flags = fqs.qs_flags; + fqs_v1.qs_pad =0 ; + + fqs_v1.qs_uquota.qfs_ino = fqs.qs_uquota.qfs_ino; + fqs_v1.qs_uquota.qfs_nblks = fqs.qs_uquota.qfs_nblks; + fqs_v1.qs_uquota.qfs_nextents = fqs.qs_uquota.qfs_nextents; + + fqs_v1.qs_gquota.qfs_ino = fqs.qs_gquota.qfs_ino; + fqs_v1.qs_gquota.qfs_nblks = fqs.qs_gquota.qfs_nblks; + fqs_v1.qs_gquota.qfs_nextents = fqs.qs_gquota.qfs_nextents; + + fqs_v1.qs_incoredqs = fqs.qs_incoredqs; + fqs_v1.qs_btimelimit = fqs.qs_btimelimit; + fqs_v1.qs_itimelimit = fqs.qs_itimelimit; + fqs_v1.qs_rtbtimelimit = fqs.qs_rtbtimelimit; + fqs_v1.qs_bwarnlimit = fqs.qs_bwarnlimit; + fqs_v1.qs_iwarnlimit = fqs.qs_iwarnlimit; + fqsp = &fqs_v1; + }else + fqsp = &fqs; + +if (copy_to_user (addr, fqsp, size))return -EFAULT ;return ret; }fs/xfs/xfs_qm_syscalls.c +0
-4@@ -420,9 +420,6 @@ xfs_qm_scall_getqstat(bool tempgqip = false;bool temppqip = false; -memset (out,0 ,sizeof (fs_quota_stat_t)); - - out->qs_version =FS_QSTAT_VERSION ;if (!xfs_sb_version_hasquota (&mp->m_sb)) { out->qs_uquota.qfs_ino =NULLFSINO ; out->qs_gquota.qfs_ino =NULLFSINO ;@@ -432,7 +429,6 @@ xfs_qm_scall_getqstat( out->qs_flags = (__uint16_t )xfs_qm_export_flags (mp->m_qflags & (XFS_ALL_QUOTA_ACCT |XFS_ALL_QUOTA_ENFD )); - out->qs_pad =0 ; out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino;if (&out->qs_gquota != &out->qs_pquota)fs/xfs/xfs_super.c +2
-3@@ -549,14 +549,13 @@ xfs_showargs(else if (mp->m_qflags &XFS_UQUOTA_ACCT )seq_puts (m,"," MNTOPT_UQUOTANOENF ); -/* Either project or group quotas can be active, not both */ -if (mp->m_qflags &XFS_PQUOTA_ACCT ) {if (mp->m_qflags &XFS_PQUOTA_ENFD )seq_puts (m,"," MNTOPT_PRJQUOTA );else seq_puts (m,"," MNTOPT_PQUOTANOENF ); - }else if (mp->m_qflags &XFS_GQUOTA_ACCT ) { + } +if (mp->m_qflags &XFS_GQUOTA_ACCT ) {if (mp->m_qflags &XFS_GQUOTA_ENFD )seq_puts (m,"," MNTOPT_GRPQUOTA );else include/uapi/linux/dqblk_xfs.h +48
-7@@ -47,6 +47,7 @@* 512 bytes. */ #define FS_DQUOT_VERSION 1/* fs_disk_quota.d_version */ + typedef struct fs_disk_quota { __s8 d_version; /* version of this structure */ __s8 d_flags; /* FS_{USER,PROJ,GROUP}_QUOTA */@@ -137,31 +138,71 @@ typedef struct fs_disk_quota {* Provides a centralized way to get meta information about the quota subsystem. * eg. space taken up for user and group quotas, number of dquots currently * incore. +* User space caller should set qs_version to the appropriate version +* of the fs_quota_stat data structure they are providing. Not providing +* a version will be treated as FS_QSTAT_VERSION. */ #define FS_QSTAT_VERSION 1/* fs_quota_stat.qs_version */ +#define FS_QSTAT_VERSION_2 2/* new field qs_pquota; realignment */ /* * Some basic information about 'quota files'. */ -typedef struct fs_qfilestat { +struct fs_qfilestat_v1 {__u64 qfs_ino;/* inode number */ __u64 qfs_nblks;/* number of BBs 512-byte-blks */ __u32 qfs_nextents;/* number of extents */ -}fs_qfilestat_t ; +}; -typedef struct fs_quota_stat { +struct fs_quota_stat_v1 {__s8 qs_version;/* version number for future changes */ __u16 qs_flags;/* FS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ __s8 qs_pad;/* unused */ -fs_qfilestat_t qs_uquota;/* user quota storage information */ -fs_qfilestat_t qs_gquota;/* group quota storage information */ -#define qs_pquota qs_gquota +struct fs_qfilestat_v1 qs_uquota;/* user quota information */ +struct fs_qfilestat_v1 qs_gquota;/* group quota information */ __u32 qs_incoredqs;/* number of dquots incore */ __s32 qs_btimelimit;/* limit for blks timer */ __s32 qs_itimelimit;/* limit for inodes timer */ __s32 qs_rtbtimelimit;/* limit for rt blks timer */ __u16 qs_bwarnlimit;/* limit for num warnings */ __u16 qs_iwarnlimit;/* limit for num warnings */ -}fs_quota_stat_t ; +}; + +/* +* Some basic information about 'quota files'. Version 2. +*/ +struct fs_qfilestat { +__u64 qfs_ino;/* inode number */ +__u64 qfs_nblks;/* number of BBs 512-byte-blks */ +__u32 qfs_nextents;/* number of extents */ +__u32 qfs_pad;/* pad for 8-byte alignment */ +}; + +struct fs_quota_stat { +__s8 qs_version;/* version for future changes */ +__u8 qs_pad1;/* pad for 16bit alignment */ +__u16 qs_flags;/* FS_QUOTA_.* flags */ +__u32 qs_incoredqs;/* number of dquots incore */ +struct fs_qfilestat qs_uquota;/* user quota information */ +struct fs_qfilestat qs_gquota;/* group quota information */ +struct fs_qfilestat qs_pquota;/* project quota information */ +__s32 qs_btimelimit;/* limit for blks timer */ +__s32 qs_itimelimit;/* limit for inodes timer */ +__s32 qs_rtbtimelimit;/* limit for rt blks timer */ +__u16 qs_bwarnlimit;/* limit for num warnings */ +__u16 qs_iwarnlimit;/* limit for num warnings */ +__u64 qs_pad2[8 ];/* for future proofing */ +}; + +/* +* Since Version 1 did not have padding at appropriate places, +* a new data structure has been defined for the older version to +* provide backward compatibility. +* Future extentions of this data structure won't require new +* data structure definitions as the current one can be extended +* with the logic and padding in place now. +*/ +#define FS_QSTAT_V1_SIZE (sizeof(struct fs_quota_stat_v1)) +#define FS_QSTAT_V2_SIZE (sizeof(struct fs_quota_stat))#endif /* _LINUX_DQBLK_XFS_H */ Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
Quoted 8 lines · Ben Myers
Hey Chandra,
Quoted 5 lines · Chandra Seetharaman
Added appropriate pads and code for backward compatibility.
Copied over the old version as it is different from the newer padded version.
Quoted 8 lines
Quoted 4 lines
New callers of the system call have to set the version of the data structure being passed, and kernel will fill as much data as requested.
Signed-off-by Chandra Seetharaman <[email protected]>I think we also need to
Cc Jan Kara <[email protected]>
Thanks for CC.
Quoted 37 lines
Quoted 37 lines
fs/gfs2/quota.c +0
-3@@ -1443,9 +1443,6 @@ static int gfs2_quota_get_xstate(struct super_block *sb, {struct gfs2_sbd *sdp = sb->s_fs_info; -memset (fqs,0 ,sizeof (struct fs_quota_stat )); - fqs->qs_version =FS_QSTAT_VERSION ; -switch (sdp->sd_args.ar_quota) {case GFS2_QUOTA_ON : fqs->qs_flags |= (FS_QUOTA_UDQ_ENFD |FS_QUOTA_GDQ_ENFD );fs/quota/quota.c +11
-1@@ -207,12 +207,57 @@ static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)static int quota_getxstate (struct super_block *sb,void __user *addr) {struct fs_quota_stat fqs; -int ret; +struct fs_quota_stat_v1 fqs_v1; +int ret, size; +void *fqsp;if (!sb->s_qcop->get_xstate)return -ENOSYS ; + +memset (&fqs,0 ,sizeof (struct fs_quota_stat )); +if (copy_from_user (&fqs, addr,1 ))/* just get the version */ +return -EFAULT ; + +switch (fqs.qs_version) { +case FS_QSTAT_VERSION_2 : + size =FS_QSTAT_V2_SIZE ;
Quoted 8 lines
fs/quota/quota.c static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) · line 231
Quoted 8 lines
fs/quota/quota.c +8
-0+break ; +default : + fqs.qs_version =FS_QSTAT_VERSION ; +/* fallthrough */ +case FS_QSTAT_VERSION : + size =FS_QSTAT_V1_SIZE ; +break ; + }
Guys, you cannot really do this. If anyone is using getxstate() with
uninitialized buffer (which is fine so far), you cannot suddently start to rely on the contents of qs_version field. That's ABI (and even API) breakage.
Unless I'm missing something, the only clean way is to use new quotactl value for the interface with version field used for input as well.
Honza
Quoted 174 lines
Quoted 174 lines
fs/quota/quota.c +28
-1+ ret = sb->s_qcop->get_xstate (sb, &fqs); -if (!ret &©_to_user (addr, &fqs,sizeof (fqs))) +if (ret) +return ret; + +if (fqs.qs_version ==FS_QSTAT_VERSION ) { + fqs_v1.qs_version = fqs.qs_version; + fqs_v1.qs_flags = fqs.qs_flags; + fqs_v1.qs_pad =0 ; + + fqs_v1.qs_uquota.qfs_ino = fqs.qs_uquota.qfs_ino; + fqs_v1.qs_uquota.qfs_nblks = fqs.qs_uquota.qfs_nblks; + fqs_v1.qs_uquota.qfs_nextents = fqs.qs_uquota.qfs_nextents; + + fqs_v1.qs_gquota.qfs_ino = fqs.qs_gquota.qfs_ino; + fqs_v1.qs_gquota.qfs_nblks = fqs.qs_gquota.qfs_nblks; + fqs_v1.qs_gquota.qfs_nextents = fqs.qs_gquota.qfs_nextents; + + fqs_v1.qs_incoredqs = fqs.qs_incoredqs; + fqs_v1.qs_btimelimit = fqs.qs_btimelimit; + fqs_v1.qs_itimelimit = fqs.qs_itimelimit; + fqs_v1.qs_rtbtimelimit = fqs.qs_rtbtimelimit; + fqs_v1.qs_bwarnlimit = fqs.qs_bwarnlimit; + fqs_v1.qs_iwarnlimit = fqs.qs_iwarnlimit; + fqsp = &fqs_v1; + }else + fqsp = &fqs; + +if (copy_to_user (addr, fqsp, size))return -EFAULT ;return ret; }fs/xfs/xfs_qm_syscalls.c +0
-4@@ -420,9 +420,6 @@ xfs_qm_scall_getqstat(bool tempgqip = false;bool temppqip = false; -memset (out,0 ,sizeof (fs_quota_stat_t)); - - out->qs_version =FS_QSTAT_VERSION ;if (!xfs_sb_version_hasquota (&mp->m_sb)) { out->qs_uquota.qfs_ino =NULLFSINO ; out->qs_gquota.qfs_ino =NULLFSINO ;@@ -432,7 +429,6 @@ xfs_qm_scall_getqstat( out->qs_flags = (__uint16_t )xfs_qm_export_flags (mp->m_qflags & (XFS_ALL_QUOTA_ACCT |XFS_ALL_QUOTA_ENFD )); - out->qs_pad =0 ; out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino;if (&out->qs_gquota != &out->qs_pquota)fs/xfs/xfs_super.c +2
-3@@ -549,14 +549,13 @@ xfs_showargs(else if (mp->m_qflags &XFS_UQUOTA_ACCT )seq_puts (m,"," MNTOPT_UQUOTANOENF ); -/* Either project or group quotas can be active, not both */ -if (mp->m_qflags &XFS_PQUOTA_ACCT ) {if (mp->m_qflags &XFS_PQUOTA_ENFD )seq_puts (m,"," MNTOPT_PRJQUOTA );else seq_puts (m,"," MNTOPT_PQUOTANOENF ); - }else if (mp->m_qflags &XFS_GQUOTA_ACCT ) { + } +if (mp->m_qflags &XFS_GQUOTA_ACCT ) {if (mp->m_qflags &XFS_GQUOTA_ENFD )seq_puts (m,"," MNTOPT_GRPQUOTA );else include/uapi/linux/dqblk_xfs.h +48
-7@@ -47,6 +47,7 @@* 512 bytes. */ #define FS_DQUOT_VERSION 1/* fs_disk_quota.d_version */ + typedef struct fs_disk_quota { __s8 d_version; /* version of this structure */ __s8 d_flags; /* FS_{USER,PROJ,GROUP}_QUOTA */@@ -137,31 +138,71 @@ typedef struct fs_disk_quota {* Provides a centralized way to get meta information about the quota subsystem. * eg. space taken up for user and group quotas, number of dquots currently * incore. +* User space caller should set qs_version to the appropriate version +* of the fs_quota_stat data structure they are providing. Not providing +* a version will be treated as FS_QSTAT_VERSION. */ #define FS_QSTAT_VERSION 1/* fs_quota_stat.qs_version */ +#define FS_QSTAT_VERSION_2 2/* new field qs_pquota; realignment */ /* * Some basic information about 'quota files'. */ -typedef struct fs_qfilestat { +struct fs_qfilestat_v1 {__u64 qfs_ino;/* inode number */ __u64 qfs_nblks;/* number of BBs 512-byte-blks */ __u32 qfs_nextents;/* number of extents */ -}fs_qfilestat_t ; +}; -typedef struct fs_quota_stat { +struct fs_quota_stat_v1 {__s8 qs_version;/* version number for future changes */ __u16 qs_flags;/* FS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ __s8 qs_pad;/* unused */ -fs_qfilestat_t qs_uquota;/* user quota storage information */ -fs_qfilestat_t qs_gquota;/* group quota storage information */ -#define qs_pquota qs_gquota +struct fs_qfilestat_v1 qs_uquota;/* user quota information */ +struct fs_qfilestat_v1 qs_gquota;/* group quota information */ __u32 qs_incoredqs;/* number of dquots incore */ __s32 qs_btimelimit;/* limit for blks timer */ __s32 qs_itimelimit;/* limit for inodes timer */ __s32 qs_rtbtimelimit;/* limit for rt blks timer */ __u16 qs_bwarnlimit;/* limit for num warnings */ __u16 qs_iwarnlimit;/* limit for num warnings */ -}fs_quota_stat_t ; +}; + +/* +* Some basic information about 'quota files'. Version 2. +*/ +struct fs_qfilestat { +__u64 qfs_ino;/* inode number */ +__u64 qfs_nblks;/* number of BBs 512-byte-blks */ +__u32 qfs_nextents;/* number of extents */ +__u32 qfs_pad;/* pad for 8-byte alignment */ +}; + +struct fs_quota_stat { +__s8 qs_version;/* version for future changes */ +__u8 qs_pad1;/* pad for 16bit alignment */ +__u16 qs_flags;/* FS_QUOTA_.* flags */ +__u32 qs_incoredqs;/* number of dquots incore */ +struct fs_qfilestat qs_uquota;/* user quota information */ +struct fs_qfilestat qs_gquota;/* group quota information */ +struct fs_qfilestat qs_pquota;/* project quota information */ +__s32 qs_btimelimit;/* limit for blks timer */ +__s32 qs_itimelimit;/* limit for inodes timer */ +__s32 qs_rtbtimelimit;/* limit for rt blks timer */ +__u16 qs_bwarnlimit;/* limit for num warnings */ +__u16 qs_iwarnlimit;/* limit for num warnings */ +__u64 qs_pad2[8 ];/* for future proofing */ +}; + +/* +* Since Version 1 did not have padding at appropriate places, +* a new data structure has been defined for the older version to +* provide backward compatibility. +* Future extentions of this data structure won't require new +* data structure definitions as the current one can be extended +* with the logic and padding in place now. +*/ +#define FS_QSTAT_V1_SIZE (sizeof(struct fs_quota_stat_v1)) +#define FS_QSTAT_V2_SIZE (sizeof(struct fs_quota_stat))#endif /* _LINUX_DQBLK_XFS_H */ Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Signature · 7 lines
Jan Kara <[email protected]> SUSE Labs, CR _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
Hey Jan,
Quoted 60 lines · Jan Kara
Quoted 8 lines · Ben Myers
Hey Chandra,
Quoted 5 lines · Chandra Seetharaman
Added appropriate pads and code for backward compatibility.
Copied over the old version as it is different from the newer padded version.
Quoted 8 lines
Quoted 4 lines
New callers of the system call have to set the version of the data structure being passed, and kernel will fill as much data as requested.
Signed-off-by Chandra Seetharaman <[email protected]>I think we also need to
Cc Jan Kara <[email protected]>Thanks for CC.
Quoted 41 lines
Quoted 41 lines
fs/gfs2/quota.c +0
-3@@ -1443,9 +1443,6 @@ static int gfs2_quota_get_xstate(struct super_block *sb, {struct gfs2_sbd *sdp = sb->s_fs_info; -memset (fqs,0 ,sizeof (struct fs_quota_stat )); - fqs->qs_version =FS_QSTAT_VERSION ; -switch (sdp->sd_args.ar_quota) {case GFS2_QUOTA_ON : fqs->qs_flags |= (FS_QUOTA_UDQ_ENFD |FS_QUOTA_GDQ_ENFD );fs/quota/quota.c +15
-1@@ -207,12 +207,57 @@ static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)static int quota_getxstate (struct super_block *sb,void __user *addr) {struct fs_quota_stat fqs; -int ret; +struct fs_quota_stat_v1 fqs_v1; +int ret, size; +void *fqsp;if (!sb->s_qcop->get_xstate)return -ENOSYS ; + +memset (&fqs,0 ,sizeof (struct fs_quota_stat )); +if (copy_from_user (&fqs, addr,1 ))/* just get the version */ +return -EFAULT ; + +switch (fqs.qs_version) { +case FS_QSTAT_VERSION_2 : + size =FS_QSTAT_V2_SIZE ; +break ; +default : + fqs.qs_version =FS_QSTAT_VERSION ; +/* fallthrough */
Quoted 8 lines
Quoted 4 lines
fs/quota/quota.c static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) · line 231
Quoted 4 lines
fs/quota/quota.c +4
-0+case FS_QSTAT_VERSION : + size =FS_QSTAT_V1_SIZE ; +break ; + }Guys, you cannot really do this. If anyone is using
getxstate()with
uninitialized buffer (which is fine so far), you cannot suddently start to rely on the contents ofqs_versionfield. That's ABI (and even API) breakage.
Looks like you are correct to me. Seems that qs_version number was never checked until this patch.
Quoted 2 lines
Unless I'm missing something, the only clean way is to use new quotactl value for the interface with version field used for input as well.
If I understand... it would be something like this?
#define Q_XGETQSTATV XQM_CMD(8)
Or Q_XGETQSTAT2?
Thanks,
Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
Quoted 75 lines · Ben Myers
Hey Jan,
Quoted 60 lines · Jan Kara
Quoted 8 lines · Ben Myers
Hey Chandra,
Quoted 5 lines · Chandra Seetharaman
Added appropriate pads and code for backward compatibility.
Copied over the old version as it is different from the newer padded version.
Quoted 8 lines
Quoted 4 lines
New callers of the system call have to set the version of the data structure being passed, and kernel will fill as much data as requested.
Signed-off-by Chandra Seetharaman <[email protected]>I think we also need to
Cc Jan Kara <[email protected]>Thanks for CC.
Quoted 41 lines
Quoted 41 lines
fs/gfs2/quota.c +0
-3@@ -1443,9 +1443,6 @@ static int gfs2_quota_get_xstate(struct super_block *sb, {struct gfs2_sbd *sdp = sb->s_fs_info; -memset (fqs,0 ,sizeof (struct fs_quota_stat )); - fqs->qs_version =FS_QSTAT_VERSION ; -switch (sdp->sd_args.ar_quota) {case GFS2_QUOTA_ON : fqs->qs_flags |= (FS_QUOTA_UDQ_ENFD |FS_QUOTA_GDQ_ENFD );fs/quota/quota.c +15
-1@@ -207,12 +207,57 @@ static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)static int quota_getxstate (struct super_block *sb,void __user *addr) {struct fs_quota_stat fqs; -int ret; +struct fs_quota_stat_v1 fqs_v1; +int ret, size; +void *fqsp;if (!sb->s_qcop->get_xstate)return -ENOSYS ; + +memset (&fqs,0 ,sizeof (struct fs_quota_stat )); +if (copy_from_user (&fqs, addr,1 ))/* just get the version */ +return -EFAULT ; + +switch (fqs.qs_version) { +case FS_QSTAT_VERSION_2 : + size =FS_QSTAT_V2_SIZE ; +break ; +default : + fqs.qs_version =FS_QSTAT_VERSION ; +/* fallthrough */ Quoted 8 lines
Quoted 4 lines
fs/quota/quota.c static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) · line 231
Quoted 4 lines
fs/quota/quota.c +4
-0+case FS_QSTAT_VERSION : + size =FS_QSTAT_V1_SIZE ; +break ; + }Guys, you cannot really do this. If anyone is using
getxstate()with
uninitialized buffer (which is fine so far), you cannot suddently start to rely on the contents ofqs_versionfield. That's ABI (and even API) breakage.Looks like you are correct to me. Seems that
qs_versionnumber was never checked until this patch.
Quoted 6 lines
Quoted 2 lines
Unless I'm missing something, the only clean way is to use new quotactl value for the interface with version field used for input as well.
If I understand... it would be something like this?
#define
Q_XGETQSTATVXQM_CMD(8)
Yes.
Quoted 1 line
Or
Q_XGETQSTAT2?
I don't really care but the first name looks a bit better.
Honza
Signature · 7 lines
Jan Kara <[email protected]> SUSE Labs, CR _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
In reply to Jan KaraQuoted 2 lines · Jan Kara
Quoted 1 line · Ben Myers
Hey Chandra,
<snip>
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
fs/quota/quota.c +15
-1@@ -207,12 +207,57 @@ static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)static int quota_getxstate (struct super_block *sb,void __user *addr) {struct fs_quota_stat fqs; -int ret; +struct fs_quota_stat_v1 fqs_v1; +int ret, size; +void *fqsp;if (!sb->s_qcop->get_xstate)return -ENOSYS ; + +memset (&fqs,0 ,sizeof (struct fs_quota_stat )); +if (copy_from_user (&fqs, addr,1 ))/* just get the version */ +return -EFAULT ; + +switch (fqs.qs_version) { +case FS_QSTAT_VERSION_2 : + size =FS_QSTAT_V2_SIZE ; +break ; +default : + fqs.qs_version =FS_QSTAT_VERSION ; +/* fallthrough */
Quoted 8 lines
Quoted 4 lines
fs/quota/quota.c static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) · line 231
Quoted 4 lines
fs/quota/quota.c +4
-0+case FS_QSTAT_VERSION : + size =FS_QSTAT_V1_SIZE ; +break ; + }Guys, you cannot really do this. If anyone is using
getxstate()with
uninitialized buffer (which is fine so far), you cannot suddently start to rely on the contents ofqs_versionfield. That's ABI (and even API) breakage.
Agree, it is a API breakage.
Will fix it by adding a new quotactl value as you suggest. Does
#define Q_XGETQSTAT2 XQM_CMD(8)
sound good ?
Quoted 6 lines
Unless I'm missing something, the only clean way is to use new quotactl value for the interface with version field used for input as well.
Honza
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
Quoted 42 lines · Chandra Seetharaman
Quoted 2 lines · Jan Kara
Quoted 1 line · Ben Myers
Hey Chandra,
<snip>
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
fs/quota/quota.c +15
-1@@ -207,12 +207,57 @@ static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)static int quota_getxstate (struct super_block *sb,void __user *addr) {struct fs_quota_stat fqs; -int ret; +struct fs_quota_stat_v1 fqs_v1; +int ret, size; +void *fqsp;if (!sb->s_qcop->get_xstate)return -ENOSYS ; + +memset (&fqs,0 ,sizeof (struct fs_quota_stat )); +if (copy_from_user (&fqs, addr,1 ))/* just get the version */ +return -EFAULT ; + +switch (fqs.qs_version) { +case FS_QSTAT_VERSION_2 : + size =FS_QSTAT_V2_SIZE ; +break ; +default : + fqs.qs_version =FS_QSTAT_VERSION ; +/* fallthrough */ Quoted 8 lines
Quoted 4 lines
fs/quota/quota.c static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) · line 231
Quoted 4 lines
fs/quota/quota.c +4
-0+case FS_QSTAT_VERSION : + size =FS_QSTAT_V1_SIZE ; +break ; + }Guys, you cannot really do this. If anyone is using
getxstate()with
uninitialized buffer (which is fine so far), you cannot suddently start to rely on the contents ofqs_versionfield. That's ABI (and even API) breakage.
Quoted 8 lines
Agree, it is a API breakage.
Will fix it by adding a new quotactl value as you suggest. Does
#define
Q_XGETQSTAT2XQM_CMD(8)sound good ?
Ben's Q_XGETQSTATV name looked a bit better to me but I don't really
care. Whatever works for you...
Honza
Signature · 7 lines
Jan Kara <[email protected]> SUSE Labs, CR _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
In reply to Chandra SeetharamanQuoted 42 lines · Chandra Seetharaman
Quoted 2 lines · Jan Kara
Quoted 1 line · Ben Myers
Hey Chandra,
<snip>
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
fs/quota/quota.c +15
-1@@ -207,12 +207,57 @@ static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)static int quota_getxstate (struct super_block *sb,void __user *addr) {struct fs_quota_stat fqs; -int ret; +struct fs_quota_stat_v1 fqs_v1; +int ret, size; +void *fqsp;if (!sb->s_qcop->get_xstate)return -ENOSYS ; + +memset (&fqs,0 ,sizeof (struct fs_quota_stat )); +if (copy_from_user (&fqs, addr,1 ))/* just get the version */ +return -EFAULT ; + +switch (fqs.qs_version) { +case FS_QSTAT_VERSION_2 : + size =FS_QSTAT_V2_SIZE ; +break ; +default : + fqs.qs_version =FS_QSTAT_VERSION ; +/* fallthrough */ Quoted 8 lines
Quoted 4 lines
fs/quota/quota.c static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) · line 231
Quoted 4 lines
fs/quota/quota.c +4
-0+case FS_QSTAT_VERSION : + size =FS_QSTAT_V1_SIZE ; +break ; + }Guys, you cannot really do this. If anyone is using
getxstate()with
uninitialized buffer (which is fine so far), you cannot suddently start to rely on the contents ofqs_versionfield. That's ABI (and even API) breakage.
Quoted 3 lines
Agree, it is a API breakage.
Will fix it by adding a new quotactl value as you suggest.
Please enforce the version number as being valid so we don't need to add another new interface if we need to change this structure again. :)
FWIW, we're now going to need a new xfs_quota changes to go along with this - it will need to use the new interface by default, and fall back to the existing interface if it gets an error saying the command does not exist. We can't actually test the new interface until we have xfs_quota patches that use it.
And to play Devil's advocate: it is way too late in the merge cycle to make these sorts of ABI changes to a patch and test/review them adequately.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
Quoted 43 lines · Dave Chinner
Quoted 42 lines · Chandra Seetharaman
Quoted 2 lines · Jan Kara
Quoted 1 line · Ben Myers
Hey Chandra,
<snip>
Quoted 35 lines
Quoted 23 lines
Quoted 23 lines
fs/quota/quota.c +11
-1@@ -207,12 +207,57 @@ static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)static int quota_getxstate (struct super_block *sb,void __user *addr) {struct fs_quota_stat fqs; -int ret; +struct fs_quota_stat_v1 fqs_v1; +int ret, size; +void *fqsp;if (!sb->s_qcop->get_xstate)return -ENOSYS ; + +memset (&fqs,0 ,sizeof (struct fs_quota_stat )); +if (copy_from_user (&fqs, addr,1 ))/* just get the version */ +return -EFAULT ; + +switch (fqs.qs_version) { +case FS_QSTAT_VERSION_2 : + size =FS_QSTAT_V2_SIZE ;Quoted 8 lines
fs/quota/quota.c static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) · line 231
Quoted 8 lines
fs/quota/quota.c +8
-0+break ; +default : + fqs.qs_version =FS_QSTAT_VERSION ; +/* fallthrough */ +case FS_QSTAT_VERSION : + size =FS_QSTAT_V1_SIZE ; +break ; + }Guys, you cannot really do this. If anyone is using
getxstate()with
uninitialized buffer (which is fine so far), you cannot suddently start to rely on the contents ofqs_versionfield. That's ABI (and even API) breakage.
Quoted 7 lines
Quoted 3 lines
Agree, it is a API breakage.
Will fix it by adding a new quotactl value as you suggest.
Please enforce the version number as being valid so we don't need to add another new interface if we need to change this structure again. :)
Yes, I am keeping the lower level interface same as before.
Quoted 6 lines
FWIW, we're now going to need a new
xfs_quotachanges to go along with this - it will need to use the new interface by default, and fall back to the existing interface if it gets an error saying the command does not exist. We can't actually test the new interface until we havexfs_quotapatches that use it.
The lower level interface doesn't change. It will remain the same. I will send the code soon.
Quoted 4 lines
And to play Devil's advocate: it is way too late in the merge cycle to make these sorts of ABI changes to a patch and test/review them adequately.
There is no ABI issues even in the earlier version, it was an API breakage. And with Jan's suggestion even that API breakage is being fixed. There is no change in API or ABI. We are just adding a new interface.
Old code and old binary will work as before.
Quoted 4 lines
Cheers,
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
Quoted 7 lines · Chandra Seetharaman
Quoted 3 lines · Dave Chinner
And to play Devil's advocate: it is way too late in the merge cycle to make these sorts of ABI changes to a patch and test/review them adequately.
There is no ABI issues even in the earlier version, it was an API breakage.
Old binaries would have done the wrong thing - that's an ABI issue. I'm sorry I didn't realise this earlier.
Quoted 3 lines
And with Jan's suggestion even that API breakage is being fixed. There is no change in API or ABI. We are just adding a new interface.
Yes, we are adding a new API to avoid ABI problems with re-interpreting the old API.
But whether it's API or ABI, it doesn't matter - my point is that it's almost 2 weeks after the merge window was opened and adding new userspace APIs at the last moment before the merge window closes tends to be frowned upon....
Quoted 1 line
Old code and old binary will work as before.
Yes, but we have no new code or binaries to test the new interface, do we?
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v10 10/11] quota: Add proper versioning support to fs_quota_stat
In reply to Chandra SeetharamanHi,
Copying in Abhi, since he is the quota expert on the GFS2 side,
Steve.
Quoted 69 lines · Chandra Seetharaman
Quoted 43 lines · Dave Chinner
Quoted 42 lines · Chandra Seetharaman
Quoted 2 lines · Jan Kara
Quoted 1 line · Ben Myers
Hey Chandra,
<snip>
Quoted 35 lines
Quoted 23 lines
Quoted 23 lines
fs/quota/quota.c +11
-1@@ -207,12 +207,57 @@ static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)static int quota_getxstate (struct super_block *sb,void __user *addr) {struct fs_quota_stat fqs; -int ret; +struct fs_quota_stat_v1 fqs_v1; +int ret, size; +void *fqsp;if (!sb->s_qcop->get_xstate)return -ENOSYS ; + +memset (&fqs,0 ,sizeof (struct fs_quota_stat )); +if (copy_from_user (&fqs, addr,1 ))/* just get the version */ +return -EFAULT ; + +switch (fqs.qs_version) { +case FS_QSTAT_VERSION_2 : + size =FS_QSTAT_V2_SIZE ;Quoted 8 lines
fs/quota/quota.c static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) · line 231
Quoted 8 lines
fs/quota/quota.c +8
-0+break ; +default : + fqs.qs_version =FS_QSTAT_VERSION ; +/* fallthrough */ +case FS_QSTAT_VERSION : + size =FS_QSTAT_V1_SIZE ; +break ; + }Guys, you cannot really do this. If anyone is using
getxstate()with
uninitialized buffer (which is fine so far), you cannot suddently start to rely on the contents ofqs_versionfield. That's ABI (and even API) breakage.Quoted 7 lines
Quoted 3 lines
Agree, it is a API breakage.
Will fix it by adding a new quotactl value as you suggest.
Please enforce the version number as being valid so we don't need to add another new interface if we need to change this structure again. :)
Yes, I am keeping the lower level interface same as before.
Quoted 6 lines
FWIW, we're now going to need a new
xfs_quotachanges to go along with this - it will need to use the new interface by default, and fall back to the existing interface if it gets an error saying the command does not exist. We can't actually test the new interface until we havexfs_quotapatches that use it.The lower level interface doesn't change. It will remain the same. I will send the code soon.
Quoted 4 lines
And to play Devil's advocate: it is way too late in the merge cycle to make these sorts of ABI changes to a patch and test/review them adequately.
Quoted 13 lines
There is no ABI issues even in the earlier version, it was an API breakage. And with Jan's suggestion even that API breakage is being fixed. There is no change in API or ABI. We are just adding a new interface.
Old code and old binary will work as before.
Quoted 4 lines
Cheers,
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v10 11/11 xfs: Use new qs_pquota field in fs_quota_stat for Q_XGETQSTAT
In reply to Chandra SeetharamanFor the Q_XGETQSTAT quota command, if the new version of fs_quota_stat data structure is used, fill the project quota information.
--- fs/xfs/xfs_qm_syscalls.c | 38 ++++++++++++++++++++++++++------------ 1 files changed, 26 insertions(+), 12 deletions(-)
fs/xfs/xfs_qm_syscalls.c +26 -12
@@ -406,6 +406,14 @@ xfs_qm_scall_quotaon(/* * Return quota status information, such as uquota-off, enforcements, etc. +* +* We support two different versions of the fs_quota_stat structure +* here. If the version is FS_QSTAT_VERSION, then there is no +* separate project quota fields, and so we write project quota +* information into the group quota fields. With FS_QSTAT_VERSION_2, +* there is a separate project quota field so we can use that +* instead to pass both group and project quota back to user space. +* */ int xfs_qm_scall_getqstat(
@@ -420,19 +428,15 @@ xfs_qm_scall_getqstat(bool tempgqip = false;bool temppqip = false; -if (!xfs_sb_version_hasquota (&mp->m_sb)) { - out->qs_uquota.qfs_ino =NULLFSINO ; - out->qs_gquota.qfs_ino =NULLFSINO ; - out->qs_pquota.qfs_ino =NULLFSINO ; -return (0 ); - } + out->qs_uquota.qfs_ino =NULLFSINO ; + out->qs_gquota.qfs_ino =NULLFSINO ; + out->qs_pquota.qfs_ino =NULLFSINO ; +if (!xfs_sb_version_hasquota (&mp->m_sb)) +return 0 ; + out->qs_flags = (__uint16_t )xfs_qm_export_flags (mp->m_qflags & (XFS_ALL_QUOTA_ACCT |XFS_ALL_QUOTA_ENFD )); - out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; - out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino; -if (&out->qs_gquota != &out->qs_pquota) - out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino;if (q) { uip = q->qi_uquotaip;
@@ -454,21 +458,31 @@ xfs_qm_scall_getqstat( 0, 0, &pip) == 0) temppqip = true; } +if (uip) { + out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; out->qs_uquota.qfs_nblks = uip->i_d.di_nblocks; out->qs_uquota.qfs_nextents = uip->i_d.di_nextents;if (tempuqip)IRELE (uip); }if (gip) { + out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino; out->qs_gquota.qfs_nblks = gip->i_d.di_nblocks; out->qs_gquota.qfs_nextents = gip->i_d.di_nextents;if (tempgqip)IRELE (gip); }if (pip) { - out->qs_pquota.qfs_nblks = pip->i_d.di_nblocks; - out->qs_pquota.qfs_nextents = pip->i_d.di_nextents; +if (out->qs_version >=FS_QSTAT_VERSION_2 ) { + out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino; + out->qs_pquota.qfs_nblks = pip->i_d.di_nblocks; + out->qs_pquota.qfs_nextents = pip->i_d.di_nextents; + }else { + out->qs_gquota.qfs_ino = mp->m_sb.sb_pquotino; + out->qs_gquota.qfs_nblks = pip->i_d.di_nblocks; + out->qs_gquota.qfs_nextents = pip->i_d.di_nextents; + }if (temppqip)IRELE (pip); }
Signature · 6 lines
1.7.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 9 lines · Chandra Seetharaman
Hello All,
This is the version 10 of the changes to allow pquota and gquota to be used together.
Patchset applies cleanly on top of
80a4049813a2ae0977d8e5db78e711c7f21c420bin xfs git tree.Ran xfstests against it with DEBUG and do not see any regressions.
Applied patches 1-4,6,7.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs