From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9AF626F2BB for ; Mon, 3 Nov 2025 21:13:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762204415; cv=none; b=gq//ruEzVEkJ+Qv7BbQPswPDXpVJ01nAEtr6jUVJnuCE8fWf0DdVcOQS6Y3dC12RcahwKYm0gEZ+Y6XDZdQCk4T64dd8QB3NGwwbHTpmdhsf30VWZ41sjGyrCtHLVDTbfFiGSC3vxYF3c9cK1QnkSiUtWLQ0+aM7VL0bq8cIRvo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762204415; c=relaxed/simple; bh=JFcSsP0JEGjOCCZiS/jF1Rgu7ExRXC8jg8Wqm3UJMaM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tkohNV0j4P5MSOOUL+vQTY6rk5EkHmo6mwBWxvelwEzLsbM5kR51Zr9VZ4fkn19uRH2+WzcH52E3GvY3kaKqau5Ah3kOl9NThlAhvEZH4h/+LcRX0zN7vapDdPRpzmHhBWaAJqHJMJDBRXQ32lLJ6J0Dl7ZK6b8Ukw/LbArG0Ac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LokHeuZF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LokHeuZF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B811C4CEF8; Mon, 3 Nov 2025 21:13:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762204415; bh=JFcSsP0JEGjOCCZiS/jF1Rgu7ExRXC8jg8Wqm3UJMaM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LokHeuZF6SVOiA4v1G8lMp76tmbcgxoJz7Xd+FaK3MBgJfvx2KTA1e7NqYXqwoHT7 S7q3TZjRk/864ba0yT+ddgkJnUPg0i3+m/xVRyDYXRUQig592oLtcvKm+G1V4wCN+O 4qr9cgeXplnHH3KE0GezTzuG9iy4xGWFaHIus/m89NYYRBzl3oVpdGoYTIDjl28pWy UA8pzLD8WpkT2pCMh7WyrcLjEqp3TnxByStJHX2SwKEpqqtosKbonYHhclVS7IcysT RhU5VKNrRfDpARLWq28WbY52CewB3YTuEdvoLJrBMdLrMvQZC7+JV7L9ZJh7g4+wj/ efxaHqebcDItg== Date: Mon, 3 Nov 2025 16:13:33 -0500 From: Mike Snitzer To: Chuck Lever Cc: NeilBrown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey , linux-nfs@vger.kernel.org, Chuck Lever Subject: Re: [PATCH v9 08/12] NFSD: Simplify nfsd_iov_iter_aligned_bvec() Message-ID: References: <20251103165351.10261-1-cel@kernel.org> <20251103165351.10261-9-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251103165351.10261-9-cel@kernel.org> On Mon, Nov 03, 2025 at 11:53:47AM -0500, Chuck Lever wrote: > From: Chuck Lever > > Pages in the RPC receive buffer are contiguous. Practically > speaking, this means that, after the first bvec, the bv_offset > field is always zero. > > The loop in nfsd_iov_iter_aligned_bvec() also sets "skip" to zero > after the first bvec is checked. Thus, for bvecs following the first > one, bv_offset = 0 and skip = 0, and the check becomes: > > (0 + 0) & addr_mask = 0 > > This always passes regardless of the alignment mask. > > Since all bvecs after the first one start at bv_offset zero (page- > aligned), they are inherently aligned for DIO. Therefore, only the > first bvec needs to be checked for DIO alignment. > > Note that for RDMA transports, the incoming payload always starts on > page alignment, since svcrdma sets up the RDMA Read sink buffers > that way. For RDMA, this loop visits every bvec in each payload, and > never finds an unaligned bvec. > > Reviewed-by: Jeff Layton > Signed-off-by: Chuck Lever Very welcome improvement! Reviewed-by: Mike Snitzer