From mboxrd@z Thu Jan 1 00:00:00 1970 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 32ECEC433FE for ; Tue, 15 Nov 2022 08:49:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BCFE56B0071; Tue, 15 Nov 2022 03:49:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B5A976B0074; Tue, 15 Nov 2022 03:49:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A20636B0073; Tue, 15 Nov 2022 03:49:51 -0500 (EST) 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 8FD6C6B0071 for ; Tue, 15 Nov 2022 03:49:51 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6289E1A0E93 for ; Tue, 15 Nov 2022 08:49:51 +0000 (UTC) X-FDA: 80135053782.26.CC5E985 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf24.hostedemail.com (Postfix) with ESMTP id 11EE3180012 for ; Tue, 15 Nov 2022 08:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=4quw7IrL2ggicq6nUaiGX0HorT2jnQfuo1Q0QObcp9w=; b=cq1qxJs11zncnmQr9v2MlE2FwS liIPj8dsbQ0q41SDtO4Kk5HcjPvuEDkr41JNzT9apIW1SRVFnYfbwwjHYrJvu/XzsoSffy1K6I0ld aahQylZzKOKCzwT0V9gjtzBIQ4jBmdlYddTNgReYaHMvZmxShyxq44uoHZOtPv5OHqITNVx1qmhqL K789YCQ92yAkrpQpQHhX1yPca2qm6P3Xb6n/f5O61vMhPuHzc6FErIaS+p3x2vkmMZZk2698bUdAi fEbVhP7OX3E+UsTA9jI9ZeyEf+DJtC6NvSdFssj2re8ZvXJWPPpydTGLUjk3XO3CFkqAb2BL03cst McLZUchw==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ourdd-0092o2-A2; Tue, 15 Nov 2022 08:49:49 +0000 Date: Tue, 15 Nov 2022 00:49:49 -0800 From: Christoph Hellwig To: Dave Chinner Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 8/9] xfs: use iomap_valid method to detect stale cached iomaps Message-ID: References: <20221115013043.360610-1-david@fromorbit.com> <20221115013043.360610-9-david@fromorbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221115013043.360610-9-david@fromorbit.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668502191; h=from:from: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4quw7IrL2ggicq6nUaiGX0HorT2jnQfuo1Q0QObcp9w=; b=N8x6La5wfVOPEwjv+MUWSBpWu+3JPaCQ5i5J7dVvjUo4TsYTcHvL3ZLABEDYloyGgiAP/+ GNWr80L+wZMjnIM3wLhvkSUvW0PCVGSdo1m2pYwz14ANB36ZO1xB1x8O07yFihrCyY4ghe oopoZwJPTcV4HFGT6HXJnTGtx9EgN/4= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=cq1qxJs1; spf=none (imf24.hostedemail.com: domain of BATV+c84debcf882b373fc39b+7023+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+c84debcf882b373fc39b+7023+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668502191; a=rsa-sha256; cv=none; b=G1ayJ6+ZsqnvEQLhwQB+05+ikUe6xYcvzcxgLDjLKJt0oKLHL4PVUviU2NyLgNCJ96h2w2 9N6A0p3X2NS1og27Z6VXQpWC2A0IXF8CLRZOeupINzvSQKuSDpY/K+6WrJPlFwlD5wmbC7 aeAYMhwsls1chtbMSAjyZ/AwO45yVKs= X-Stat-Signature: xrq488uz9oeqnqi7dd3n8ogtajrc69ya X-Rspamd-Queue-Id: 11EE3180012 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=cq1qxJs1; spf=none (imf24.hostedemail.com: domain of BATV+c84debcf882b373fc39b+7023+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+c84debcf882b373fc39b+7023+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1668502190-17028 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: On Tue, Nov 15, 2022 at 12:30:42PM +1100, Dave Chinner wrote: > +/* > + * Check that the iomap passed to us is still valid for the given offset and > + * length. > + */ > +static bool > +xfs_iomap_valid( > + struct inode *inode, > + const struct iomap *iomap) > +{ > + struct xfs_inode *ip = XFS_I(inode); > + u64 cookie = 0; > + > + if (iomap->flags & IOMAP_F_XATTR) { > + cookie = READ_ONCE(ip->i_af.if_seq); > + } else { > + if ((iomap->flags & IOMAP_F_SHARED) && ip->i_cowfp) > + cookie = (u64)READ_ONCE(ip->i_cowfp->if_seq) << 32; > + cookie |= READ_ONCE(ip->i_df.if_seq); > + } > + return cookie == iomap->validity_cookie; How can this be called with IOMAP_F_XATTR set? Also the code seems to duplicate xfs_iomap_inode_sequence, so we just call that: return cookie == xfs_iomap_inode_sequence(XFS_I(inode), iomap->flags);