From mboxrd@z Thu Jan 1 00:00:00 1970 From: Abhijith Das Date: Thu, 12 Feb 2015 13:23:59 -0500 (EST) Subject: [Cluster-devel] [GFS2 PATCH 1/4] gfs2: check quota for blocks we're about to allocate In-Reply-To: <54DCED22.1050500@redhat.com> References: <1423760054-63438-1-git-send-email-adas@redhat.com> <1423760054-63438-2-git-send-email-adas@redhat.com> <54DCED22.1050500@redhat.com> Message-ID: <1730751721.11521062.1423765439167.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ----- Original Message ----- > From: "Andrew Price" > To: "Abhi Das" , cluster-devel at redhat.com > Sent: Thursday, February 12, 2015 12:12:50 PM > Subject: Re: [Cluster-devel] [GFS2 PATCH 1/4] gfs2: check quota for blocks we're about to allocate > > Hi Abhi, > > On 12/02/15 16:54, Abhi Das wrote: > > This patch allows gfs2_quota_check() to take an extra argument > > called 'exp_change'. Prior to any allocation, gfs2_quota_check() > > or gfs2_quota_lock_check() is called with exp_change containing > > the number of blocks we expect to allocate in this operation. > > gfs2_quota_check() will add this number to the current usage and > > check the sum against the quota warns and limits and fail the > > operation if necessary. > > > > > -int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid) > > +int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid, s64 > > exp_change) > > { > > struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); > > struct gfs2_quota_data *qd; > > @@ -1116,7 +1116,7 @@ int gfs2_quota_check(struct gfs2_inode *ip, kuid_t > > uid, kgid_t gid) > > > > value = (s64)be64_to_cpu(qd->qd_qb.qb_value); > > spin_lock(&qd_lock); > > - value += qd->qd_change; > > + value += qd->qd_change + exp_change; > > So I guess I don't understand why we need both qd_change and exp_change > now. What sets qd_change, and why can't it be accurate (i.e. equal to > exp_change) when we need it to be? > > Andy > qd_change gets set when gfs2_quota_change() is called... after the current operation has completed to account for the block allocs/deallocs that have been done during that operation. Once gfs2_quota_change() is called, that quota change is basically set in stone and do_qc() goes ahead and syncs it to the local quota_change file and eventually it'll get synced to the global quota file. So, when quota_check() is called, the qd_change value (if not synced yet) will contain the usage as of the previous operation. Does that make sense? Cheers! --Abhi