Re: [PATCH] exfat/balloc: using ffs instead of internal logic

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

 



On Fri, Dec 08, 2023 at 07:47:01AM +0800, John Sanpe wrote:
>       WARN_ON(clu < EXFAT_FIRST_CLUSTER);
> -     ent_idx = CLUSTER_TO_BITMAP_ENT(clu);
> -     clu_base = BITMAP_ENT_TO_CLUSTER(ent_idx & ~(BITS_PER_BYTE_MASK));
> +     ent_idx = ALIGN_DOWN(CLUSTER_TO_BITMAP_ENT(clu), BITS_PER_LONG);

Thanks a lot for this question, the clusters are aligned here,
so the final calculated "map_b" is word-aligned.

On Tue, Dec 12, 2023 at 9:53 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Fri, Dec 08, 2023 at 07:47:01AM +0800, John Sanpe wrote:
> >       WARN_ON(clu < EXFAT_FIRST_CLUSTER);
> > -     ent_idx = CLUSTER_TO_BITMAP_ENT(clu);
> > -     clu_base = BITMAP_ENT_TO_CLUSTER(ent_idx & ~(BITS_PER_BYTE_MASK));
> > +     ent_idx = ALIGN_DOWN(CLUSTER_TO_BITMAP_ENT(clu), BITS_PER_LONG);
> > +     clu_base = BITMAP_ENT_TO_CLUSTER(ent_idx);
> >       clu_mask = IGNORED_BITS_REMAINED(clu, clu_base);
> >
> >       map_i = BITMAP_OFFSET_SECTOR_INDEX(sb, ent_idx);
> >       map_b = BITMAP_OFFSET_BYTE_IN_SECTOR(sb, ent_idx);
> >
> >       for (i = EXFAT_FIRST_CLUSTER; i < sbi->num_clusters;
> > -          i += BITS_PER_BYTE) {
> > -             k = *(sbi->vol_amap[map_i]->b_data + map_b);
> > +          i += BITS_PER_LONG) {
> > +             bitval = *(__le_long *)(sbi->vol_amap[map_i]->b_data + map_b);
>
> Is this guaranteed to be word-aligned, or might we end up doing
> misaligned loads here?
>





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

  Powered by Linux