Message ID | 166722777223.2555743.162508599131141451.stgit@warthog.procyon.org.uk |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2357250wru; Mon, 31 Oct 2022 07:52:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rz1K2NGvEy5l28oBu1mPmMPatORca0L1YciJA9GCzSIRY7B1se1MNqpwHwal8VWZ7GPUG X-Received: by 2002:a05:6402:3988:b0:44e:6f08:ddfb with SMTP id fk8-20020a056402398800b0044e6f08ddfbmr13654882edb.89.1667227940771; Mon, 31 Oct 2022 07:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667227940; cv=none; d=google.com; s=arc-20160816; b=rtCRf6Acjjm15Rmkxln5Fim1pQc/8Row59PKEWQvaUJBrj9t+MeXXCDwTBBTXgnuxc MyIKZCtACW9K2d/0FJPHDR584Y5ljLgPnKrx/CTFtBDbwHMNz1lmJ+1FZkR0AthK73GO 239I/NTwdJbuW0BXMjGW7LwdY0PlCxHGGu56xNVCpDVmSYG6CsBNR8FgoSld6I0yhXmh 1ZXxYiVAWWeauujNKTiN9jM0XuNXQrVBsScun8AyaJnjK5oUa1aA6iRtzZoKN1v4AoMq AGtWetc8O7uYLPkeBEBJW8yE04RjUX4wAomrNtA7dVGoPJvuvMXzoDv+HuO81miI91uA L4HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:dkim-signature; bh=23/Ctdek4ocKr3zevsCvoojIOyWc1W2ha5J7gbSO9ns=; b=Y7UrEhbkmXw/olNl5SqRp66wE5kPC+uGkDthWxMr46O3inOUv86K7hnvLow9Uyxayw QYXU+HLqCTToOdF/KVMd2dF4duOZLKPWfLDE3HW1w+RTqqO0Bc5nFXPQwTjRfdG1EnnY p5rkSVJT6XKaU5SnX/v8BDITAAcgKxI7jj5n4pjwr+2HaKOQhA7KTVCqBDVSp5F/OaAD EDy4KZQGtarEGM36siU1xNKrUknVJ/1jMIww3hsp1Ls8huT1Qy8i9nmJV68i2JlBRPdU yE9EzAAd6uM46ElesP1nBskehY99aAqIa37Rn9u2AlwigaY+BQ3dsTgS6DlZZ9vmuIzv 3Uzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CXT4JpVF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a50eb06000000b00461c0cb486asi7549582edp.311.2022.10.31.07.51.56; Mon, 31 Oct 2022 07:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CXT4JpVF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231524AbiJaOui (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Mon, 31 Oct 2022 10:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230462AbiJaOuh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 31 Oct 2022 10:50:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3991810FF0 for <linux-kernel@vger.kernel.org>; Mon, 31 Oct 2022 07:49:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667227780; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=23/Ctdek4ocKr3zevsCvoojIOyWc1W2ha5J7gbSO9ns=; b=CXT4JpVFEKH7RJHePg1Dz2WMyyTJT8q+BGThWX831B9eRGPB91k9O6bfCj0cdNrwt6Dcbj GrDaoFYzSVk73m7UmL3UrHMB695G2BnHBl38tiZUivm67J8pB09S+95vQdz0Lj5p4bZNTQ 9l+bxbbP2fVD6OvwJivII2j7LyxupnM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-563-Dv51oDBhOISZEQG849O3jw-1; Mon, 31 Oct 2022 10:49:35 -0400 X-MC-Unique: Dv51oDBhOISZEQG849O3jw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 87BA1811E7A; Mon, 31 Oct 2022 14:49:34 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D4D0140EBF5; Mon, 31 Oct 2022 14:49:33 +0000 (UTC) Subject: [RFC PATCH 0/2] iov_iter: Provide a function to extract/pin/get pages from an iteraor From: David Howells <dhowells@redhat.com> To: viro@zeniv.linux.org.uk Cc: linux-mm@vger.kernel.org, John Hubbard <jhubbard@nvidia.com>, linux-fsdevel@vger.kernel.org, Christoph Hellwig <hch@lst.de>, Matthew Wilcox <willy@infradead.org>, dhowells@redhat.com, smfrench@gmail.com, torvalds@linux-foundation.org, linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 31 Oct 2022 14:49:32 +0000 Message-ID: <166722777223.2555743.162508599131141451.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748215205098003105?= X-GMAIL-MSGID: =?utf-8?q?1748215205098003105?= |
Series |
iov_iter: Provide a function to extract/pin/get pages from an iteraor
|
|
Message
David Howells
Oct. 31, 2022, 2:49 p.m. UTC
Hi Al, Here's a patch to provide a function to extract a list of pages from an iterator, getting pins of refs on them as appropriate. I added a macro by which you can query an iterator to find out how the extraction function will treat the pages (it returns 0, FOLL_GET or FOLL_PIN as appropriate). Note that it's a macro to avoid #inclusion of linux/mm.h in linux/uio.h. I've added another crude, incomplete patch to make cifs use it a bit as an example. Note that cifs won't work properly with this under all circumstances, particularly if it decides to split the rdata or wdata record - but it seems to work for small I/Os. David --- David Howells (2): iov_iter: Add a function to extract a page list from an iterator cifs: Test use of iov_iter_extract_pages() and iov_iter_extract_mode() fs/cifs/cifsglob.h | 2 + fs/cifs/file.c | 93 +++++++++---- include/linux/uio.h | 26 ++++ lib/iov_iter.c | 333 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 427 insertions(+), 27 deletions(-)
Comments
On Mon, Oct 31, 2022 at 02:49:32PM +0000, David Howells wrote: > I added a macro by which you can query an iterator to find out how the > extraction function will treat the pages (it returns 0, FOLL_GET or FOLL_PIN > as appropriate). Note that it's a macro to avoid #inclusion of linux/mm.h in > linux/uio.h. I'd support moving FOLL_* definitions to mm_types.h along with FAULT_FLAG_* and VM_FAULT_*.
On 10/31/22 07:52, Matthew Wilcox wrote: > On Mon, Oct 31, 2022 at 02:49:32PM +0000, David Howells wrote: >> I added a macro by which you can query an iterator to find out how the >> extraction function will treat the pages (it returns 0, FOLL_GET or FOLL_PIN >> as appropriate). Note that it's a macro to avoid #inclusion of linux/mm.h in >> linux/uio.h. > > I'd support moving FOLL_* definitions to mm_types.h along with > FAULT_FLAG_* and VM_FAULT_*. +1, great idea. The use of FOLL_* without including it's .h directly was the first thing that jumped out at me when I just started looking at this. And these really are mm types, so yes. thanks,