From: Andrew Perepechko Subject: Re: [RFC] quota: 64-bit limits with vfs Date: Mon, 10 Mar 2008 20:13:10 +0300 Message-ID: <200803102013.11097.andrew.perepechko@sun.com> References: <200803061641.12274.andrew.perepechko@sun.com> <200803100146.03671.andrew.perepechko@sun.com> <20080310162609.GA30435@duck.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7BIT Cc: linux-fsdevel@vger.kernel.org, Johann Lombardi , Zhiyong Landen tian , Alex Lyashkov To: Jan Kara Return-path: Received: from brmea-mail-2.Sun.COM ([192.18.98.43]:62551 "EHLO brmea-mail-2.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbYCJRLV (ORCPT ); Mon, 10 Mar 2008 13:11:21 -0400 Received: from fe-amer-09.sun.com ([192.18.109.79]) by brmea-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id m2AHBLsU019907 for ; Mon, 10 Mar 2008 17:11:21 GMT Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JXI00601Y8I9500@mail-amer.sun.com> (original mail from Andrew.Perepechko@Sun.COM) for linux-fsdevel@vger.kernel.org; Mon, 10 Mar 2008 11:11:21 -0600 (MDT) In-reply-to: <20080310162609.GA30435@duck.suse.cz> Content-disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hello, Jan. I agree with your comments except for the one below. Why do you think these macros don't do the right thing? How can they fail? I can't agree with you that introducing separate functions for id/time and duplicating code in disk2memdqblk and mem2diskdqblk is more nice than using several uniform macros(why aren't the latter nice, btw?). Wasn't that you who told me that code duplication is no good? ;) Thank you for your patience. Andrew. On Monday 10 March 2008 19:26:09 Jan Kara wrote: > > +#define DQ2MQ(v) (sizeof(v) == sizeof(__u64) ? \ > > + (qsize_t)le64_to_cpu(v) : \ > > + (qsize_t)le32_to_cpu(v)) > > + > > +#define MQ2DQ(v, newv) (sizeof(v) == sizeof(__u64) ? \ > > + (v = cpu_to_le64((__u64)newv)) : \ > > + (v = cpu_to_le32((__u32)newv))) > > + > > +#define DQF_GET(var, rev, field) (rev == 0 ? \ > > + DQ2MQ((var)->disk_dqblk_r0.field) : \ > > + DQ2MQ((var)->disk_dqblk_r1.field)) > > + > > +#define DQF_PUT(var, rev, field, val) (rev == 0 ? \ > > + MQ2DQ((var)->disk_dqblk_r0.field, val) : \ > > + MQ2DQ((var)->disk_dqblk_r1.field, val)) > Actually, these macros will do the right thing for dqb_id only be sheer > luck and they won't work for dqb_curspace, dqb_itime and dqb_btime. > Please just get rid of them, they aren't very nice anyway. In disk2memdqb() > and mem2diskdqb() just do > > if (rev == 0) { > conversions.. > } > else if (ret == 1) { > conversions.. > } > else { > BUG(); > } > > And for fields dqb_id and dqb_itime we use at other places introduce > functions get_dqb_id() and get/set_dqb_itime(). >