small quota updates for 2.6.34
cover small quota updates for 2.6.34
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/3 xfs: kill XFS_QMOPT_ASYNC
The option is unused and one of the few remaining users of xfs_bawrite, so let's get rid of it.
fs/xfs/quota/xfs_dquot.c +0 -2
@@ -1253,8 +1253,6 @@ xfs_qm_dqflush(if (flags &XFS_QMOPT_DELWRI ) {xfs_bdwrite (mp, bp); - }else if (flags &XFS_QMOPT_ASYNC ) { - error =xfs_bawrite (mp, bp); }else { error =xfs_bwrite (mp, bp); }
fs/xfs/xfs_quota.h +0 -1
@@ -226,7 +226,6 @@ typedef struct xfs_qoff_logformat {* flags for dqflush and dqflush_all. */ #define XFS_QMOPT_SYNC 0x1000000 -#define XFS_QMOPT_ASYNC 0x2000000#define XFS_QMOPT_DELWRI 0x4000000/*
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC
Quoted 4 lines · Christoph Hellwig
The option is unused and one of the few remaining users of
xfs_bawrite, so let's get rid of it.Signed-off-by Christoph Hellwig <[email protected]>
Looks good.
FWIW, I've got a bigger patch that kills off all three QMOPT writeback flags, but it isn't quite ready yet...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
RE: [PATCH 1/3] xfs: kill XFS_QMOPT_ASYNC
In reply to Christoph HellwigQuoted 2 lines · Christoph Hellwig
The option is unused and one of the few remaining users of
xfs_bawrite, so let's get rid of it.
Looks good.
Quoted 1 line
Signed-off-by Christoph Hellwig <[email protected]>
Quoted 26 lines
Index:
linux-2.6/fs/xfs/quota/xfs_dquot.c
===================================================================fs/xfs/quota/xfs_dquot.c +0
-2@@ -1253,8 +1253,6 @@ xfs_qm_dqflush(if (flags &XFS_QMOPT_DELWRI ) {xfs_bdwrite (mp, bp); - }else if (flags &XFS_QMOPT_ASYNC ) { - error =xfs_bawrite (mp, bp); }else { error =xfs_bwrite (mp, bp); }Index:
linux-2.6/fs/xfs/xfs_quota.h
===================================================================fs/xfs/xfs_quota.h +0
-1@@ -226,7 +226,6 @@ typedef struct xfs_qoff_logformat {* flags for dqflush and dqflush_all. */ #define XFS_QMOPT_SYNC 0x1000000 -#define XFS_QMOPT_ASYNC 0x2000000#define XFS_QMOPT_DELWRI 0x4000000/*
Quoted 4 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
PATCH 2/3 xfs: clean up error handling in xfs_trans_dqresv
In reply to Christoph HellwigMove the error code selection after the goto label and fold the xfs_quota_error helper into it.
fs/xfs/quota/xfs_trans_dquot.c +17 -31
@@ -589,14 +589,6 @@ xfs_trans_unreserve_and_mod_dquots( } } -STATIC int -xfs_quota_error (uint flags) -{ -if (flags &XFS_QMOPT_ENOSPC ) -return ENOSPC ; -return EDQUOT ; -} -/* * This reserves disk blocks and inodes against a dquot. * Flags indicate if the dquot is to be locked here and also
@@ -612,7 +604,6 @@ xfs_trans_dqresv( long ninos, uint flags) { -int error;xfs_qcnt_t hardlimit;xfs_qcnt_t softlimit;time_t timer;
@@ -649,7 +640,6 @@ xfs_trans_dqresv( warnlimit =XFS_QI_RTBWARNLIMIT (dqp->q_mount); resbcountp = &dqp->q_res_rtbcount; } - error =0 ; if ((flags & XFS_QMOPT_FORCE_RES) == 0 && dqp->q_core.d_id &&
@@ -667,19 +657,13 @@ xfs_trans_dqresv(* nblks. */ if (hardlimit >0ULL && - (hardlimit <= nblks + *resbcountp)) { - error =xfs_quota_error (flags); + hardlimit <= nblks + *resbcountp) goto error_return; - } -if (softlimit >0ULL && - (softlimit <= nblks + *resbcountp)) { -if ((timer !=0 &&get_seconds () > timer) || - (warns !=0 && warns >= warnlimit)) { - error =xfs_quota_error (flags); - goto error_return; - } - } + softlimit <= nblks + *resbcountp && + ((timer !=0 &&get_seconds () > timer) || + (warns !=0 && warns >= warnlimit))) + goto error_return; }if (ninos >0 ) { count =be64_to_cpu (dqp->q_core.d_icount);
@@ -692,16 +676,13 @@ xfs_trans_dqresv( softlimit =be64_to_cpu (dqp->q_core.d_ino_softlimit);if (!softlimit) softlimit = q->qi_isoftlimit; -if (hardlimit >0ULL && count >= hardlimit) { - error =xfs_quota_error (flags); + +if (hardlimit >0ULL && count >= hardlimit) + goto error_return; +if (softlimit >0ULL && count >= softlimit && + ((timer !=0 &&get_seconds () > timer) || + (warns !=0 && warns >= warnlimit))) goto error_return; - }else if (softlimit >0ULL && count >= softlimit) { -if ((timer !=0 &&get_seconds () > timer) || - (warns !=0 && warns >= warnlimit)) { - error =xfs_quota_error (flags); - goto error_return; - } - } } }
@@ -736,9 +717,14 @@ xfs_trans_dqresv(ASSERT (dqp->q_res_rtbcount >=be64_to_cpu (dqp->q_core.d_rtbcount));ASSERT (dqp->q_res_icount >=be64_to_cpu (dqp->q_core.d_icount)); +xfs_dqunlock (dqp); +return 0 ; + error_return:xfs_dqunlock (dqp); -return error; +if (flags &XFS_QMOPT_ENOSPC ) +return ENOSPC ; +return EDQUOT ; }
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/3] xfs: clean up error handling in xfs_trans_dqresv
Quoted 4 lines · Christoph Hellwig
Move the error code selection after the goto label and fold the
xfs_quota_errorhelper into it.Signed-off-by Christoph Hellwig <[email protected]>
Looks good.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/3 xfs: implement quota warnings via netlink
In reply to Christoph HellwigWire up quota_send_warning to send quota warnings over netlink. This is used by various desktops to show user quota warnings.
Tested by running the quota_nld daemon while running the xfstest quota tests and observing the warnings. I'll see how I can get a more formal testcase for it written.
fs/xfs/quota/xfs_trans_dquot.c +22 -2
@@ -589,6 +589,20 @@ xfs_trans_unreserve_and_mod_dquots( } } +STATIC void +xfs_quota_send_warning ( +struct xfs_mount *mp, +struct xfs_dquot *dqp, +int hard) +{ +/* no warnings for project quotas - we just return ENOSPC later */ +if (dqp->dq_flags &XFS_DQ_PROJ ) +return ; +quota_send_warning ((dqp->dq_flags &XFS_DQ_USER ) ?USRQUOTA :GRPQUOTA , +be32_to_cpu (dqp->q_core.d_id), mp->m_super->s_dev, + hard ?QUOTA_NL_BHARDWARN :QUOTA_NL_BSOFTWARN ); +} +/* * This reserves disk blocks and inodes against a dquot. * Flags indicate if the dquot is to be locked here and also
@@ -612,6 +626,7 @@ xfs_trans_dqresv(xfs_qcnt_t count;xfs_qcnt_t *resbcountp;xfs_quotainfo_t *q = mp->m_quotainfo; +int hardwarn =0 ;xfs_dqlock (dqp);
@@ -657,8 +672,10 @@ xfs_trans_dqresv(* nblks. */ if (hardlimit >0ULL && - hardlimit <= nblks + *resbcountp) + hardlimit <= nblks + *resbcountp) { + hardwarn =1 ; goto error_return; + } if (softlimit > 0ULL && softlimit <= nblks + *resbcountp && ((timer != 0 && get_seconds() > timer) ||
@@ -677,8 +694,10 @@ xfs_trans_dqresv(if (!softlimit) softlimit = q->qi_isoftlimit; -if (hardlimit >0ULL && count >= hardlimit) +if (hardlimit >0ULL && count >= hardlimit) { + hardwarn =1 ; goto error_return; + }if (softlimit >0ULL && count >= softlimit && ((timer !=0 &&get_seconds () > timer) || (warns !=0 && warns >= warnlimit)))
@@ -722,6 +741,7 @@ xfs_trans_dqresv( error_return:xfs_dqunlock (dqp); +xfs_quota_send_warning (mp, dqp, hardwarn);if (flags &XFS_QMOPT_ENOSPC )return ENOSPC ;return EDQUOT ;
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/3] xfs: implement quota warnings via netlink
Quoted 2 lines · Christoph Hellwig
Wire up
quota_send_warningto send quota warnings over netlink. This is used by various desktops to show user quota warnings.
A couple of comments below.
Quoted 3 lines
Tested by running the
quota_nlddaemon while running the xfstest quota tests and observing the warnings. I'll see how I can get a more formal testcase for it written.
Sounds like it needs something similar to the dmapi event listeners we use for testing that the dmapi events are generated correctly....
Quoted 14 lines
Signed-off-by Christoph Hellwig <[email protected]>Index:
xfs/fs/xfs/quota/xfs_trans_dquot.c
===================================================================fs/xfs/quota/xfs_trans_dquot.c +3
-0@@ -589,6 +589,20 @@ xfs_trans_unreserve_and_mod_dquots( } } +STATIC void +xfs_quota_send_warning( + struct xfs_mount *mp,
fs/xfs/quota/xfs_trans_dquot.c xfs_trans_unreserve_and_mod_dquots( · line 604
Quoted 10 lines
fs/xfs/quota/xfs_trans_dquot.c +10
-0+ struct xfs_dquot *dqp, + int hard) +{ +/* no warnings for project quotas - we just return ENOSPC later */ +if (dqp->dq_flags &XFS_DQ_PROJ ) +return ; +quota_send_warning ((dqp->dq_flags &XFS_DQ_USER ) ?USRQUOTA :GRPQUOTA , +be32_to_cpu (dqp->q_core.d_id), mp->m_super->s_dev, + hard ?QUOTA_NL_BHARDWARN :QUOTA_NL_BSOFTWARN ); +}
This appears to send "over block quota" warnings even when the error is caused by the number of inodes going over limit. For inode count warnings we should be sending QUOTA_NL_IHARDWARN or QUOTA_NL_ISOFTWARN. That could be easily done if the "hard" parameter is changed to the type of warning which is set up in the calling function.
We could probably even return the grace limit expired versions as well when over the soft limits with a slight change to the soft limit warning logic as well...
fs/xfs/quota/xfs_trans_dquot.c xfs_trans_dqresv( · line 629
Quoted 9 lines
fs/xfs/quota/xfs_trans_dquot.c +2
-0+/* * This reserves disk blocks and inodes against a dquot. * Flags indicate if the dquot is to be locked here and also @@ -612,6 +626,7 @@ xfs_trans_dqresv(xfs_qcnt_t count;xfs_qcnt_t *resbcountp;xfs_quotainfo_t *q = mp->m_quotainfo; +int hardwarn =0 ;
As mentioned above, this should probably be a "warn_type" parameter rather than a boolean hard/soft warning flag.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/3] xfs: implement quota warnings via netlink
Quoted 6 lines · Dave Chinner
Quoted 3 lines
Tested by running the
quota_nlddaemon while running the xfstest quota tests and observing the warnings. I'll see how I can get a more formal testcase for it written.Sounds like it needs something similar to the dmapi event listeners we use for testing that the dmapi events are generated correctly....
That's what quota_nld does, just need to tie it up properly.
Quoted 10 lines
This appears to send "over block quota" warnings even when the error is caused by the number of inodes going over limit. For inode count warnings we should be sending
QUOTA_NL_IHARDWARNorQUOTA_NL_ISOFTWARN. That could be easily done if the "hard" parameter is changed to the type of warning which is set up in the calling function.We could probably even return the grace limit expired versions as well when over the soft limits with a slight change to the soft limit warning logic as well...
Indeed, I did copy this from gfs2 which only does the block quotas and no differciated soft warnings. I'll respin it.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 3/3 xfs: implement quota warnings via netlink
In reply to Christoph HellwigWire up quota_send_warning to send quota warnings over netlink. This is used by various desktops to show user quota warnings.
Tested by running the quota_nld daemon while running the xfstest quota tests and observing the warnings. I'll see how I can get a more formal testcase for it written.
fs/xfs/quota/xfs_trans_dquot.c +39 -10
@@ -589,6 +589,20 @@ xfs_trans_unreserve_and_mod_dquots( } } +STATIC void +xfs_quota_warn ( +struct xfs_mount *mp, +struct xfs_dquot *dqp, +int type) +{ +/* no warnings for project quotas - we just return ENOSPC later */ +if (dqp->dq_flags &XFS_DQ_PROJ ) +return ; +quota_send_warning ((dqp->dq_flags &XFS_DQ_USER ) ?USRQUOTA :GRPQUOTA , +be32_to_cpu (dqp->q_core.d_id), mp->m_super->s_dev, + type); +} +/* * This reserves disk blocks and inodes against a dquot. * Flags indicate if the dquot is to be locked here and also
@@ -657,13 +671,21 @@ xfs_trans_dqresv(* nblks. */ if (hardlimit >0ULL && - hardlimit <= nblks + *resbcountp) + hardlimit <= nblks + *resbcountp) { +xfs_quota_warn (mp, dqp,QUOTA_NL_BHARDWARN ); goto error_return; + }if (softlimit >0ULL && - softlimit <= nblks + *resbcountp && - ((timer !=0 &&get_seconds () > timer) || - (warns !=0 && warns >= warnlimit))) - goto error_return; + softlimit <= nblks + *resbcountp) { +if ((timer !=0 &&get_seconds () > timer) || + (warns !=0 && warns >= warnlimit)) { +xfs_quota_warn (mp, dqp, +QUOTA_NL_BSOFTLONGWARN ); + goto error_return; + } + +xfs_quota_warn (mp, dqp,QUOTA_NL_BSOFTWARN ); + } }if (ninos >0 ) { count =be64_to_cpu (dqp->q_core.d_icount);
@@ -677,12 +699,19 @@ xfs_trans_dqresv(if (!softlimit) softlimit = q->qi_isoftlimit; -if (hardlimit >0ULL && count >= hardlimit) - goto error_return; -if (softlimit >0ULL && count >= softlimit && - ((timer !=0 &&get_seconds () > timer) || - (warns !=0 && warns >= warnlimit))) +if (hardlimit >0ULL && count >= hardlimit) { +xfs_quota_warn (mp, dqp,QUOTA_NL_IHARDWARN ); goto error_return; + } +if (softlimit >0ULL && count >= softlimit) { +if ((timer !=0 &&get_seconds () > timer) || + (warns !=0 && warns >= warnlimit)) { +xfs_quota_warn (mp, dqp, +QUOTA_NL_ISOFTLONGWARN ); + goto error_return; + } +xfs_quota_warn (mp, dqp,QUOTA_NL_ISOFTWARN ); + } } }
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/3 v2] xfs: implement quota warnings via netlink
Quoted 8 lines · Christoph Hellwig
Wire up
quota_send_warningto send quota warnings over netlink. This is used by various desktops to show user quota warnings.Tested by running the
quota_nlddaemon while running the xfstest quota tests and observing the warnings. I'll see how I can get a more formal testcase for it written.Signed-off-by Christoph Hellwig <[email protected]>
Looks good.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs