Re: [RFC] quota: 64-bit limits with vfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  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 <jack@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux