From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: Use DIV_ROUND_UP rathen than opencoding it
Date: Wed, 4 Oct 2017 16:49:27 +0200 [thread overview]
Message-ID: <20171004144927.GD3521@twin.jikos.cz> (raw)
In-Reply-To: <1506606499-15127-1-git-send-email-nborisov@suse.com>
On Thu, Sep 28, 2017 at 04:48:19PM +0300, Nikolay Borisov wrote:
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/extent-tree.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index e2d7e86b51d1..9e67616892cd 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2896,9 +2896,8 @@ u64 btrfs_csum_bytes_to_leaves(struct btrfs_fs_info *fs_info, u64 csum_bytes)
> num_csums_per_leaf = div64_u64(csum_size,
> (u64)btrfs_super_csum_size(fs_info->super_copy));
> num_csums = div64_u64(csum_bytes, fs_info->sectorsize);
> - num_csums += num_csums_per_leaf - 1;
> - num_csums = div64_u64(num_csums, num_csums_per_leaf);
> - return num_csums;
> +
> + return DIV_ROUND_UP(num_csums, num_csums_per_leaf);
DIV_ROUND_UP ends up as plain division (/) so this will not work on
32bit. We need to keep it opencoded, or convert all the relevant
variabless to 32bit first.
#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
prev parent reply other threads:[~2017-10-04 14:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 13:48 [PATCH] btrfs: Use DIV_ROUND_UP rathen than opencoding it Nikolay Borisov
2017-10-04 14:49 ` David Sterba [this message]
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=20171004144927.GD3521@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.com \
/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;
as well as URLs for NNTP newsgroup(s).