grub-devel
[Top][All Lists]
Advanced

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

Re: [f2fs-dev] [PATCH v4] F2FS support


From: Jaegeuk Kim
Subject: Re: [f2fs-dev] [PATCH v4] F2FS support
Date: Tue, 15 Dec 2015 10:08:43 -0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Tue, Dec 15, 2015 at 11:34:24AM +0300, Andrei Borzenkov wrote:
> 15.12.2015 03:34, Jaegeuk Kim пишет:
> > Change log from v3:
> >  o add grub_test_bit_le()
> ...
> 
> > +
> > +static inline int
> > +grub_f2fs_test_bit_le (int nr, const grub_uint8_t *addr)
> > +{
> > +  const grub_int32_t *p = (const grub_int32_t *)addr;
> > +
> > +  nr = nr ^ 0;
> 
> It does nothing.

Ah, right.

> 
> > +
> > +  return p[nr >> 5] & (1 << (nr & 31));
> > +}
> 
> Well, you still miss the point - if you are working with integers you
> must shift differently depending on whether we are running big or little
> endian.

I just thought that it would be okay to bypass 32bits and then check its target
location, since we know it is LE.
Indeed, I was wrong that your concern was this line will be converted to BE when
CPU loads this 32-bit value.

> But as I mentioned before, we know that bitmap is little endian so we
> can work with bytes and be independent of byte order. Could you test if
> this works for you:
> 
> static inline int
> grub_f2fs_test_bit_le (int nr, const grub_uint8_t *addr)
> {
>   return addr[nr >> 3] & (1 << (nr & 7));
> }

Actually, I tested this before, but I got somehow failure, so tried this one.
Once I've checked bitmap contents in more details, I realized that this should
be a correct way; I confirmed that this has no problem.

I'll send another patch.
Thank you so much,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]