Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1666919lqp; Mon, 15 Apr 2024 13:12:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV8Dzg93rbu2SYLckvLg3MQce6/g6MwMnKaVJfuTd2WhQ1TAIv/iYOPPH9vtOF2x6mYmYcBilToMwW+q8L89hU52zuQ9z/uwuYXmNihww== X-Google-Smtp-Source: AGHT+IFcm8aUiejHJVGNVIoLvWJZQAEYiyG2boLwkTe1U27+cgGUs0GGfVW+uNogGlJdpvt5ulJ3 X-Received: by 2002:a05:6214:11aa:b0:699:23f8:1044 with SMTP id u10-20020a05621411aa00b0069923f81044mr10970719qvv.11.1713211943560; Mon, 15 Apr 2024 13:12:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713211943; cv=pass; d=google.com; s=arc-20160816; b=vtyVGJ4S4C2x0BUnehJFEb47bAmkwGDh3MGbknwaxY125hOvuY/Vd+5y9m/3IwyYK0 aDZaLZ1GRCzbPAMxVzgyLH7gXWYXIfmeJWpoabal5cYG9PTdvw2yoMYLnR+KobhREHwT znWeYS9qxzyeoWl5IH1CR4hGy+yExSnelVu9riYJDehMpGFAJpz//i1WflPYqBGTq3CV 5612FuHKvyjiKSUCEZaGwXK8cfUL+Sr6pqTNXvlmagr88li6+68sdZ9gdaNuoyMLFs5r tK5IihFpHoHvGbtcmOFcQrqt49l7SjyqYeH5l/5G+MYA1o0V9ugnvtX+LssqctBRkC/0 ojyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=L289PLVicNTtrl0nY8oRaDJ2XMnR0nkCspScxglzmU4=; fh=y9c1EQHB2+CpidlMiDIasitSN09CkGKNPOkGCHzmnLM=; b=pppssisOaDVNZQrDIDd5gtTzxNjKTa7LSLk3YXyBQIBu0rUUYitZPimD7zj+777oVb LXM343NjmQ3TfVz8LQgvG7B9PDW226o4NK7mtcOsoS9wNcf+xCY/9zdFas7i3MOUwx0i o+Ke0zh/089a8BgZ18vaqOMCXciLcjXBVmV0l3yoPZBeGHTVa158wBw2nNF19sQ4iZ3k f4xy+cEvcDYrrdPKaGQbDvd791rJdZkH9JyxsHGf4rRDBY3Pd7HzCwK1H1eArsLOZSiY NsCtCwQBeFcX4NkbweuemT3TNXZCOmxxlJiZi33I6aVi37mYLDb8JFG8JzpbOacDkfUB VsLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=nDtiKEuf; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-145865-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145865-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id n7-20020a0ce487000000b0069b4f640ea5si10401769qvl.24.2024.04.15.13.12.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 13:12:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145865-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=nDtiKEuf; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-145865-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145865-linux.lists.archive=gmail.com@vger.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 252971C20F8E for ; Mon, 15 Apr 2024 20:12:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04B2F15667B; Mon, 15 Apr 2024 20:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="nDtiKEuf" Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2A5D811E7 for ; Mon, 15 Apr 2024 20:11:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713211922; cv=none; b=Y95FbtVq/0pYRugrbfF5J3Q0Osv8uIMHdt1JsKUwRZMTBIxl0zksDDt1B+12TyDHg5KzOYa/svkdfMjr9pVXITo6FXdF/Qpr90i9NcHbFYkynPeJlDc3v9my6IsMvX2sPLG5B3Kle1AkBjul/lJZRXIBF4DAvhdvu6gbL5T62/8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713211922; c=relaxed/simple; bh=LPqppHb1O7p7E9X/dU+VV0dAGADt1nStLitMbvldbZg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=j+NDaM5+1vWEWtq3QiaZZ2pQDBIwyni4/d4P51rx0BRMIa3JkEqAAqlpnzxydoSZbiFYOGTWNvw6815TQCNJM3Ysp62rm5zkieColJKm612H3ppJPoS4cMXQQohmsHpOTfrAM2Yq+nEro+7CrdkpuchZlV0VNFJxs+k1+EU7R9Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=nDtiKEuf; arc=none smtp.client-ip=209.85.166.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Received: by mail-io1-f43.google.com with SMTP id ca18e2360f4ac-7d6812b37a6so10816139f.0 for ; Mon, 15 Apr 2024 13:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1713211918; x=1713816718; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=L289PLVicNTtrl0nY8oRaDJ2XMnR0nkCspScxglzmU4=; b=nDtiKEuf+DLyOwnK0eI03VItXPymRHbVIqbKDQDPofjSfTUcxbmyfVIGc1Df/5COWQ Cr8gsA/H22tbnR93VLOX2bE4SRQfoYpSnnj5cPkGlclFhgiaDGr1ed44ZLb/dx5ThmKh hL61ttrHS7t4n9zV7tWU83tz5iaL2Tg2ke5QYTg2ldFbi9u/DZi+242sMtrMrO1lO32r lFrbjaGLnbqQ5rjEKC0tcRcyc/7qW1bB8qdCcP7YVNm9ekwvG36c5oIjDuyYf73NnGFW Pm9DE10sC+Q68G36/wyNrKv9CqSV+Fjn0/IgmK6G4LDL7sslxisSgFw2I2Bqf54ZWyAP TBHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713211918; x=1713816718; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=L289PLVicNTtrl0nY8oRaDJ2XMnR0nkCspScxglzmU4=; b=whFIG8tbHET12ABndnGXOT1V9BZTomjH2tMONqnroJreWakNG2vH75RdKXuJDgBl1Q rslWYrESCiRj40sWtDIy1XCjnmdfV3WW9yXSmu5A++N6ebtaqHqwfByZrAMu9erRxKdd MzYVfehMpdURLk5zILeDXO8ldnOJdAwsqSwOwD+y4Sye9ZUtGMpPB9RGqMGSdwR5kZii hQj44CocujpN25njqXA4ppd8VoJ2fBhVSclQOuJmI/Wp8Dg2O7b/xcEadE8NUZEcwE9N cythHgO0myqiuePCy1SF+usIKRvTofsaodbJ2XIDDBEO7U0VN/zaTftLjJfhl/WQaqpu f7kA== X-Gm-Message-State: AOJu0Yy6s7uWoh4LUXk7yXI2CIpDPMj02R3Bod21jqGuLmxbwkMbkMmD yDLC+f2C/AhYB/PLdHetP7DIlCpMsLlveqh1h7GJUCgt30IhChiwQqElXF+FKeFZyMXWiredyc/ 0 X-Received: by 2002:a6b:c848:0:b0:7d9:9523:513f with SMTP id y69-20020a6bc848000000b007d99523513fmr2705945iof.1.1713211917947; Mon, 15 Apr 2024 13:11:57 -0700 (PDT) Received: from [192.168.1.116] ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id x11-20020a056638248b00b00482b484af1asm3328920jat.67.2024.04.15.13.11.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Apr 2024 13:11:57 -0700 (PDT) Message-ID: <898afc09-428f-4da2-a620-d7ca9f37133c@kernel.dk> Date: Mon, 15 Apr 2024 14:11:56 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 002/437] fs: add generic read/write iterator helpers Content-Language: en-US To: Al Viro Cc: linux-kernel@vger.kernel.org References: <20240411153126.16201-1-axboe@kernel.dk> <20240411153126.16201-3-axboe@kernel.dk> <20240415195504.GU2118490@ZenIV> From: Jens Axboe In-Reply-To: <20240415195504.GU2118490@ZenIV> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/15/24 1:55 PM, Al Viro wrote: > On Thu, Apr 11, 2024 at 09:12:22AM -0600, Jens Axboe wrote: > >> +/* generic read side helper for drivers converting to ->read_iter() */ >> +ssize_t vfs_read_iter(struct kiocb *iocb, struct iov_iter *to, >> + ssize_t (*read)(struct file *, char __user *, >> + size_t, loff_t *)) >> +{ >> + return do_loop_readv(iocb->ki_filp, to, &iocb->ki_pos, 0, read); >> +} >> +EXPORT_SYMBOL(vfs_read_iter); >> + >> +/* generic write side helper for drivers converting to ->write_iter() */ >> +ssize_t vfs_write_iter(struct kiocb *iocb, struct iov_iter *from, >> + ssize_t (*write)(struct file *, const char __user *, >> + size_t, loff_t *)) >> +{ >> + return do_loop_writev(iocb->ki_filp, from, &iocb->ki_pos, 0, write); >> +} >> +EXPORT_SYMBOL(vfs_write_iter); > > Wait a minute; just what do you expect to happen if that ever gets called > for ITER_BVEC or ITER_XARRAY? do_loop_{readv,writev} need to look like the one io_uring had, which was just an augmented version of the fs/ version. At least for handling anything that is IOVEC/UBUF/BVEC. Outside of that, should not be callable for eg ITER_XARRAY, who would do that? We should probably add a check at the top of each just to vet the iter type and -EINVAL if it's not one of the supported ones. With a WARN_ON_ONCE(), I suspect. I'll be posting the first patches separately again, I've made some local tweaks, with some drivers that can support it as-is. Just haven't gotten around to doing this weeks iteration on it yet. -- Jens Axboe