public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	noreply@ellerman.id.au
Subject: Re: [PATCH -next] btrfs: lzo: Mask instead of divide to fix 32-bit build
Date: Tue, 5 Oct 2021 17:41:08 +0800	[thread overview]
Message-ID: <2011fda4-281a-b735-4af0-9f2baee5921d@suse.com> (raw)
In-Reply-To: <20211005093406.1241222-1-geert@linux-m68k.org>



On 2021/10/5 17:34, Geert Uytterhoeven wrote:
> On 32-bit builds (e.g. m68k):
> 
>      ERROR: modpost: "__umoddi3" [fs/btrfs/btrfs.ko] undefined!
> 
> "cur_in - start" is 64-bit, while sectorsize is u32.
> 
> As sectorsize is always a power of two, the 64-by-32 modulo operation
> can be replaced by a much cheaper bitwise AND with "sectorsize - 1".
> 
> Fixes: 0078783c7089fc83 ("btrfs: rework lzo_compress_pages() to make it subpage compatible")
> Reported-by: noreply@ellerman.id.au
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Oh, thanks for catching this.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
> Compile-tested only.
> ---
>   fs/btrfs/lzo.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
> index 47003cec4046f13e..d08f9eba49dab3cd 100644
> --- a/fs/btrfs/lzo.c
> +++ b/fs/btrfs/lzo.c
> @@ -211,7 +211,7 @@ int lzo_compress_pages(struct list_head *ws, struct address_space *mapping,
>   	 */
>   	cur_out += LZO_LEN;
>   	while (cur_in < start + len) {
> -		u32 sector_off = (cur_in - start) % sectorsize;
> +		u32 sector_off = (cur_in - start) & (sectorsize - 1);
>   		u32 in_len;
>   		size_t out_len;
>   
> 


  reply	other threads:[~2021-10-05  9:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05  9:34 [PATCH -next] btrfs: lzo: Mask instead of divide to fix 32-bit build Geert Uytterhoeven
2021-10-05  9:41 ` Qu Wenruo [this message]
2021-10-05 23:23 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2011fda4-281a-b735-4af0-9f2baee5921d@suse.com \
    --to=wqu@suse.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=geert@linux-m68k.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noreply@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox