From: Jan Kara Subject: Re: [PATCH 2/3] quota: unify ->get_dqblk Date: Wed, 5 May 2010 18:00:53 +0200 Message-ID: <20100505160052.GE3938@quack.suse.cz> References: <20100505103937.040319545@bombadil.infradead.org> <20100505104021.693053400@bombadil.infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org To: Christoph Hellwig Return-path: Received: from cantor.suse.de ([195.135.220.2]:55246 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932670Ab0EEQAz (ORCPT ); Wed, 5 May 2010 12:00:55 -0400 Content-Disposition: inline In-Reply-To: <20100505104021.693053400@bombadil.infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed 05-05-10 06:39:39, Christoph Hellwig wrote: > Pass the larger struct fs_disk_quota to the ->get_dqblk operation so > that the Q_GETQUOTA and Q_XGETQUOTA operations can be implemented > with a single filesystem operation and we can retire the ->get_xquota > operation. The additional information (RT-subvolume accounting and > warn counts) are left zero for the VFS quota implementation. > > Signed-off-by: Christoph Hellwig > > Index: linux-2.6/fs/quota/quota.c > =================================================================== > --- linux-2.6.orig/fs/quota/quota.c 2010-05-05 11:57:38.000000000 +0200 > +++ linux-2.6/fs/quota/quota.c 2010-05-05 11:58:46.681263382 +0200 > @@ -136,19 +136,32 @@ static int quota_setinfo(struct super_bl > return sb->s_qcop->set_info(sb, type, &info); > } > > +static void copy_to_if_dqblk(struct if_dqblk *dst, struct fs_disk_quota *src) Could you move fs_disk_quota declaration from an XFS-specific header to a generic one? > Index: linux-2.6/fs/quota/dquot.c > =================================================================== > --- linux-2.6.orig/fs/quota/dquot.c 2010-05-05 11:57:47.000000000 +0200 > +++ linux-2.6/fs/quota/dquot.c 2010-05-05 11:59:07.614022286 +0200 > @@ -2286,28 +2286,36 @@ static inline qsize_t stoqb(qsize_t spac > } > > /* Generic routine for getting common part of quota structure */ > -static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di) > +static void do_get_dqblk(struct dquot *dquot, struct fs_disk_quota *di) > { > struct mem_dqblk *dm = &dquot->dq_dqb; > > + memset(di, 0, sizeof(*di)); > + di->d_version = FS_DQUOT_VERSION; > + di->d_flags = dquot->dq_type == USRQUOTA ? > + XFS_USER_QUOTA : XFS_GROUP_QUOTA; > + di->d_id = dquot->dq_id; XFS_USER_QUOTA and XFS_GROUP_QUOTA looks awkward in the generic code... ... > int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, > - struct if_dqblk *di) > + struct fs_disk_quota *di) > { > struct dquot *dquot; > > + if (!sb_has_quota_active(sb, type)) > + return -ESRCH; > + dqget() already does this check so you can just remove it.... > dquot = dqget(sb, id, type); > if (!dquot) > return -ESRCH; > -- Jan Kara SUSE Labs, CR