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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA2C9C433FE for ; Tue, 15 Nov 2022 08:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236993AbiKOIt7 (ORCPT ); Tue, 15 Nov 2022 03:49:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237119AbiKOItx (ORCPT ); Tue, 15 Nov 2022 03:49:53 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA71820BDC; Tue, 15 Nov 2022 00:49:50 -0800 (PST) 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 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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);