cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Abhi Das <adas@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 0/3] fallocate and quota fixes
Date: Wed, 18 Mar 2015 02:36:35 -0500	[thread overview]
Message-ID: <1426664198-40395-1-git-send-email-adas@redhat.com> (raw)

This is a revised version of the patches required to properly fix the
fallocate quota issue described in bz1174295

patch1: This patch supplies gfs2_quota_check() with the number of blocks
	the caller intends to allocate in the current operation, resulting
	in a more accurate quota check.

patch2: gfs2_quota_check() and gfs2_inplace_reserve() return the number
	of blocks available subject to quota limits and rgrp size
	respectively. These functions don't return error if atleast
	ap.min_target (if set) blocks are allocatable.

patch3: The fallocate() function uses the features of patch2 to determine
	how many total blocks are available for allocation and uses them
	right away, instead of guessing/retrying inefficiently.

The behavior of quota enforcement is altered by this patchset.
i.   Quotas are exceeded (a warning message is also issued to syslog) before
     the actual usage blocks exceed the imposed limit. In fact, the actual
     usage can never exceed the limit. Whenever it is determined that the
     completion of an operation will cause a quota to exceed its limit, such
     an operation is aborted with -EDQUOT and a 'quota exceeded' message is
     dispatched. Note: When min_target is set and allowed blocks are >=
     min_target, we don't issue an error. It is assumed that the caller will
     only allocate the allowed blocks.
ii.  The gfs2_write_calc_reserv()/calc_max_reserv() functions are used to
     map between available blocks and the data bytes that can be written
     using them. Typically, for large files, some blocks are used up for
     metadata and only the remaining blocks can be used for data. Example:
     To write only a handful of bytes that would easily fit in one block, we
     might have to allocate an extra bunch of intermediate metadata blocks.
     If we had only 1 block left in our allotted quota, this operation would
     likely fail.

The functions mentioned in ii. are not very efficient. They always compute
the worst case number of extra blocks required and it is often the case that
not all those extra blocks are used. We need to find a better algorithm to
get a tighter estimate on the blocks needed for a given number of bytes.

I've run some basic tests and things seem to be holding up. The failing case
in bz1174295 is fixed using this patchset. I'll do test build and pass it on
to Nate to test with.

Abhi Das (3):
  gfs2: perform quota checks against allocation parameters
  gfs2: allow quota_check and inplace_reserve to return available blocks
  gfs2: allow fallocate to max out quotas/fs efficiently

 fs/gfs2/aops.c   |  6 ++---
 fs/gfs2/bmap.c   |  2 +-
 fs/gfs2/file.c   | 81 ++++++++++++++++++++++++++++++++++++--------------------
 fs/gfs2/incore.h |  4 ++-
 fs/gfs2/inode.c  | 18 +++++++------
 fs/gfs2/quota.c  | 54 +++++++++++++++++++++++++++----------
 fs/gfs2/quota.h  |  8 +++---
 fs/gfs2/rgrp.c   | 20 ++++++++++----
 fs/gfs2/rgrp.h   |  3 ++-
 fs/gfs2/xattr.c  |  2 +-
 10 files changed, 133 insertions(+), 65 deletions(-)

-- 
1.8.1.4



             reply	other threads:[~2015-03-18  7:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  7:36 Abhi Das [this message]
2015-03-18  7:36 ` [Cluster-devel] [GFS2 1/3] gfs2: perform quota checks against allocation parameters Abhi Das
2015-03-18  7:36 ` [Cluster-devel] [GFS2 2/3] gfs2: allow quota_check and inplace_reserve to return available blocks Abhi Das
2015-03-18  7:36 ` [Cluster-devel] [GFS2 3/3] gfs2: allow fallocate to max out quotas/fs efficiently Abhi Das
2015-03-18 13:40 ` [Cluster-devel] [GFS2 0/3] fallocate and quota fixes Steven Whitehouse
2015-03-18 17:09 ` Bob Peterson
  -- strict thread matches above, loose matches on Subject: below --
2015-02-25  5:17 Abhi Das
2015-02-25  9:19 ` Steven Whitehouse
2015-02-25 14:06 ` Bob Peterson

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=1426664198-40395-1-git-send-email-adas@redhat.com \
    --to=adas@redhat.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).