From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=213.95.11.211 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796113054; b=3zJVgBvbKPCmakpuDzSFmZC7y2dT8iUjOveeu8Kg7kubx3VRInZWEdMTKagTYiuGqeWP QAupPKbu0xM43Hfq8hW5A8ZEYAX1I7DIBudCgwrc091A47hs1LjgZJwPeW52I/r0pSVOk eNjwNHu96mnnulxhJd5CPIgYPcwhP3VjOpHeP812GChbAVjMKtMo8pN3JlaqC4bHC/3/y v+3Ll+ZqLikNg4Pj1971qiYM/WMIsFHxWshXCFmSjxpnZnHeez3LDYiOOSy0LTu6PfZXw UjJxY9nKXN9eLWx+XEaB570+jfa/ecs3YJ0TGUdagQ+IN9zGmSZgisZOeMDZNhX6vBQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796113054; h=DMARC-Filter:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; bh=c6UCrEMrlnv2T0N7GmvC3UGtkMUti9UjHxGZ+sAl2EA=; b=x52FnyvyJZ3p/48KbdSkJL8rYNavs3GFmg1V0mqvxvvSvrF3H6GNfZLG6lFb2JigfIoC cdX8d+GI9SDzzN3uovcCOPnS8zpc3QqE7IzbFVAQHS1LhAFQhjYarwgyAmV9oBZy4T+U6 8s2i4AGc8XkW5piW6qFYf251fhv++HcFLfu/Q1H3CcMrbuBTlUvQcC0TIuZEZ7VIE04Gq ZfO8KtahqWGB/LjwTlTvHOO+FnbHkx+bC7/vppILZ+hm9rg1tUILXNBZYcoHcIfqWVxOv m6alowQNQrQiwHmt7XiDz4cYqtFE9kmhOq0LU1CILKO8MjqxBLr7EEeOkyB4ppRH6/A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.remote-ip=213.95.11.211 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCC99606A683; Tue, 1 Dec 2026 08:17:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DCC99606A683 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id A402668BFE; Tue, 1 Dec 2026 09:17:28 +0100 (CET) Date: Tue, 1 Dec 2026 09:17:28 +0100 From: Christoph Hellwig To: daejun7.park@samsung.com Cc: Chuck Lever , Jeff Layton , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Christoph Hellwig , Carlos Maiolino , Amir Goldstein , "Darrick J. Wong" , Dave Chinner , Sergey Bashirov , Christian Brauner , linux-nfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] xfs: factor the mapping of one pNFS extent out of xfs_fs_map_blocks() Message-ID: <20261201081728.GB26856@lst.de> References: <20261126-xfs-nfsd-map-blocks-v2-0-6d85b1388739@samsung.com> <20261126-xfs-nfsd-map-blocks-v2-1-6d85b1388739@samsung.com> X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261126-xfs-nfsd-map-blocks-v2-1-6d85b1388739@samsung.com> User-Agent: Mutt/1.5.17 (2007-11-01) > + * can change in between, so a mapping that reaches back can overlap > + * one already in the layout. Don't extend the mapping past EOF > + * beyond the range either: xfs_free_eofblocks() can free blocks past > + * EOF without breaking the layout. > + */ > + error = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb, > + imap, &nimaps, XFS_BMAPI_ENTIRE); > + if (error) { > + xfs_iunlock(ip, lock_flags); > + return error; > + } > + if (nimaps) > + xfs_trim_extent(imap, offset_fsb, > + max_t(xfs_fileoff_t, end_fsb, > + XFS_B_TO_FSB(mp, XFS_ISIZE(ip))) - > + offset_fsb); nimaps must be non-NULL here (I should have spotted that in your original patch adding the check). > + *seq = xfs_iomap_inode_sequence(ip, 0); > + > + ASSERT(!nimaps || imap->br_startblock != DELAYSTARTBLOCK); Or the very original addition. IIRC we used to have a corner case where 0 nimaps with a 0 return value could happen, but we fied that a long time ago. > + > + if (!write || (nimaps && imap->br_startblock != HOLESTARTBLOCK)) { > + xfs_iunlock(ip, lock_flags); > + return 0; > + } > + > + if (end > XFS_ISIZE(ip)) > + end_fsb = xfs_iomap_eof_align_last_fsb(ip, end_fsb); > + else if (nimaps) > + end_fsb = min(end_fsb, imap->br_startoff + imap->br_blockcount); > + xfs_iunlock(ip, lock_flags); > + > + error = xfs_iomap_write_direct(ip, offset_fsb, end_fsb - offset_fsb, 0, > + imap, seq); > + if (error) > + return error; > + *update_inode = true; Maybe keep the original flow here that leaves the alloction is the more exceptional path in the branch? > + error = xfs_fs_map_extent(ip, XFS_B_TO_FSBT(mp, offset), > + offset + length, write, &imap, &seq, &update_inode); Passing the offset as FSB and the end as bytes is a bit odd. I'll see if there is a good reason for that in the next patch, but in doubt we should avoid this if possible.