From: Matthew Wilcox <willy@infradead.org>
To: Joe Perches <joe@perches.com>
Cc: Wu Bo <wubo40@huawei.com>,
viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linfeilong@huawei.com
Subject: Re: [PATCH] fs: direct-io: use DIV_ROUND_UP helper macro for calculations
Date: Mon, 8 Nov 2021 03:52:00 +0000 [thread overview]
Message-ID: <YYie4D0U59hurOOd@casper.infradead.org> (raw)
In-Reply-To: <3b7c6fa1183d4567403382ae8ba439dcea4b7e02.camel@perches.com>
On Sun, Nov 07, 2021 at 07:17:07PM -0800, Joe Perches wrote:
> If you are interested, there are definitely a few more opportunities
> to use this DIV_ROUND_UP macro in the kernel:
>
> $ git grep -P -n '\(\s*([\w\.\>\[\]\-]+)\s*\+\s*([\w\.\>\[\]\-]+)\s*-\s*1\s*\)\s*/\s*(?:\1|\2)\b'
> arch/alpha/boot/tools/objstrip.c:260: mem_size = ((mem_size + pad - 1) / pad) * pad;
Might want to exclude 'tools' ...
> tools/bpf/bpftool/gen.c:184: align_off = (off + align - 1) / align * align;
> tools/io_uring/io_uring-bench.c:140: return (DEPTH + s->nr_files - 1) / s->nr_files;
> tools/lib/bpf/linker.c:1115: dst_align_sz = (dst->sec_sz + dst_align - 1) / dst_align * dst_align;
> tools/lib/subcmd/help.c:119: rows = (cmds->cnt + cols - 1) / cols;
> tools/testing/selftests/bpf/prog_tests/core_reloc.c:804: return (sz + page_size - 1) / page_size * page_size;
> tools/testing/selftests/bpf/prog_tests/mmap.c:13: return (sz + page_size - 1) / page_size * page_size;
> tools/testing/selftests/net/forwarding/sch_red.sh:202: local pkts=$(((diff + PKTSZ - 1) / PKTSZ))
> tools/vm/page-types.c:943: size, (size + page_size - 1) / page_size);
... because most of these files won't have access to that macro.
Definitely compile-test before sending a patch.
next prev parent reply other threads:[~2021-11-08 3:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-08 3:10 Wu Bo
2021-11-08 3:17 ` Joe Perches
2021-11-08 3:52 ` Matthew Wilcox [this message]
2021-11-08 4:02 ` Joe Perches
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=YYie4D0U59hurOOd@casper.infradead.org \
--to=willy@infradead.org \
--cc=joe@perches.com \
--cc=linfeilong@huawei.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=wubo40@huawei.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
all inboxes | Powered by JetHome®