From patchwork Fri Sep 15 22:43:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13387798 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2EB1CD37AE for ; Fri, 15 Sep 2023 22:44:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FFB58D0041; Fri, 15 Sep 2023 18:43:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AF1A8D003B; Fri, 15 Sep 2023 18:43:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DB008D0041; Fri, 15 Sep 2023 18:43:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 38A0F8D003B for ; Fri, 15 Sep 2023 18:43:56 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 13910140B83 for ; Fri, 15 Sep 2023 22:43:56 +0000 (UTC) X-FDA: 81240310872.21.6612B88 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf18.hostedemail.com (Postfix) with ESMTP id 244311C0006 for ; Fri, 15 Sep 2023 22:43:52 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="ipX40f4/"; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf18.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694817833; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kAhu3RhQYAb+8x8i6cEfQIaFhfRyBt/UYtL6yvE2uiU=; b=FsHNx+F2TZlaMvj/QCRfR9s0czdrtRrrwvpUa/FUF4chV193pBc0NEVosKHMMJjltjawIR oLz3mU/86o1eq/3MecNgrQhCKNRLKTd3YDjOvqOrfvSM2X4bDHb461IoetA995jOBeFabh sSqR4eP76WSdc6mjlue69tnCzQils3A= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="ipX40f4/"; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf18.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694817833; a=rsa-sha256; cv=none; b=KovQnSkqXrJyaqYpxatJtitEjWVmr3/LJA4Qdwr0Xr1PFG1InZzEuSg8RLiUNThqpBQFXD j4w1OBpUZ3gky1RBId6WArVplyz2m9oEWM8Brfhwguv439iYj+ENLsUIg7ov5lXbPWQ5pX 8rNoH068SxvE3TSKqmDSydk8m7Bn7ss= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description; bh=kAhu3RhQYAb+8x8i6cEfQIaFhfRyBt/UYtL6yvE2uiU=; b=ipX40f4//V/ZCGGZ4czyigk+tq Y1pEa4+9a0xgZHI9HB4D4Tfrictfi7SMy0XGAfRV739gQESHHurrBTlm5Ua+EE3iZV0tsx6IKqvwZ IiC6jCE6msF7T92DFE/znIds6/zZgcrifjXuvn0EcmNskZ6gPaGreeyH5rJC6lgqaAeL6P7rfVtkG DMPIuRQ+bZaIIBLKq7iwAyTitwD25b+3/vJUJ6ZlqhptkqgEUnJsMCFqyWqs7kD/j4JUp8wQpiPG0 Ac3VauQPjIuDinZl/qGvSMQdchK2QEx+UkGmAc0m6gGcpDATkelTsHLTVh8nggDwFVZd4JhiP4A92 z2qI6tpQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qhHXM-00BUtM-2g; Fri, 15 Sep 2023 22:43:44 +0000 From: Luis Chamberlain To: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, christoph.boehmwalder@linbit.com, hch@infradead.org, djwong@kernel.org, minchan@kernel.org, senozhatsky@chromium.org Cc: patches@lists.linux.dev, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, willy@infradead.org, hare@suse.de, p.raghav@samsung.com, da.gomez@samsung.com, rohan.puri@samsung.com, rpuri.linux@gmail.com, kbusch@kernel.org, mcgrof@kernel.org, Johannes Thumshirn Subject: [PATCH v3 1/4] drbd: use PAGE_SECTORS_SHIFT and PAGE_SECTORS Date: Fri, 15 Sep 2023 15:43:40 -0700 Message-Id: <20230915224343.2740317-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230915224343.2740317-1-mcgrof@kernel.org> References: <20230915224343.2740317-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 41paic8sr1y3d57mo9ufnqbuq4x3tj59 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 244311C0006 X-HE-Tag: 1694817832-324798 X-HE-Meta: U2FsdGVkX18svbjgHjyZdx4OGCKbQ0kSBh7q3acAmA4elK+omZ/WCB8h2esmmCThlBZrOY+yTe+WYVeoUi8EaJ3S2agplSdCZGF7bwJ37YDO0aFJAXLTt247MCVkEQJN8aIEk9oCvuYjawpoyyWVXcC6rw5OuJbIfeM9kXGHFwwUwV0uD+ZfmgWStB4Mh6dK8WsE6JTHOAmRletE1/a2SjN4X+F8PzH7PO9jnDG/BXkzWs1k9ED5cg3BgKbTIEh05luOMwXFcZtpnWhMgXL6A1ZgqZ9zLY/LLgbSGcgu90iyLAFeUjcZhUoPA1yAFPPa41EazU5Q88PxAwwyBBBz4W3DS/5NNL0+kX/975fC7Lxg/P724EHunEQFEUcQqeuv5HnLERJmnRmRzwFCbDtj/Nf5FEjs8ucnvauRgvdDP+ikzHpzdk41RpMr821Pvz2KeHrVd9mtu6hJrjsogTAab5JcCtZNF5lKXLJ24HVIWAYoLuyLqwjNjckWQtv+IgE437oExbPpe1cOob/0OFRf3rOgwhT6NXx8Os1ozO/9/jHyIiNSNmKJfERWBKpVBVDjkTXZl1z0fkCccbp1Wk3l/2k4PCNxjxMVpqEMCRf9PuGI9dyhchEFZ8I2ZADOMFd+rxTdXryWWzMzhb4wdkTKIiRWgMh9/N92I3Mqlwq9PDEbA66tS84L8zo/yv1PbAWFVCjgkvBt0YpeVTsKm3drCMAnI6zE+6uoW65PGaLhPhp1hugEAO290qcvQArDTtrkMkdUZRPggoimTErskI4Gtw+8Dn27/5DmBClCBcK90tBTuLqGBCQIgHe2QcyrNIOqqZWJpeOGblF0AyTPYv7nQy0kqYSK4Ush1MyE1WJnbsjRWWLFtfRhuQun3vakfK/WPA3iPAxZh9/cD40kbTL9zMX91ScqiXTL4416ikhMmnJQ173ZT082bV2LTSYGj7YZktlekkeKdcvFICKe4GO cXstw6AT Ut5B5dorGCWkRIg3RGIWvX5u7j4sQ/TXkyIB0KacBY/tKXb+Wyzn5gM8xW3VtwyIo5LZ3MEtrFYbKpnrztRG0nCpKiyUii5PJ0DNip+CEtDMgWH9j0pyXtLNCnmTf08sk1AXBe8sj+fITZUO7oDReCwBhShBElE1YZDCcR09tmr5KpjXGRtelk7t23dreKyMhPE/0ET2pFAb6Rs2DYoQywMXyrTY+qe5/yEI8h6AIyibvZhIRRpqN6A5uboN6c3UckkWscOUdPeYctAwzM+PW10Dt0x1N7VCtPyTA/954wq9n4EHu77NTov1PjYzaffK5+FGiBRbM3nnsN9ImmW6weP9WbqHPwR/7AtfF1gRS3pUTalx/SlWDlaguoKtne6nnI+ItOtFIevLEyYJbFtxY6YEPJu4bm2r2/lWwzCQg2l7N+8nNfp5SffXtRUjutQPy91Z8xK890RKJPo55dM5cSLeaBhQJ7HWN4xr6Qv0QwOvCIV2yebssbBQdnW65AZBIM/+Km/ELEvDfGgI9sJZ0qZCIM8wbU5ZlApIMMu6G+U2FKBDqOQbhZX15AdYN2uxTjXzpt2H7RwQQWH7YIOymG91RtQKizb9WOJxsBxRl2bl81TSZhjd/g1mHNTIoV0zQ+TT403eRlhJ1MvU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Replace common constants with generic versions. This produces no functional changes. Acked-by: Christoph Böhmwalder Reviewed-by: Johannes Thumshirn Signed-off-by: Luis Chamberlain --- drivers/block/drbd/drbd_bitmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index 85ca000a0564..1a1782f55e61 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c @@ -1000,7 +1000,7 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_ho unsigned int len; first_bm_sect = device->ldev->md.md_offset + device->ldev->md.bm_offset; - on_disk_sector = first_bm_sect + (((sector_t)page_nr) << (PAGE_SHIFT-SECTOR_SHIFT)); + on_disk_sector = first_bm_sect + (((sector_t)page_nr) << PAGE_SECTORS_SHIFT); /* this might happen with very small * flexible external meta data device, @@ -1008,7 +1008,7 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_ho last_bm_sect = drbd_md_last_bitmap_sector(device->ldev); if (first_bm_sect <= on_disk_sector && last_bm_sect >= on_disk_sector) { sector_t len_sect = last_bm_sect - on_disk_sector + 1; - if (len_sect < PAGE_SIZE/SECTOR_SIZE) + if (len_sect < PAGE_SECTORS) len = (unsigned int)len_sect*SECTOR_SIZE; else len = PAGE_SIZE; From patchwork Fri Sep 15 22:43:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13387796 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97D5CCD37AD for ; Fri, 15 Sep 2023 22:43:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8852A8D0037; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 837F68D0005; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5ED8B8D0005; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 486438D003B for ; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1ECCD140342 for ; Fri, 15 Sep 2023 22:43:55 +0000 (UTC) X-FDA: 81240310830.03.A566DFC Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf26.hostedemail.com (Postfix) with ESMTP id 84D99140014 for ; Fri, 15 Sep 2023 22:43:53 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=1rmGZrmQ; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf26.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694817833; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Cw7RdOPRUkFp9dSTX3luqJaGnpI4xwoQeOJGqBWR3yI=; b=lu+lFodjOPzZ+SzbLk/KV9+vmIcMDA4cUvB0m4W4+YHgM2xe+b1l3jHouiwajpuVZO+tl+ EkIloR5fyk8z96pl72IJcG7DmeRr1/+7Aqv4IpsxR1Ck/jHvss9y2jaRtIHQ10+wqTGto1 YnHA1BkDrpKQcsXtNz7uQ7AnQKS8cLU= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=1rmGZrmQ; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf26.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694817833; a=rsa-sha256; cv=none; b=OyTTGAp/BI4QcoT/AxqUKJ3T7d8qzA+vAQFZZOr4GNT5BOpf/n4mFT/XepTuNq1I3iKmMW LE6WBzE5DDH2HQCpjgFPofm1ODTfGp6Orzw6Ab6/JAITTBALe4i020Lx7i9fIwhHMMG540 CkZfd01oxoj8doZVZOk/XFI09AyoCZk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=Cw7RdOPRUkFp9dSTX3luqJaGnpI4xwoQeOJGqBWR3yI=; b=1rmGZrmQs0g1DKXfgxLAklopAe hlHs1CUpNdjbnNFHADeESgt/6Vhl4duyfWJfd4Q4DqZhJEDCXIohWQ+xV5q6vXlqM4C/+hM3D1O3Q SwdqMuin1I8pjQdZVkuDAnCcy1hpH+aqLmYGzojA6vtCKn8l5wDEJqaiv7JyxJ9v+IyG9VHu5GOCP TDZSQsLAhwMkPOsb30jEZw/XSRiqfzp0YsDrTdxh3PI1k2COGy8dywW8yjBv0xwqjlxt/qWVKsKZl y9SMV97NUMeWJP80xqcfTSA7HtOND5LWzvqRQ+ERzBdK/tkTSieB2KIOiiQFxn4gcM02gDuZW4SFx eR5tBK9A==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qhHXM-00BUtO-2p; Fri, 15 Sep 2023 22:43:44 +0000 From: Luis Chamberlain To: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, christoph.boehmwalder@linbit.com, hch@infradead.org, djwong@kernel.org, minchan@kernel.org, senozhatsky@chromium.org Cc: patches@lists.linux.dev, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, willy@infradead.org, hare@suse.de, p.raghav@samsung.com, da.gomez@samsung.com, rohan.puri@samsung.com, rpuri.linux@gmail.com, kbusch@kernel.org, mcgrof@kernel.org, Christoph Hellwig Subject: [PATCH v3 2/4] iomap: simplify iomap_init() with PAGE_SECTORS Date: Fri, 15 Sep 2023 15:43:41 -0700 Message-Id: <20230915224343.2740317-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230915224343.2740317-1-mcgrof@kernel.org> References: <20230915224343.2740317-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 84D99140014 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 1nx1wq8jeuwgixqzptsg6mm5utfwfxyo X-HE-Tag: 1694817833-124934 X-HE-Meta: U2FsdGVkX19TB/jls+DX+GgzPhUjAXn8gYC//O9jAbBtNC08L/pwXWiaehwnQ3j/zm+1nvjJzV97aQGFwHk1C2OnwmAwfGnwF9Cc4SCzuLTvbGDDjvheUCflbEbuFA5pp4CwcvnOgWQ0R+BW/5jYV4Hc4XoR1Lutn7b/jL068h6vUBq7/Dd7HWzz+/Z06dSxPgzaJ90ax58lsg58ERu1NVghYvk5j7wW0V+R2ckPOLoJ1P4iTl2eiH8v+Uak444VFvqWdJHT4i4xGKCTR+jnfGa+zugiZdVT8KRhtY30x4StL0kCSBQ+qnkOk4vMSX8GievVgQOkaq6JjeLaPOqCKCaAkr1z2bMvhTsxsFci02HrziHK7zDHasbkgl6K5c9Uw7V8yRD+mokA7R2oWng0U43QWMTvRU+kt8Q6dNu98aTESxdrJRk1urUz1XpG1CiTqgVTsVNE8swjOjuTNk2BNyt99jcN6tEx8NBPa3FOxuq2Bxo7VpiMU2GLWoIpK8G9DdR5EGouqXf/X71H3uoqir2jUikSldcWXoYMNpw7Mq68VFyYioLjSfAhstHKHKVanwlAE3IjxU7PhglfLD6RQAE9Hp4mc5SbKJL0MHFxI0VCnU6M7w2LtgfsQb94Dtv5M/+ahHeuxKDTxtyM8vLj9ejtTYM5qS6sts/dbxmsadcWbEHm5HcRUmryYvQNmp87qLjSg+PsbcFhMfkFRa6QGfvppzF6imfo0/gAEtxMjtV9zPx0hxe58Uf7ZLs/XmIGX4oPZhszin3AoBrwHAQUPwnvUKkLBf8UlSxhvKntK10u2v5vHR7rxWN6GrE04WI3WrN8zE7RghAro1UxL+6EQGT9GhZaR8ZHzAl7z2keXrdJDnoYjbupkLzTSDMjg+HEV/k0hsJTGuvB7l7eRXvEt7HZ19GiPKHEwoZ2VlsFRnrP+068Ko1j7NfQ1h7c2gbqTavHSd5WitdShkyRAYP /paw0t/y TQs17qM1MJCOR68NVOESGkRopWsVUcugg7+EY2RV+NNOc9zSp62K63hzdBz1rSD2ranBoO1d8+Rcx2smoKFshpF+pg8rRhiIsAqBjOi0sILzEWGcaOmnthOkRu58pVLmOjTfesZbzx1XlkxMGvyBFhREYq4HDmflO/Lj/RncYZfja8u5gpkEpYz2tvbYcn/Us8G5chbfcac8Mr8326zEk8buSNgkCX1NLycgD+fgPA8N0Mi/KtGP/S/WPJeVQbT3TQ2WoOYt2RkMju/E7mPYFP9w6AFA920sTUr66xzO4O7btegcBrIGi7G6jP+JncChiz+Rr+lE9I4lrlYF55CkNffuspIhXHwcAiJcIpnD3p3jMz3uhhlYdEkcyIMyYqRautBiIMsHBY9WRMAF/zvKFs/utIvTOfq5cJCwqXBK0lxf5phPjs2G6jGIDS832QQU3ym0yJZ6WlDOI0DbW6YaoTlrsWYp+EJxNO2lxcif7Xq1jFBXnIJjdUNxMjEP2sRkjh8K0Ia0FhJ4dsIA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Replace common constants with generic versions. This produces no functional changes. Reviewed-by: Christoph Hellwig Signed-off-by: Luis Chamberlain Reviewed-by: Johannes Thumshirn --- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index ae8673ce08b1..1a16c0e5d190 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1985,7 +1985,7 @@ EXPORT_SYMBOL_GPL(iomap_writepages); static int __init iomap_init(void) { - return bioset_init(&iomap_ioend_bioset, 4 * (PAGE_SIZE / SECTOR_SIZE), + return bioset_init(&iomap_ioend_bioset, 4 * PAGE_SECTORS, offsetof(struct iomap_ioend, io_inline_bio), BIOSET_NEED_BVECS); } From patchwork Fri Sep 15 22:43:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13387797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 344F3CD37AA for ; Fri, 15 Sep 2023 22:44:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AAC198D0005; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A37EA8D003B; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79ADF8D0041; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 67A168D003B for ; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3BD27C0840 for ; Fri, 15 Sep 2023 22:43:55 +0000 (UTC) X-FDA: 81240310830.25.A87FFC9 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf20.hostedemail.com (Postfix) with ESMTP id 9C7651C000F for ; Fri, 15 Sep 2023 22:43:53 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=XIkzA4O9; spf=none (imf20.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694817833; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=q5kC8lKXTQQVIY9YNTK1DwlfcMyU3THWqOh+LBupeKg=; b=zqjqumMChl8kEc030D3DVlq+r2KQSxFevuZHmFQ25kqmrtnnbbmepxFI6WEgbv7F8an+/H VcLPhyVSB3OgTj/L3ype3DNBgNf007a9ieJeriMQe05DygdxNfELADMZx2Qmg9crVdgKBW hNOACnHo6kl5WNpKHfRWa9n/sALkQ4M= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=XIkzA4O9; spf=none (imf20.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694817833; a=rsa-sha256; cv=none; b=jGhjNSrTqG4Ie5VWlSvu06R54KtsZ1YTc7IZP28P54FuygVoKOZN9NGaW6+LDERfNPdBIY xwfffIjimGHI0l8jaRFl4/k4MEO3WS+ydV+ajU4gxgpxSF4cR6XjpPDBcqnXFF7Y4T3s63 NCpoXOuAIMyqL57f2ksU2/7NgX94Gdo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=q5kC8lKXTQQVIY9YNTK1DwlfcMyU3THWqOh+LBupeKg=; b=XIkzA4O9wGqO2WtO8tF1Z+xTn6 38fyqpIf4n/IRVBBYSnI4HTtxoGdQ8LSxZIP8/NSOPmdJX/6DryFm1LyL2/rS5Wthw0D9Rc5scxXx LeBfwDOWskLDMOD5Txbwvzoa8w47Q+FzsTwVlhtZIXH8t5goceyGum2sBY4q4juffs5HTbYPQASpT iQMJK8QZZL36GAP7fFFC9PfseuwA7wua+m3Sm1TqVEdTdAbNRv6nBe+cI0DCPcBiEFH5r0zh2G8tV 4s4fP5cV+wF3aIWx2BG++FJ3o6PNKFE+Z1nWnlngkygbY4QmNH8SvuZMwjZKYMIc4beAWEP5tblOE kS4wAVZA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qhHXM-00BUtR-2z; Fri, 15 Sep 2023 22:43:44 +0000 From: Luis Chamberlain To: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, christoph.boehmwalder@linbit.com, hch@infradead.org, djwong@kernel.org, minchan@kernel.org, senozhatsky@chromium.org Cc: patches@lists.linux.dev, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, willy@infradead.org, hare@suse.de, p.raghav@samsung.com, da.gomez@samsung.com, rohan.puri@samsung.com, rpuri.linux@gmail.com, kbusch@kernel.org, mcgrof@kernel.org Subject: [PATCH v3 3/4] dm bufio: simplify by using PAGE_SECTORS_SHIFT Date: Fri, 15 Sep 2023 15:43:42 -0700 Message-Id: <20230915224343.2740317-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230915224343.2740317-1-mcgrof@kernel.org> References: <20230915224343.2740317-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9C7651C000F X-Rspam-User: X-Stat-Signature: ro9f4oso3kskp3m8x8er8s6p4ygk6j4u X-Rspamd-Server: rspam01 X-HE-Tag: 1694817833-827280 X-HE-Meta: U2FsdGVkX1+Zx7sep6t3+czVTXYSDnFacHKC5i7bSRPKPIjtStN0gU2988QZtJn3bqDgF6ABp2f9odq3OCvb/Dl6+F5rA7HDMAzynyvnBt/WNjrrGk0FUXYL004mHb6auOlDdbm7PCvmtfd55VUq2xZwvEOTDVJ2DLc/pnRZcdBHFFgdAp8O5KtpABH0djhdftp5deTZz9uhZvtiH3uW/i3uer7ZENCa+1XMm2JaMCFdheED/m6hwysvTxUrc1UiIr9TaiZNUW3087Cb3R26nNmpCGF3AV1KzurFwfdv7d/4pomdAUfwP89sJUggEwCEb3RsRMZu278FgZ4riawLtYxw1s8Obtb2X1RiXK5A8Df2B1IihQs2hV9nHzPhZa9xFmd27CMM++ogO/lIh4kMfy47WnMoa/BNMjiMCmN38b0PPQLgIIrRMz8bVVM6iLXvwwsi1a+FO6PGuTDA/1Irn/og+7y+yy105rgyHpYnr9dLy5KRQbai3zPSpXpzN3kJjKrz1vsn2b1KPEJSnHOi/L9LYeFqS51nswxfBP33lu4ConGt5QUJgOY1124bL00cCglAjBamf8+ektjizyt6TTsfdzijn0eBw5mx4Zv67oxcMdoDN5whIRRgD/65YtubSgxiEf67kEhAMHZGiH51vAue9/N2omLy09jzCXk+xIoTq0Uva/hpg+u3KhTpDl8ZnRcr1MnExudqdGcylbFT0krQduVlhBkEqypZkl3tItGBL0Jwe/khuI2Z+qu3e9Vb0ppaJyHXE/WQXWiPNron07etoDcGUBjaf/aQHsV429JAaKhKM4q2aXYOPV6A7OA8Znxiq4MaUiiwodF7KugPTcqH90gQBdFw6RzUm2zChN5wxhsFYzIUWtbLVHpv3bHTXb7ohVCr1hsuWGX3jrV2XeOBsF0+Bg7Eat9kMcsTsb1tYBy6fUEzUekHz1mP6LukHMalReSVjd2QtWiBxeG WnCbaBbw M3VwamZjYuDVyw1x3Ce/IcntsXvmDsVS0qroKpnYxO+QoXpK+LvqBcS0Rnltde+TkpcrlkjglHiZhM3Fn6fq2lILbIbroMMGo7zewCJNB7s0ainVRS/89oQtzeP5H0mhyxRcnG/+wo+rNANagd23jwB4eIji3XJE/RYf1yS5LLdr7cfHHOKbfJwuo7e02YeM6nsCLsxTpS5Y+i8T8TCmHUPI2/nwnJcgbhDeKpsjG9pYqJbUS9Lae7Ec3LsMOO1APSmBt423KFWmj4E+Fm0DPDNWa+3TWSt/F9CBr12zgCJoAg3UKhnaNiqzs6cEdRfJagsWFP1oTushExW6IoNdMMLcXOq9X19ggErJ0asZ5SS946fkLYCLYosG7anQbTVI1ulRCnCwZYVgOpxcI6/wnm/j5uwjxIAz0hR1XLyIH+y5aystIM/KynMGSjWZPaEk1HUc8tCAcdj38JzELSaxm0/mbkSgEAUsqK+D128T9n0pQowkYzisDM2uD4ChuKwujdA4u/rOawhCGiUs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The PAGE_SHIFT - SECTOR_SHIFT constant be replaced with PAGE_SECTORS_SHIFT defined in linux/blt_types.h, which is included by linux/blkdev.h. This produces no functional changes. Signed-off-by: Luis Chamberlain Reviewed-by: Johannes Thumshirn --- drivers/md/dm-bufio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 62eb27639c9b..a5b48be93b30 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -1152,7 +1152,7 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask, gfp_mask & __GFP_NORETRY) { *data_mode = DATA_MODE_GET_FREE_PAGES; return (void *)__get_free_pages(gfp_mask, - c->sectors_per_block_bits - (PAGE_SHIFT - SECTOR_SHIFT)); + c->sectors_per_block_bits - PAGE_SECTORS_SHIFT); } *data_mode = DATA_MODE_VMALLOC; @@ -1173,7 +1173,7 @@ static void free_buffer_data(struct dm_bufio_client *c, case DATA_MODE_GET_FREE_PAGES: free_pages((unsigned long)data, - c->sectors_per_block_bits - (PAGE_SHIFT - SECTOR_SHIFT)); + c->sectors_per_block_bits - PAGE_SECTORS_SHIFT); break; case DATA_MODE_VMALLOC: From patchwork Fri Sep 15 22:43:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13387795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACC8FCD37AE for ; Fri, 15 Sep 2023 22:43:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F0B68D0040; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 561698D0037; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F5158D0005; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 07B038D0037 for ; Fri, 15 Sep 2023 18:43:55 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D47C61A068C for ; Fri, 15 Sep 2023 22:43:54 +0000 (UTC) X-FDA: 81240310788.30.0398E37 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf17.hostedemail.com (Postfix) with ESMTP id BE15440008 for ; Fri, 15 Sep 2023 22:43:52 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=xX7TFA9k; spf=none (imf17.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694817833; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OTSjAv0PEMH+tCuP3ffDEqRz+yWbCz97RfaFT2lMORg=; b=o7NfuNVXRG3HucFbZHsF1Y2fIX19GEWi5tuoWlqm5FVlOVylQySsTiu83LSU0A0GkfRICW tFYPsCrIjIB3BFf3iCPY4q64IDPp3VUqvHkLOCaomVKkPYWUgzOTfyJ9SmPo0EtdcLFaKn n6YxkB9KW5H7EVDfsP0Iy6r23RaxQ7k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694817833; a=rsa-sha256; cv=none; b=fcwsDMUzjz0lCcTLJoys7gI8JJszqeFk4LDkv4v+vsy5IG3O9Zcm6NlX4HiHLCwnoQRWlP Ky12Za9Eme0AwdowMV4LJz3B5cOWKIqrB593tHZugaJNaUlkhaRS/Ot9DPXnJCxmO6b+W3 W67GBmEBcA2BoeUjIvHnOUgm5r56c+k= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=xX7TFA9k; spf=none (imf17.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=OTSjAv0PEMH+tCuP3ffDEqRz+yWbCz97RfaFT2lMORg=; b=xX7TFA9kztVjOz7d+p1P/TM7Ay nomWAhSivQ5lCdYaAeQK3cLiJwl2lWQjj7B6LNKYf1vfNWGbzkrCZMyNLm6Xz2TU9IbPPJp2V9vDp sQRh+Sstun+Z0VSd9LRO9XmHZ18g7f+6Gk3qAyBGtCb7Db23OD+grSKpMAjzWlAHpruUvoReSSHoL FVA7AVwZFM51kSRVjdptDf4W4Ul1PNFHmTYueINUMel+3WCyzzfPJyYQBgAqmZUxP6GWv6YGQdUCU nybG1VZrotzL0I0hsJgT58ibcJ778KXSwP4LuGA3/rm7WCzSQLcDIh/QqPl2oLQ441Z3Dm7mjfkmU FcOwZwkA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qhHXM-00BUtT-38; Fri, 15 Sep 2023 22:43:44 +0000 From: Luis Chamberlain To: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, christoph.boehmwalder@linbit.com, hch@infradead.org, djwong@kernel.org, minchan@kernel.org, senozhatsky@chromium.org Cc: patches@lists.linux.dev, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, willy@infradead.org, hare@suse.de, p.raghav@samsung.com, da.gomez@samsung.com, rohan.puri@samsung.com, rpuri.linux@gmail.com, kbusch@kernel.org, mcgrof@kernel.org Subject: [PATCH v3 4/4] zram: use generic PAGE_SECTORS and PAGE_SECTORS_SHIFT Date: Fri, 15 Sep 2023 15:43:43 -0700 Message-Id: <20230915224343.2740317-5-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230915224343.2740317-1-mcgrof@kernel.org> References: <20230915224343.2740317-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: BE15440008 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: y9azbq55yj55tt3wdbtjonxfb7a6pi7k X-HE-Tag: 1694817832-946759 X-HE-Meta: U2FsdGVkX1/KWXcILs831Jl+kFi2sRB5FuDTmAnA8YKy/LgAuFEBh1SZu2268ZeQqS2m5+8XUcQIJDpnhBwszJ5MALcrcsOkJ75LyhHtqbZbtpr+oNPDFFuBjrARg3IK9KjBGBDMYBXrKIgs1tIq6NpRx2d89tjCSMpW7MBFkjKQ6fur20mPhXOnV19mbgQammU/y9ZH7KlIvJASvWwBeunq0UNdMxWpzwcSKvtnQLTCNN7pdiT0EKWngmjVP7UmeNFtQYB6I3cTNzVrk1DYzNnViBUR+l8P7Wt6473UEYqB+AubUjDsBqteg7BOsRDWVpGxWb+w6OQ8y65zlGd5gVW81co2Eq45EalRlQOZsyClcAyZ/Stkk0TdKQEGATw/8xWxbSGRUG9e9f1in6ScidvP03JuFhr2gGuEdSGjxNKGSzFKQw7DCojeYNxDQb8GZf11UzgdOIqYBSMNGmA8aF1/u1WjU7cnw2PGgGuJoWBrfY7MtVv7QVsi2YhWFpfmqV8iMG8lUq8Dx6SjtOy15kyHXB5qtgAKAgqeiYc6KCiav2CLz1l41Gj5Zs41/1Bhax7ena0JKZdergUXyydisbhzF2850F9yq7HWI1L88ohKvbSNkuXMmmPSMkAzO+Ugr/81hnPIJ/gqwK5rBFTYB2B4waNO49KUGR4lzOGLHZxfunxg3n0CbyFJBMsfxDjocXmCo0WWjksZwMwY5wBJxcQ+UUZz3t45MEQwQpXfT7v7bC8ruOXI/lUs34LaKuQRAF27riU9UMGLOxY330KPTgTyjVeueL5bUjE7K6XekW124SXAnO0JDHMZHierpXEpPWWXBW5xuwv6V7G5yzM8BUApNNUQyyktRdYhWoCD68SLt1lf+spCx/X5YNUje6gcMhqWjna1dJGOKdFEJuNYP70RNIKxgA6sZqTTjFTr29SV2DP5EkEBQVoUbErB0DPZ2RQTY/WFaFinAUwckj6 csy3Gm4N b2jlFzi8vSWWafJy4C+x+d27av4M2nvUWus/2qpS3+HHb2NBd6SihHMK8ct3oPUnQUBL6UJZjrSS0+jA6ON6wNJU+snQtjc9cF0L6Df0dA4iKr+e/BHkoyghIngJ8y48sQVk96Fo/5bicwkzxaqdzYFkV7flhUrFwYXYIYFv8+spv79yEhayNT6+QeOw9DKG+6+phTIhRGpRhIUFXcKcB4xR5FrdfX5cbieygOksrwh1eLrVMZKY8O6q7sGvJeoRn+J6MDsuLAsSw/QMlPcEmul/w/ulF6m2In0BGob8BSK8+2K/2ZoVNR0GR5J3rPXHZhKZ1PxTebSxgYcmPjwUxIwkCCsngqH7fPh3//DXXqdVvEP+GkUda08ixCnscjS0ZlE2Q2vRBSEYsWMwr/Y/2Xt3dsFYrsSlNDGE7U/S5RaEVYz0raKENaqwnpAApUzojPGQYAvDq2uYaLUVbbJi4dFHbB+oMSgmYtC1qdRbkQ06C+hBunyk+bjYPIHJOwo1o2nYMAstcs0BmpEHVaDIFyZOOYSyte31mklwSq2D9pt1fOLBo0nFYoy0PdSm34DYDh2D0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Instead of re-defining the already existing constants use the provided ones: So replace: o SECTORS_PER_PAGE_SHIFT with PAGE_SECTORS_SHIFT o SECTORS_PER_PAGE with PAGE_SECTORS o SECTORS_PER_PAGE - 1 with SECTOR_MASK This produces no functional changes. Reviewed-by: Sergey Senozhatsky Signed-off-by: Luis Chamberlain Reviewed-by: Johannes Thumshirn --- drivers/block/zram/zram_drv.c | 15 ++++++--------- drivers/block/zram/zram_drv.h | 2 -- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 06673c6ca255..58d36c8574d4 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1834,9 +1834,8 @@ static ssize_t recompress_store(struct device *dev, static void zram_bio_discard(struct zram *zram, struct bio *bio) { size_t n = bio->bi_iter.bi_size; - u32 index = bio->bi_iter.bi_sector >> SECTORS_PER_PAGE_SHIFT; - u32 offset = (bio->bi_iter.bi_sector & (SECTORS_PER_PAGE - 1)) << - SECTOR_SHIFT; + u32 index = bio->bi_iter.bi_sector >> PAGE_SECTORS_SHIFT; + u32 offset = (bio->bi_iter.bi_sector & SECTOR_MASK) << SECTOR_SHIFT; /* * zram manages data in physical block size units. Because logical block @@ -1874,9 +1873,8 @@ static void zram_bio_read(struct zram *zram, struct bio *bio) struct bvec_iter iter = bio->bi_iter; do { - u32 index = iter.bi_sector >> SECTORS_PER_PAGE_SHIFT; - u32 offset = (iter.bi_sector & (SECTORS_PER_PAGE - 1)) << - SECTOR_SHIFT; + u32 index = iter.bi_sector >> PAGE_SECTORS_SHIFT; + u32 offset = (iter.bi_sector & SECTOR_MASK) << SECTOR_SHIFT; struct bio_vec bv = bio_iter_iovec(bio, iter); bv.bv_len = min_t(u32, bv.bv_len, PAGE_SIZE - offset); @@ -1905,9 +1903,8 @@ static void zram_bio_write(struct zram *zram, struct bio *bio) struct bvec_iter iter = bio->bi_iter; do { - u32 index = iter.bi_sector >> SECTORS_PER_PAGE_SHIFT; - u32 offset = (iter.bi_sector & (SECTORS_PER_PAGE - 1)) << - SECTOR_SHIFT; + u32 index = iter.bi_sector >> PAGE_SECTORS_SHIFT; + u32 offset = (iter.bi_sector & SECTOR_MASK) << SECTOR_SHIFT; struct bio_vec bv = bio_iter_iovec(bio, iter); bv.bv_len = min_t(u32, bv.bv_len, PAGE_SIZE - offset); diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h index ca7a15bd4845..9f2543af5c76 100644 --- a/drivers/block/zram/zram_drv.h +++ b/drivers/block/zram/zram_drv.h @@ -21,8 +21,6 @@ #include "zcomp.h" -#define SECTORS_PER_PAGE_SHIFT (PAGE_SHIFT - SECTOR_SHIFT) -#define SECTORS_PER_PAGE (1 << SECTORS_PER_PAGE_SHIFT) #define ZRAM_LOGICAL_BLOCK_SHIFT 12 #define ZRAM_LOGICAL_BLOCK_SIZE (1 << ZRAM_LOGICAL_BLOCK_SHIFT) #define ZRAM_SECTOR_PER_LOGICAL_BLOCK \