Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp101757pxh; Tue, 9 Nov 2021 07:56:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJwboUTM4uH28E75oiGBmHiw3kuEHx6dVVNVqCuHWFzDcvODUZ9LwOW+GsSzUguXQK6woETV X-Received: by 2002:a17:907:1dd5:: with SMTP id og21mr11422597ejc.233.1636473377593; Tue, 09 Nov 2021 07:56:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636473377; cv=none; d=google.com; s=arc-20160816; b=YF9A+5Y+qxzFSx2C9mRoQ/oOK5aSiXhTGBBhBeRtHmUWuhCPWcUjKUxtFdkzvOPBb0 mT9yjJVHtpa25b+52FhdblHTQHhFcRlVkViPGbCSqniLyeTYnbEIEVpKg/2yVo59+rKu R+ZdcL56d3ExlhNUJwryIOvLWQqgCxEClIGwSVFeU1Rjyi+/U/6JG9CUKsaW1TxnyT0d f/m+SxVagKTXhWPvP246INSHjFLyPgMa/iwR6rE2WMyZJ0EOL6LkMO6LHRC/+OIf3403 zke+k3eiV9kst4rmz9cNJCSqoCgFmiWR0PRmr83jiLcKn7F0BAD/gP1S+7xxjWDO/ZdV x2WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zfCI/U8WTukvUOFF16NcuXhCNGsYjAKrDL4zQNucYJY=; b=DTjTw9PGeXkHdn5h6dQ7XqCHkaAoaPo5ejxIHtY7GEOF82P52ns7JFhK0xAg2OWgE6 yLa0M6w77J28sHbdFM1CtczPbFHY8vRSQKdVM/gr1bk6hwiIU9Y93VYrDGTrGVHYgVk3 4YZHAAxCUQbVPQqnpF2yWM7uFvVd9zXLxo3L9YDMXWGks7NNgo36NIAKN3WY83r+c4fG lZ58MwiKLcJXpQk8OzW0UiMt+1MnENTEOoysWubeU1UiQ8cq/y9IXxB1bOU7xs7rBGCg tqDhlS+ei6BX5/h6ERb6wPfD/yYQeTSwIfLjODwiE7jBgXcki/XTXu+58yS7D86Kh4V2 4bkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=o6GhNxlQ; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 z6si34414153edp.542.2021.11.09.07.55.53; Tue, 09 Nov 2021 07:56:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=o6GhNxlQ; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244209AbhKIIgh (ORCPT + 99 others); Tue, 9 Nov 2021 03:36:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244196AbhKIIgd (ORCPT ); Tue, 9 Nov 2021 03:36:33 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9434BC061767; Tue, 9 Nov 2021 00:33:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=zfCI/U8WTukvUOFF16NcuXhCNGsYjAKrDL4zQNucYJY=; b=o6GhNxlQ3IOt/+NcSH7pkNZyIL e2NSHpEgG9tiBm0dYKfFQsF4fAAYNym9zC+t/oW68Brq6whz7Cii35gCwCKYHwTVndsoeduiVYmUU Q801npG6fplWZawdN/5aJPLAtwfswvRBf/64Q7wOP1Dm1K7qDH0oTzbj4ICmluRQbgiYJxppS8Dyq nmjKrkOjW6ZuxyH4A718D3Pb5Io8KoSUtQMHFkso1tiV5r1efOgc5GVO5cgOJ+sDzKB+KCL0eafbU mBvauGwx5vGzElAKrv1yl8LYZP+pskH0bgRrmWiKl7zcxgKmqUdOOx76gDAbJy66nOvQsYHxFG+Ts VRdqkklQ==; Received: from [2001:4bb8:19a:7ee7:fb46:2fe1:8652:d9d4] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMZa-000s5E-1A; Tue, 09 Nov 2021 08:33:43 +0000 From: Christoph Hellwig To: Dan Williams Cc: Mike Snitzer , Ira Weiny , dm-devel@redhat.com, linux-xfs@vger.kernel.org, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH 16/29] fsdax: simplify the offset check in dax_iomap_zero Date: Tue, 9 Nov 2021 09:32:56 +0100 Message-Id: <20211109083309.584081-17-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211109083309.584081-1-hch@lst.de> References: <20211109083309.584081-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The file relative offset must have the same alignment as the storage offset, so use that and get rid of the call to iomap_sector. Signed-off-by: Christoph Hellwig --- fs/dax.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 5364549d67a48..d7a923d152240 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -1123,7 +1123,6 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf, s64 dax_iomap_zero(loff_t pos, u64 length, struct iomap *iomap) { - sector_t sector = iomap_sector(iomap, pos & PAGE_MASK); pgoff_t pgoff = dax_iomap_pgoff(iomap, pos); long rc, id; void *kaddr; @@ -1131,8 +1130,7 @@ s64 dax_iomap_zero(loff_t pos, u64 length, struct iomap *iomap) unsigned offset = offset_in_page(pos); unsigned size = min_t(u64, PAGE_SIZE - offset, length); - if (IS_ALIGNED(sector << SECTOR_SHIFT, PAGE_SIZE) && - (size == PAGE_SIZE)) + if (IS_ALIGNED(pos, PAGE_SIZE) && size == PAGE_SIZE) page_aligned = true; id = dax_read_lock(); -- 2.30.2