Re: [RFC PATCH v5] f2fs: support data compression

From: Jaegeuk Kim
Date: Fri Dec 20 2019 - 16:26:49 EST


On 12/19, Geert Uytterhoeven wrote:
> Hi,
>
> On Mon, Dec 16, 2019 at 7:29 AM Chao Yu <yuchao0@xxxxxxxxxx> wrote:
> >
> > This patch tries to support compression in f2fs.
>
>
>
> > --- a/fs/f2fs/file.c
> > +++ b/fs/f2fs/file.c
>
> > @@ -667,6 +719,24 @@ int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock)
> > return err;
> > }
> >
> > +int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock)
> > +{
> > + u64 free_from = from;
> > +
> > + /*
> > + * for compressed file, only support cluster size
> > + * aligned truncation.
> > + */
> > + if (f2fs_compressed_file(inode)) {
> > + size_t cluster_size = PAGE_SIZE <<
> > + F2FS_I(inode)->i_log_cluster_size;
> > +
> > + free_from = roundup(from, cluster_size);
>
> This is a 64-by-32 or 64-by-64 division, causing a link failure on
> 32-bit platforms:
>
> fs/f2fs/file.o: In function `f2fs_truncate_blocks':
> file.c:(.text+0x1db4): undefined reference to `__udivdi3'
>
> Please use DIV_ROUND_UP_ULL() instead.

Thanks, I applied it in:
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev

>
> Reported-by: <noreply@xxxxxxxxxxxxxx>
>
> > + }
> > +
> > + return do_truncate_blocks(inode, free_from, lock);
> > +}
>
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds