From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: [RFC] quota: 64-bit limits with vfs Date: Mon, 10 Mar 2008 18:20:28 +0100 Message-ID: <20080310172028.GD30435@duck.suse.cz> References: <200803061641.12274.andrew.perepechko@sun.com> <200803100146.03671.andrew.perepechko@sun.com> <20080310162609.GA30435@duck.suse.cz> <200803102013.11097.andrew.perepechko@sun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, Johann Lombardi , Zhiyong Landen tian , Alex Lyashkov To: Andrew Perepechko Return-path: Received: from styx.suse.cz ([82.119.242.94]:41482 "EHLO duck.suse.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751167AbYCJRU3 (ORCPT ); Mon, 10 Mar 2008 13:20:29 -0400 Content-Disposition: inline In-Reply-To: <200803102013.11097.andrew.perepechko@sun.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hello Andrew, On Mon 10-03-08 20:13:10, Andrew Perepechko wrote: > 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? ;) Oops, sorry, I misread the macro DQ2MQ(). It will work fine. Hmm, I still don't like the macro magic too much, but I guess it's good enough :) > 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(). > > Honza -- Jan Kara SUSE Labs, CR