* [PATCH 0/3] include reservations in quota reporting
@ 2012-02-02 16:14 Christoph Hellwig
2012-02-02 16:14 ` [PATCH 1/3] xfs: merge xfs_qm_export_dquot into xfs_qm_scall_getquota Christoph Hellwig
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Christoph Hellwig @ 2012-02-02 16:14 UTC (permalink / raw)
To: xfs; +Cc: jack
This series makes sure quota reporting through quotactl, or in case of
project quotas, statfs includes quota reservation in addition to the
on-disk values. This fixes xfstests 270, which has been failing on XFS
since it was added, and makes the Q_XQUOTASYNC quotactl command that
xfs_quota uses to flush delalloc space redundant.
Jan, the last patch touches common quota code, but it's only relevant
to XFS - I'd like to put it in through the XFS tree if possible.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] xfs: merge xfs_qm_export_dquot into xfs_qm_scall_getquota
2012-02-02 16:14 [PATCH 0/3] include reservations in quota reporting Christoph Hellwig
@ 2012-02-02 16:14 ` Christoph Hellwig
2012-02-02 16:14 ` [PATCH 2/3] xfs: include reservations in quota reporting Christoph Hellwig
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2012-02-02 16:14 UTC (permalink / raw)
To: xfs; +Cc: jack
[-- Attachment #1: xfs-quota-kill-xfs_qm_export_dquot --]
[-- Type: text/plain, Size: 5742 bytes --]
The is no good reason to have these two separate, and for the next change
I'd need the full struct xfs_dquot in xfs_qm_export_dquot, so better just
fold the code now instead of changing it around.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: xfs/fs/xfs/xfs_qm_syscalls.c
===================================================================
--- xfs.orig/fs/xfs/xfs_qm_syscalls.c 2012-02-02 13:11:38.368396372 +0100
+++ xfs/fs/xfs/xfs_qm_syscalls.c 2012-02-02 13:17:04.139964850 +0100
@@ -47,9 +47,6 @@ STATIC int xfs_qm_log_quotaoff_end(xfs_m
uint);
STATIC uint xfs_qm_export_flags(uint);
STATIC uint xfs_qm_export_qtype_flags(uint);
-STATIC void xfs_qm_export_dquot(xfs_mount_t *, xfs_disk_dquot_t *,
- fs_disk_quota_t *);
-
/*
* Turn off quota accounting and/or enforcement for all udquots and/or
@@ -635,42 +632,6 @@ xfs_qm_scall_setqlim(
return error;
}
-int
-xfs_qm_scall_getquota(
- xfs_mount_t *mp,
- xfs_dqid_t id,
- uint type,
- fs_disk_quota_t *out)
-{
- xfs_dquot_t *dqp;
- int error;
-
- /*
- * Try to get the dquot. We don't want it allocated on disk, so
- * we aren't passing the XFS_QMOPT_DOALLOC flag. If it doesn't
- * exist, we'll get ENOENT back.
- */
- if ((error = xfs_qm_dqget(mp, NULL, id, type, 0, &dqp))) {
- return (error);
- }
-
- /*
- * If everything's NULL, this dquot doesn't quite exist as far as
- * our utility programs are concerned.
- */
- if (XFS_IS_DQUOT_UNINITIALIZED(dqp)) {
- xfs_qm_dqput(dqp);
- return XFS_ERROR(ENOENT);
- }
- /*
- * Convert the disk dquot to the exportable format
- */
- xfs_qm_export_dquot(mp, &dqp->q_core, out);
- xfs_qm_dqput(dqp);
- return (error ? XFS_ERROR(EFAULT) : 0);
-}
-
-
STATIC int
xfs_qm_log_quotaoff_end(
xfs_mount_t *mp,
@@ -759,50 +720,66 @@ error0:
}
-/*
- * Translate an internal style on-disk-dquot to the exportable format.
- * The main differences are that the counters/limits are all in Basic
- * Blocks (BBs) instead of the internal FSBs, and all on-disk data has
- * to be converted to the native endianness.
- */
-STATIC void
-xfs_qm_export_dquot(
- xfs_mount_t *mp,
- xfs_disk_dquot_t *src,
+int
+xfs_qm_scall_getquota(
+ struct xfs_mount *mp,
+ xfs_dqid_t id,
+ uint type,
struct fs_disk_quota *dst)
{
+ struct xfs_dquot *dqp;
+ int error;
+
+ /*
+ * Try to get the dquot. We don't want it allocated on disk, so
+ * we aren't passing the XFS_QMOPT_DOALLOC flag. If it doesn't
+ * exist, we'll get ENOENT back.
+ */
+ error = xfs_qm_dqget(mp, NULL, id, type, 0, &dqp);
+ if (error)
+ return error;
+
+ /*
+ * If everything's NULL, this dquot doesn't quite exist as far as
+ * our utility programs are concerned.
+ */
+ if (XFS_IS_DQUOT_UNINITIALIZED(dqp)) {
+ error = XFS_ERROR(ENOENT);
+ goto out_put;
+ }
+
memset(dst, 0, sizeof(*dst));
- dst->d_version = FS_DQUOT_VERSION; /* different from src->d_version */
- dst->d_flags = xfs_qm_export_qtype_flags(src->d_flags);
- dst->d_id = be32_to_cpu(src->d_id);
+ dst->d_version = FS_DQUOT_VERSION;
+ dst->d_flags = xfs_qm_export_qtype_flags(dqp->q_core.d_flags);
+ dst->d_id = be32_to_cpu(dqp->q_core.d_id);
dst->d_blk_hardlimit =
- XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_blk_hardlimit));
+ XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_blk_hardlimit));
dst->d_blk_softlimit =
- XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_blk_softlimit));
- dst->d_ino_hardlimit = be64_to_cpu(src->d_ino_hardlimit);
- dst->d_ino_softlimit = be64_to_cpu(src->d_ino_softlimit);
- dst->d_bcount = XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_bcount));
- dst->d_icount = be64_to_cpu(src->d_icount);
- dst->d_btimer = be32_to_cpu(src->d_btimer);
- dst->d_itimer = be32_to_cpu(src->d_itimer);
- dst->d_iwarns = be16_to_cpu(src->d_iwarns);
- dst->d_bwarns = be16_to_cpu(src->d_bwarns);
+ XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_blk_softlimit));
+ dst->d_ino_hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
+ dst->d_ino_softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
+ dst->d_bcount = XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_bcount));
+ dst->d_icount = be64_to_cpu(dqp->q_core.d_icount);
+ dst->d_btimer = be32_to_cpu(dqp->q_core.d_btimer);
+ dst->d_itimer = be32_to_cpu(dqp->q_core.d_itimer);
+ dst->d_iwarns = be16_to_cpu(dqp->q_core.d_iwarns);
+ dst->d_bwarns = be16_to_cpu(dqp->q_core.d_bwarns);
dst->d_rtb_hardlimit =
- XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtb_hardlimit));
+ XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_hardlimit));
dst->d_rtb_softlimit =
- XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtb_softlimit));
- dst->d_rtbcount = XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtbcount));
- dst->d_rtbtimer = be32_to_cpu(src->d_rtbtimer);
- dst->d_rtbwarns = be16_to_cpu(src->d_rtbwarns);
+ XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_softlimit));
+ dst->d_rtbcount = XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtbcount));
+ dst->d_rtbtimer = be32_to_cpu(dqp->q_core.d_rtbtimer);
+ dst->d_rtbwarns = be16_to_cpu(dqp->q_core.d_rtbwarns);
/*
* Internally, we don't reset all the timers when quota enforcement
* gets turned off. No need to confuse the user level code,
* so return zeroes in that case.
*/
- if ((!XFS_IS_UQUOTA_ENFORCED(mp) && src->d_flags == XFS_DQ_USER) ||
+ if ((!XFS_IS_UQUOTA_ENFORCED(mp) && dqp->q_core.d_flags == XFS_DQ_USER) ||
(!XFS_IS_OQUOTA_ENFORCED(mp) &&
- (src->d_flags & (XFS_DQ_PROJ | XFS_DQ_GROUP)))) {
+ (dqp->q_core.d_flags & (XFS_DQ_PROJ | XFS_DQ_GROUP)))) {
dst->d_btimer = 0;
dst->d_itimer = 0;
dst->d_rtbtimer = 0;
@@ -823,6 +800,9 @@ xfs_qm_export_dquot(
}
}
#endif
+out_put:
+ xfs_qm_dqput(dqp);
+ return error;
}
STATIC uint
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] xfs: include reservations in quota reporting
2012-02-02 16:14 [PATCH 0/3] include reservations in quota reporting Christoph Hellwig
2012-02-02 16:14 ` [PATCH 1/3] xfs: merge xfs_qm_export_dquot into xfs_qm_scall_getquota Christoph Hellwig
@ 2012-02-02 16:14 ` Christoph Hellwig
2012-02-02 16:14 ` [PATCH 3/3] quota: make Q_XQUOTASYNC a noop Christoph Hellwig
2012-02-02 18:07 ` [PATCH 0/3] include reservations in quota reporting Jan Kara
3 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2012-02-02 16:14 UTC (permalink / raw)
To: xfs; +Cc: jack
[-- Attachment #1: xfs-quota-report-delalloc-reservations --]
[-- Type: text/plain, Size: 3453 bytes --]
Report all quota usage including the currently pending reservations. This
avoids the need to flush delalloc space before gathering quota information,
and matches quota enforcement, which already takes the reservations into
account.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: xfs/fs/xfs/xfs_qm_bhv.c
===================================================================
--- xfs.orig/fs/xfs/xfs_qm_bhv.c 2012-02-02 15:06:42.624326140 +0100
+++ xfs/fs/xfs/xfs_qm_bhv.c 2012-02-02 15:06:43.077657017 +0100
@@ -40,28 +40,28 @@
STATIC void
xfs_fill_statvfs_from_dquot(
struct kstatfs *statp,
- xfs_disk_dquot_t *dp)
+ struct xfs_dquot *dqp)
{
__uint64_t limit;
- limit = dp->d_blk_softlimit ?
- be64_to_cpu(dp->d_blk_softlimit) :
- be64_to_cpu(dp->d_blk_hardlimit);
+ limit = dqp->q_core.d_blk_softlimit ?
+ be64_to_cpu(dqp->q_core.d_blk_softlimit) :
+ be64_to_cpu(dqp->q_core.d_blk_hardlimit);
if (limit && statp->f_blocks > limit) {
statp->f_blocks = limit;
statp->f_bfree = statp->f_bavail =
- (statp->f_blocks > be64_to_cpu(dp->d_bcount)) ?
- (statp->f_blocks - be64_to_cpu(dp->d_bcount)) : 0;
+ (statp->f_blocks > dqp->q_res_bcount) ?
+ (statp->f_blocks - dqp->q_res_bcount) : 0;
}
- limit = dp->d_ino_softlimit ?
- be64_to_cpu(dp->d_ino_softlimit) :
- be64_to_cpu(dp->d_ino_hardlimit);
+ limit = dqp->q_core.d_ino_softlimit ?
+ be64_to_cpu(dqp->q_core.d_ino_softlimit) :
+ be64_to_cpu(dqp->q_core.d_ino_hardlimit);
if (limit && statp->f_files > limit) {
statp->f_files = limit;
statp->f_ffree =
- (statp->f_files > be64_to_cpu(dp->d_icount)) ?
- (statp->f_ffree - be64_to_cpu(dp->d_icount)) : 0;
+ (statp->f_files > dqp->q_res_icount) ?
+ (statp->f_ffree - dqp->q_res_icount) : 0;
}
}
@@ -82,7 +82,7 @@ xfs_qm_statvfs(
xfs_dquot_t *dqp;
if (!xfs_qm_dqget(mp, NULL, xfs_get_projid(ip), XFS_DQ_PROJ, 0, &dqp)) {
- xfs_fill_statvfs_from_dquot(statp, &dqp->q_core);
+ xfs_fill_statvfs_from_dquot(statp, dqp);
xfs_qm_dqput(dqp);
}
}
Index: xfs/fs/xfs/xfs_qm_syscalls.c
===================================================================
--- xfs.orig/fs/xfs/xfs_qm_syscalls.c 2012-02-02 15:06:42.837658317 +0100
+++ xfs/fs/xfs/xfs_qm_syscalls.c 2012-02-02 15:07:31.894059224 +0100
@@ -758,8 +758,8 @@ xfs_qm_scall_getquota(
XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_blk_softlimit));
dst->d_ino_hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
dst->d_ino_softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
- dst->d_bcount = XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_bcount));
- dst->d_icount = be64_to_cpu(dqp->q_core.d_icount);
+ dst->d_bcount = XFS_FSB_TO_BB(mp, dqp->q_res_bcount);
+ dst->d_icount = dqp->q_res_icount;
dst->d_btimer = be32_to_cpu(dqp->q_core.d_btimer);
dst->d_itimer = be32_to_cpu(dqp->q_core.d_itimer);
dst->d_iwarns = be16_to_cpu(dqp->q_core.d_iwarns);
@@ -768,7 +768,7 @@ xfs_qm_scall_getquota(
XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_hardlimit));
dst->d_rtb_softlimit =
XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_softlimit));
- dst->d_rtbcount = XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtbcount));
+ dst->d_rtbcount = XFS_FSB_TO_BB(mp, dqp->q_res_rtbcount);
dst->d_rtbtimer = be32_to_cpu(dqp->q_core.d_rtbtimer);
dst->d_rtbwarns = be16_to_cpu(dqp->q_core.d_rtbwarns);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] quota: make Q_XQUOTASYNC a noop
2012-02-02 16:14 [PATCH 0/3] include reservations in quota reporting Christoph Hellwig
2012-02-02 16:14 ` [PATCH 1/3] xfs: merge xfs_qm_export_dquot into xfs_qm_scall_getquota Christoph Hellwig
2012-02-02 16:14 ` [PATCH 2/3] xfs: include reservations in quota reporting Christoph Hellwig
@ 2012-02-02 16:14 ` Christoph Hellwig
2012-02-02 18:06 ` Jan Kara
2012-02-02 18:07 ` [PATCH 0/3] include reservations in quota reporting Jan Kara
3 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2012-02-02 16:14 UTC (permalink / raw)
To: xfs; +Cc: jack
[-- Attachment #1: quota-disable-Q_XQUOTASYNC --]
[-- Type: text/plain, Size: 1023 bytes --]
Now that XFS takes quota reservations into account there is no need to flush
anything before reporting quotas - in addition to beeing fully transactional
all quota information is also 100% coherent with the rest of the filesystem
now.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: xfs/fs/quota/quota.c
===================================================================
--- xfs.orig/fs/quota/quota.c 2012-02-02 13:06:30.693396524 +0100
+++ xfs/fs/quota/quota.c 2012-02-02 13:23:23.181244741 +0100
@@ -282,10 +282,9 @@ static int do_quotactl(struct super_bloc
case Q_XGETQUOTA:
return quota_getxquota(sb, type, id, addr);
case Q_XQUOTASYNC:
- /* caller already holds s_umount */
if (sb->s_flags & MS_RDONLY)
return -EROFS;
- writeback_inodes_sb(sb, WB_REASON_SYNC);
+ /* XFS quotas are fully coherent now, making this call a noop */
return 0;
default:
return -EINVAL;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] quota: make Q_XQUOTASYNC a noop
2012-02-02 16:14 ` [PATCH 3/3] quota: make Q_XQUOTASYNC a noop Christoph Hellwig
@ 2012-02-02 18:06 ` Jan Kara
0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2012-02-02 18:06 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: jack, xfs
On Thu 02-02-12 11:14:12, Christoph Hellwig wrote:
> Now that XFS takes quota reservations into account there is no need to flush
> anything before reporting quotas - in addition to beeing fully transactional
> all quota information is also 100% coherent with the rest of the filesystem
> now.
Looks fine. You can add:
Acked-by: Jan Kara <jack@suse.cz>
Honza
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Index: xfs/fs/quota/quota.c
> ===================================================================
> --- xfs.orig/fs/quota/quota.c 2012-02-02 13:06:30.693396524 +0100
> +++ xfs/fs/quota/quota.c 2012-02-02 13:23:23.181244741 +0100
> @@ -282,10 +282,9 @@ static int do_quotactl(struct super_bloc
> case Q_XGETQUOTA:
> return quota_getxquota(sb, type, id, addr);
> case Q_XQUOTASYNC:
> - /* caller already holds s_umount */
> if (sb->s_flags & MS_RDONLY)
> return -EROFS;
> - writeback_inodes_sb(sb, WB_REASON_SYNC);
> + /* XFS quotas are fully coherent now, making this call a noop */
> return 0;
> default:
> return -EINVAL;
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] include reservations in quota reporting
2012-02-02 16:14 [PATCH 0/3] include reservations in quota reporting Christoph Hellwig
` (2 preceding siblings ...)
2012-02-02 16:14 ` [PATCH 3/3] quota: make Q_XQUOTASYNC a noop Christoph Hellwig
@ 2012-02-02 18:07 ` Jan Kara
3 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2012-02-02 18:07 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: jack, xfs
On Thu 02-02-12 11:14:09, Christoph Hellwig wrote:
> This series makes sure quota reporting through quotactl, or in case of
> project quotas, statfs includes quota reservation in addition to the
> on-disk values. This fixes xfstests 270, which has been failing on XFS
> since it was added, and makes the Q_XQUOTASYNC quotactl command that
> xfs_quota uses to flush delalloc space redundant.
>
> Jan, the last patch touches common quota code, but it's only relevant
> to XFS - I'd like to put it in through the XFS tree if possible.
Sure. The patch is trivial so conflicts are unlikely.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-02-02 18:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-02 16:14 [PATCH 0/3] include reservations in quota reporting Christoph Hellwig
2012-02-02 16:14 ` [PATCH 1/3] xfs: merge xfs_qm_export_dquot into xfs_qm_scall_getquota Christoph Hellwig
2012-02-02 16:14 ` [PATCH 2/3] xfs: include reservations in quota reporting Christoph Hellwig
2012-02-02 16:14 ` [PATCH 3/3] quota: make Q_XQUOTASYNC a noop Christoph Hellwig
2012-02-02 18:06 ` Jan Kara
2012-02-02 18:07 ` [PATCH 0/3] include reservations in quota reporting Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox