Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5976952pxb; Mon, 8 Nov 2021 01:02:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkpUiSs7LKObgw0gppfK54H/mYVrpiu/KR6JCMzCwk/Lu4VqCmPMIbeDHSYQ8/wq3TwJR/ X-Received: by 2002:a17:907:948a:: with SMTP id dm10mr45874421ejc.455.1636362175879; Mon, 08 Nov 2021 01:02:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636362175; cv=none; d=google.com; s=arc-20160816; b=PXXMpMgvBXK2bO7qCCrpHXtkn0N0+Zhxavp/eBrft8yqpWUfYKhksEeiGWOTZV7+nd JTsr4uNXFKJVgt+VSHCO2JaNFGyDp6hfvK5cr4pAW5JuYWjNDlPR6fo6Oq+gV7PgdXOW tNpoIna6jQFH/gfyq8fBhHvDMjgOHvC4Doa0hfOaTh1N6R6oU7fIO0evymNUr8e7rWhe 0MDU0B8g2gU6Wti2HFzeorQRiUTvLfz8yOTdJIGtdplGJl73lPv0LzwoACaZGOdEAv+9 M3/aWFbAq3/QMDK0jTVujXh+tam9X6pHr/ChwjzsLq8j2YVDev5nmvlsC/lyKJZTeMAE X7Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=v8Q8ulvpm7yX7aBB7IJwART33Yz4GSqkalLUmAdhO9c=; b=kF6lfAI4kDRBNYqsVGkkPb/7nG1/OBJS/QSH7XkfX6PprVqtl0irVWrBkh2sby3Hcs W16wCjex8JoYkralRfVTMymDVdj6wMv/snwwI7S7Ygf9EBtnkUEfmmvCgsnC4YhLSGmd CenNPUxeXFqX+S2vy3rs2q10oLoFkWZRHcgNN8JmtR5b1hiOoIJJI9L1o+MwFp/CsQd1 IetG8YDfw8HaXe7TxEwF4rs48W0s2wIyVRXyKBRjFoTUrXsJ/MPzU6RF+nZ+gLcPHMfV yqRyJjTVrlbrY4nWP/9o+X9AzDIbCCjmXry7UDD+IXtRNwPLQ13ZI/N+zqKmW59BS3T7 8llg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Uy7I0BkY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v28si21403368edx.614.2021.11.08.01.01.58; Mon, 08 Nov 2021 01:02:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Uy7I0BkY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237280AbhKHD5J (ORCPT + 99 others); Sun, 7 Nov 2021 22:57:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237263AbhKHD5A (ORCPT ); Sun, 7 Nov 2021 22:57:00 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0771AC061570; Sun, 7 Nov 2021 19:54:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=v8Q8ulvpm7yX7aBB7IJwART33Yz4GSqkalLUmAdhO9c=; b=Uy7I0BkYpuJ1o4zu4Pm8NKvH/2 tCk03XoCpSP4rVeYm+6NS+trSXq3J/MgZQFcBRIrnZHK447/NgWFX+2368IuheodtuMe1Bc232ErZ pLRGylXc9WHKLXBs3uGlLHmqTUEifkh6FTARE+zfdIQAG5Rp9uHEqP4LJzbhyt+1csLRat/wS+TpT NUgfS6wrQyjgIrs/FDJDEMJhjBRbyrN/7umBFq2P0RFvINtt33SVhLEYeZM8uxXXnxw5QSp+S22W9 5q9nWPc/yQCW2rM0TmLAk3KwmK3x72ml+D1BvD7rtOJB4XSyitYXS+uxZQaqf+vOAdPLuj2uKxqwe z5ZCe1+Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mjvhQ-00899m-FR; Mon, 08 Nov 2021 03:52:28 +0000 Date: Mon, 8 Nov 2021 03:52:00 +0000 From: Matthew Wilcox To: Joe Perches Cc: Wu Bo , 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 Message-ID: References: <1636341011-6494-1-git-send-email-wubo40@huawei.com> <3b7c6fa1183d4567403382ae8ba439dcea4b7e02.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3b7c6fa1183d4567403382ae8ba439dcea4b7e02.camel@perches.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.