Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp12927pxb; Wed, 6 Apr 2022 20:07:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxERBCO/enAJN8lMTlreOMYNHP8QImrEt30NMwUuPSIjvZoCd3aryg8/Cu6n4uQ5RB+YWaG X-Received: by 2002:a17:902:f64d:b0:151:3895:46bf with SMTP id m13-20020a170902f64d00b00151389546bfmr11894310plg.31.1649300876252; Wed, 06 Apr 2022 20:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649300876; cv=none; d=google.com; s=arc-20160816; b=qp37DJHaU2yS9HqeNIpvQ3cri+aFFQRGZlI2reOoWTkR1y0uJk5lglVVZJ16BJlPf2 2TEUFWgiiqhiLgcWTcgaefO7rAqrYHanFGBkHgcnlfUeY05Pu0VeBFYYe2Ut7B2khi09 JluwC5Gx6gXsYjIMMKi1kF0oWUfXUIIqsNRAANozafj1ZqB0pEOYuxSWZr8YCfO0s/ox OdnW+Ejgp3yAlqzmi2fZ7pJhfJw8ezpPBrqPaLp++8li2PPPS9x0EaIeClO14juZvVT5 foi4JihlRPmJ+0tOl9DvD29UcQ/KFBr8KI7+XHGLwtC/80KUzO0vuKYi2pmYY8Oo+HC8 BKAw== 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:references:in-reply-to:message-id:date:cc:to:from :subject:organization:dkim-signature; bh=OkQROJZ9xFEDjhFgCoOAdsvXUZoPyUf8F0k5ysSvSEo=; b=Ldlc1I0oqJSrDZCensbzv9XUs92ac9C9LN3tf2YDGCvR9v6RghiyvLPbsf5pa59MMM OvniFtOi7USEMw3S9t4T+piMXY71Y+N6cfH4QnCc+jkIzmDHZilk8aLsfA+EluN1xLA7 tMKPCA9tECKa9RaXU9r9MfVey413QokubUeMMYrHyd7J023PNzwFYxQDHMw0tkSUb6f/ zvtgWyDQFrpa0iA68Scthm2vCnt8YiKwFKwyHSJXO7mIPcQz3gNILTaiCxfxOL1UlqPR H8gin/fCRXECgUVz3Tll9TCWsfJ/XX+3QJY3pncXqx6Xqihwf5bXycMx/YSdvJousrSd t0Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e7nmWFFt; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k135-20020a633d8d000000b00385fcbf9b16si16915708pga.533.2022.04.06.20.07.40; Wed, 06 Apr 2022 20:07:56 -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=e7nmWFFt; 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 S237577AbiDFXFZ (ORCPT + 99 others); Wed, 6 Apr 2022 19:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237540AbiDFXFR (ORCPT ); Wed, 6 Apr 2022 19:05:17 -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 ESMTP id E197314A6FC for ; Wed, 6 Apr 2022 16:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649286193; 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: in-reply-to:in-reply-to:references:references; bh=OkQROJZ9xFEDjhFgCoOAdsvXUZoPyUf8F0k5ysSvSEo=; b=e7nmWFFtItCxtz2oJmva1zDfADxbq9MPoyKAIU94xLg2L9UMOsUDOy6D/Sw+l9XgJ7ew1S a1Op/p4ulhR6AFuCW9HM3U1KjWsa/ai6tx3ZLHzTSQkjYFLE7VjesSTwuscGg8dEnEKzHc 0TLkxzm8iaoIcCv4Kg5VCXl3Bv5FM10= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-365-kqmGcfx0ONC_B7F1jw4NGg-1; Wed, 06 Apr 2022 19:03:09 -0400 X-MC-Unique: kqmGcfx0ONC_B7F1jw4NGg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C69E3804098; Wed, 6 Apr 2022 23:03:09 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.37.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id D80297AE5; Wed, 6 Apr 2022 23:03:00 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 02/14] cifs: Add a function to read into an iter from a socket From: David Howells To: linux-cachefs@redhat.com Cc: Steve French , Shyam Prasad N , Rohith Surabattula , linux-cifs@vger.kernel.org, dhowells@redhat.com, Steve French , Shyam Prasad N , Rohith Surabattula , Jeff Layton , linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Date: Thu, 07 Apr 2022 00:02:58 +0100 Message-ID: <164928617874.457102.10021662143234315566.stgit@warthog.procyon.org.uk> In-Reply-To: <164928615045.457102.10607899252434268982.stgit@warthog.procyon.org.uk> References: <164928615045.457102.10607899252434268982.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: David Howells cc: Steve French cc: Shyam Prasad N cc: Rohith Surabattula cc: linux-cifs@vger.kernel.org --- fs/cifs/cifsproto.h | 3 +++ fs/cifs/connect.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 0df3b24a0bf4..dd4931308ea6 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -245,6 +245,9 @@ extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, unsigned int page_offset, unsigned int to_read); extern int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb); +extern int cifs_read_iter_from_socket(struct TCP_Server_Info *server, + struct iov_iter *iter, + unsigned int to_read); extern int cifs_match_super(struct super_block *, void *); extern int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx); extern void cifs_umount(struct cifs_sb_info *); diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index ee3b7c15e884..080e19e9ee47 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -754,6 +754,22 @@ cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page, return cifs_readv_from_socket(server, &smb_msg); } +int +cifs_read_iter_from_socket(struct TCP_Server_Info *server, struct iov_iter *iter, + unsigned int to_read) +{ + struct msghdr smb_msg; + int ret; + + smb_msg.msg_iter = *iter; + if (smb_msg.msg_iter.count > to_read) + smb_msg.msg_iter.count = to_read; + ret = cifs_readv_from_socket(server, &smb_msg); + if (ret > 0) + iov_iter_advance(iter, ret); + return ret; +} + static bool is_smb_response(struct TCP_Server_Info *server, unsigned char type) {