linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dave Chinner <david@fromorbit.com>
Cc: Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	xfs@oss.sgi.com
Subject: Re: [PATCH 10/11] quota: Switch ->get_dqblk() and ->set_dqblk() to use bytes as space units
Date: Fri, 12 Dec 2014 23:51:56 +0100	[thread overview]
Message-ID: <20141212225156.GA9674@quack.suse.cz> (raw)
In-Reply-To: <20141212095230.GB4813@quack.suse.cz>

On Fri 12-12-14 10:52:30, Jan Kara wrote:
> On Wed 19-11-14 09:29:52, Dave Chinner wrote:
> > On Tue, Nov 11, 2014 at 10:04:24PM +0100, Jan Kara wrote:
> > > Currently ->get_dqblk() and ->set_dqblk() use struct fs_disk_quota which
> > > tracks space limits and usage in 512-byte blocks. However VFS quotas
> > > track usage in bytes (as some filesystems require that) and we need to
> > > somehow pass this information. Upto now it wasn't a problem because we
> > > didn't do any unit conversion (thus VFS quota routines happily stuck
> > > number of bytes into d_bcount field of struct fd_disk_quota). Only if
> > > you tried to use Q_XGETQUOTA or Q_XSETQLIM for VFS quotas (or Q_GETQUOTA
> > > / Q_SETQUOTA for XFS quotas), you got bogus results but noone really
> > > tried that. But when we want interfaces compatible we need to fix this.
> > > 
> > > So we bite the bullet and define another quota structure used for
> > > passing information from/to ->get_dqblk()/->set_dqblk. It's somewhat
> > > sad we have to have more conversion routines in fs/quota/quota.c but
> > > it seems cleaner than overloading e.g. units of d_bcount to bytes.
> > 
> > I don't really like the idea of having to copy the dquot information
> > an extra time. We now:
> > 
> > 	- copy from internal dquot to the new qc_dqblk
> > 	- copy from the new qc_dqblk to if_dqblk/xfs_dqblk
> > 	- copy if_dqblk/xfs_dqblk to the user buffer.
> > 
> > That's now three copies, and when we are having to deal with quota
> > reports containing hundreds of thousands of dquots that's going to
> > hrut performance.
> > 
> > We could probably get away with just one copy by passing a
> > filldir()-like context down into the filesystems to format their
> > internal dquot information directly into the user buffer in the
> > appropriate format. That way fs/quota/quota.c doesn't need
> > conversion routines, filesystems can optimise the formating to
> > minimise copying, and we can still provide generic routines for
> > filesystems using the generic quota infrastructure....
>   I was thinking about how this would look like. I don't have a problem to
> create a filldir() like callback that will be used for getting quota
> structures. However I don't see how we could reasonably get away with just
> one copy in general - that would mean that the interface functions in
> fs/quota.c (e.g. quota_getquota()) would have to determine whether XFS of
> VFS quota structures are used in the backing filesystem to provide proper
> callback and that's IMO too ugly to live.
> 
> We could definitely reduce the number of copies to two by changing e.g.
> copy_to_xfs_dqblk() to directly use __put_user() instead of first
> formatting proper structure on stack and then using copy_to_user(). However
> I'm not sure whether this will be any real performance win and using
> copy_to_user() seems easier to me...
> 
> Anyway I'll probably try changing number of copies to two and see whether
> there's any measurable impact.
  So when I change the number of copies to two by using __put_user, I get
about about 2.3% reduction in time for getting quota information for vfs
quotas (fully cached) and about 1.7% reduction in time for getting quota
information for xfs quotas.

For VFS quotas numbers are:
Average of 4 runs with 3 copies is 2.212286s (for 100000 getquota calls).
Average of 4 runs with 2 copies is 2.160500s (for 100000 getquota calls).

For XFS quotas numbers are:
Average of 4 runs with 3 copies is 1.584250s (for 100000 getquota calls).
Average of 4 runs with 2 copies is 1.557250s (for 100000 getquota calls).

So overall it seems to me that avoiding another copy is not worth the
bother...

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2014-12-12 22:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11 21:04 [PATCH 0/11 RFC] quota: Unify VFS and XFS quota interfaces Jan Kara
2014-11-11 21:04 ` [PATCH 01/11] xfs: Remove useless test Jan Kara
2014-11-11 23:27   ` Dave Chinner
2014-11-11 21:04 ` [PATCH 02/11] xfs: Remove unused variable in xfs_qm_scall_quotaon() Jan Kara
2014-11-11 23:23   ` Dave Chinner
2014-11-11 21:04 ` [PATCH 03/11] xfs: Remove some useless flags tests Jan Kara
2014-11-11 23:26   ` Dave Chinner
2014-11-11 21:04 ` [PATCH 04/11] quota: Split ->set_xstate callback into two Jan Kara
2014-11-13 17:34   ` Christoph Hellwig
2014-11-18 16:05     ` Jan Kara
2014-11-11 21:04 ` [PATCH 05/11] quota: Wire up ->sysquota_{on,off} callbacks into Q_QUOTA{ON,OFF} Jan Kara
2014-11-11 21:04 ` [PATCH 06/11] quota: Add ->sysquota_{on,off} callbacks for VFS quotas Jan Kara
2014-11-11 21:04 ` [PATCH 07/11] ext4: Use generic helpers for quotaon and quotaoff Jan Kara
2014-11-13 17:36   ` Christoph Hellwig
2014-11-18 16:07     ` Jan Kara
2014-11-11 21:04 ` [PATCH 08/11] ocfs2: " Jan Kara
2014-11-11 21:04 ` [PATCH 09/11] quota: Remove quota_on_meta callback Jan Kara
2014-11-11 21:04 ` [PATCH 10/11] quota: Switch ->get_dqblk() and ->set_dqblk() to use bytes as space units Jan Kara
2014-11-18 22:29   ` Dave Chinner
2014-12-12  9:52     ` Jan Kara
2014-12-12 22:51       ` Jan Kara [this message]
2014-11-11 21:04 ` [PATCH 11/11] quota: Store maximum space limit in bytes Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141212225156.GA9674@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=david@fromorbit.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).