Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1313958rdb; Mon, 19 Feb 2024 10:57:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWKPIM5r8tQNWketRYVbuUDRjvdPdOki64Y1Lyq3c3zRZITTKYQSKYH8WdMTJU2qhLADnjX+eYlYDfbXby/EGEYQDwtTFL65QRmdwiJZQ== X-Google-Smtp-Source: AGHT+IGGOkK7jxZl9GAef+EZoUsbW8ye3C6ZBJni9Z/HsgfvtBaaXrMTw7cejEN7dCowdQDAE6Ul X-Received: by 2002:a17:902:f693:b0:1db:eb13:b625 with SMTP id l19-20020a170902f69300b001dbeb13b625mr5078959plg.3.1708369069990; Mon, 19 Feb 2024 10:57:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708369069; cv=pass; d=google.com; s=arc-20160816; b=dK0lKnwMblHpR2MTHUNt9Tc4gwLPVc8PyuXwBVYyE/FvRIuV1p2hXf/uZhsZvNxOyx oA2CzKOuTBJymFHiUTppf7zDNUZYy9lhg1KzFKoH//rYia5XZHkG7sYHbFafBKe3lFo9 0IaRLCfdJnBLkIiHUEcZHx33bM/Lglwah9naLLHi8oMhACGt333qIhCVifuviIUNn4iW eutFTWhZ1xFqdHv70eL/PtrA4xCdXqswDAh1PRdPM6h0rTkXNRzzAeWtOdRhwFJL7RUc /yLaXK4eqmY6r7eHXGLBchMi12vgH62PkQhGJyzIo/tNEwKAYVD9PwGZfNz+qzZphuay HcBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MfOS2FHgx7cQdMCJWPyLcoKyeYGdzcj+CLOLLLLFzRk=; fh=SRr6913gH9jRvLVA7Ptd0kRA9D23buURych6Wg68MR0=; b=x0Xwm8CXwfkubknlX+7jYjljKpVpj412HX0SawldQvorv3cuxUn4Sf8hYY9/GDDbJ+ ylzN37s4zFeh2KkOr0lZw+O7PGSgAr8jlh5DfamN8LyyabCztwT/aoWxB10MSILzC0cx SxA2cX0aSgrHuSZzGCEVoI6h9pGzOkB+uLsGGs/DZfFEV4cbfFOwxSDoKUQwwoiCi5ql Vs9fHCOeqA4vZZnHwqbcksBGAdfFNAQpwuZuJfslsGalWx91fjgSZIOHkcTKDTwAyZ0d OEp67u6KGEvh/N683kmvyPemMe0LhaKI+7eijk9h0qvWbH0kOHIAyephQXz/ETcp73Px WBLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VYGRxYfH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71843-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71843-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b15-20020a170902d50f00b001db7062086dsi4803626plg.484.2024.02.19.10.57.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 10:57:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71843-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VYGRxYfH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71843-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71843-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id ADB95284247 for ; Mon, 19 Feb 2024 18:57:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1F57148CD2; Mon, 19 Feb 2024 18:57:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VYGRxYfH" 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 1EA3834545; Mon, 19 Feb 2024 18:57:29 +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=1708369049; cv=none; b=F2RVb0otCh515nReQFVRrQlgY1Z0y57CXXF6ZJr8ymE27m4JOwqJQBXfs9C0efR/oorEswpJuOqblS/CNAZ1QdMwC4J4KWfoRY4usPhaG7VyBRf8LYFtiuLRMXF5v2qxFBVf8954tTj0tpSWNGFAygxp6NxBcix2dojlngwJPI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708369049; c=relaxed/simple; bh=hlzNv0HneAFcj8iXq6Qfn9/TqgvN+CXJ8vpN0bhvzuQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nI307I8DUhRdk9swHm2JS3NQCntB+m3Un7NZCW8D/e0hZbxS4pPGvTDFoEYNd8rxvZZgpV7WyXAF1UtNxpkqx7J5ONmGEDBHbjGNHQJFjn5gL7vD+G0/s2X7lZjCmTUZjfoinZlEoN1Ftc+LwAp164ee+nnOHzItJ0auH43KrzQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VYGRxYfH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77D1EC433C7; Mon, 19 Feb 2024 18:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708369049; bh=hlzNv0HneAFcj8iXq6Qfn9/TqgvN+CXJ8vpN0bhvzuQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VYGRxYfHz+G5gsqE/kZ4an8+k6ihso+suEPttoEPqHlHRsbjJ/rGY14ni7lhoobG7 x+RoZnTABT4BQwrVYlT9CDUxYlvONcW+6VGDuq6Rr76NAUgnuMMosQhFmbVcChmM3L phR4ndzdjB31okSWC7FD7Qd/49kwDaGyasfOFFjkVslnlcmLOFy3HlMtn6gGJMtkmL h4z5S2vA+7TQDbiY7i3IQZAYMeFkhAdA8aGt6RGmGurZtO7kovYuEKhtXLuNt8XWYV w+Ocv832w1rwRR6AMOuIPW9Dz71gwFlL+G9dCYWCrYOGLqbkUqj//z7JztyDntVXE6 vQ70wA0mNgV2Q== Date: Mon, 19 Feb 2024 11:57:25 -0700 From: Keith Busch To: John Garry Cc: axboe@kernel.dk, hch@lst.de, sagi@grimberg.me, jejb@linux.ibm.com, martin.petersen@oracle.com, djwong@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, dchinner@redhat.com, jack@suse.cz, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, jbongio@google.com, linux-scsi@vger.kernel.org, ojaswin@linux.ibm.com, linux-aio@kvack.org, linux-btrfs@vger.kernel.org, io-uring@vger.kernel.org, nilay@linux.ibm.com, ritesh.list@gmail.com Subject: Re: [PATCH v4 02/11] block: Call blkdev_dio_unaligned() from blkdev_direct_IO() Message-ID: References: <20240219130109.341523-1-john.g.garry@oracle.com> <20240219130109.341523-3-john.g.garry@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20240219130109.341523-3-john.g.garry@oracle.com> On Mon, Feb 19, 2024 at 01:01:00PM +0000, John Garry wrote: > @@ -53,9 +53,6 @@ static ssize_t __blkdev_direct_IO_simple(struct kiocb *iocb, > struct bio bio; > ssize_t ret; > > - if (blkdev_dio_unaligned(bdev, pos, iter)) > - return -EINVAL; > - > if (nr_pages <= DIO_INLINE_BIO_VECS) > vecs = inline_vecs; > else { > @@ -171,9 +168,6 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, > loff_t pos = iocb->ki_pos; > int ret = 0; > > - if (blkdev_dio_unaligned(bdev, pos, iter)) > - return -EINVAL; > - > if (iocb->ki_flags & IOCB_ALLOC_CACHE) > opf |= REQ_ALLOC_CACHE; > bio = bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL, > @@ -310,9 +304,6 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, > loff_t pos = iocb->ki_pos; > int ret = 0; > > - if (blkdev_dio_unaligned(bdev, pos, iter)) > - return -EINVAL; > - > if (iocb->ki_flags & IOCB_ALLOC_CACHE) > opf |= REQ_ALLOC_CACHE; > bio = bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL, > @@ -365,11 +356,16 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, > > static ssize_t blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter) > { > + struct block_device *bdev = I_BDEV(iocb->ki_filp->f_mapping->host); > + loff_t pos = iocb->ki_pos; > unsigned int nr_pages; All three of the changed functions also want 'bdev' and 'pos', so maybe pass on the savings to them? Unless you think the extended argument list would harm readibilty, or perhaps the compiler optimizes the 2nd access out anyway. Either way, this looks good to me. Reviewed-by: Keith Busch