From patchwork Tue Feb 14 08:37:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13139674 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 667F6C05027 for ; Tue, 14 Feb 2023 08:37:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01EE06B0075; Tue, 14 Feb 2023 03:37:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F1149280003; Tue, 14 Feb 2023 03:37:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD961280002; Tue, 14 Feb 2023 03:37:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CC7046B0075 for ; Tue, 14 Feb 2023 03:37:34 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 901511A0D95 for ; Tue, 14 Feb 2023 08:37:34 +0000 (UTC) X-FDA: 80465243628.24.ADDEB68 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id D0649180002 for ; Tue, 14 Feb 2023 08:37:32 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gIAH3LiN; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676363852; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xJXt4KNNFIdMvSSPmBpCRCAi8g0JFMLHorMyvAgfics=; b=aCrBtErhXgkfzhk5GPnASQAIV1n0aQXt9iFpk7NdwvBs/bTLboHGbqV+BYRnSRQErEU4lB 5XoSVG85zy1KKP7gCv87XM8RZtGnsGJpbUpcY/piXz0MFlNiJL4375nSkJB2vipFPoWh4c 5FCfXP2How205Xu6sFXwxGNXACJcPBM= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gIAH3LiN; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676363852; a=rsa-sha256; cv=none; b=R4itzD3Y5w4/Dotur2XdnadKLvHu7tvsfS7h653wkPQBswve8FATFHrZf2Ztjr5xfmwwuT 6qXd65TzjhqeWbrEbyNoUjJfd9FuEvMBdoOexLb+FpDx8xZuI+id/hAG5U7yklw70SObbB VlpCsRGLhuwQT90+AG+lf8X6oL44bq0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676363852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xJXt4KNNFIdMvSSPmBpCRCAi8g0JFMLHorMyvAgfics=; b=gIAH3LiNKLVWbWoHrDW/yTd2ncPan6UF/YqqXlD6xnh+d+Z4sCZ3ZUHOgr+dCwRdi6dRKI clXPvg+2orcE9vI9x11UiC2mWfMkZvlEjJQkht7QRpi1/HfWuDOV/uSIaZJXEGRRotlIBZ DBHV0U1xqjr8PvoyjZwGm3AA59g/dW4= 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-647-4m-qRrFTP7OlNbKg3ZIAJA-1; Tue, 14 Feb 2023 03:37:28 -0500 X-MC-Unique: 4m-qRrFTP7OlNbKg3ZIAJA-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 14FC72999B22; Tue, 14 Feb 2023 08:37:28 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2717F140EBF6; Tue, 14 Feb 2023 08:37:26 +0000 (UTC) From: David Howells To: Jens Axboe , Al Viro , Christoph Hellwig Cc: David Howells , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , John Hubbard Subject: [PATCH v3 3/5] splice: Use init_sync_kiocb() in filemap_splice_read() Date: Tue, 14 Feb 2023 08:37:08 +0000 Message-Id: <20230214083710.2547248-4-dhowells@redhat.com> In-Reply-To: <20230214083710.2547248-1-dhowells@redhat.com> References: <20230214083710.2547248-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D0649180002 X-Stat-Signature: 39ok58xymuoof9wxx7npd4z8g76ca715 X-HE-Tag: 1676363852-366553 X-HE-Meta: U2FsdGVkX1+8n6vXZH3fqTvy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Po+xEJzBzZEHbL7u7anjkIScOqc+Wf1L8DRtNrPIzs8tY5nVVg93GnlvGMFHARFl14DNJMGpW9Edi8sNwdXWpf2eLX+CjeQBSUdEYv6UeiNY/xhAEQZMgpNA1/n8siHNK2wGMAzjjVZtSayUo2oB/f8cC/qm2sK2p9rsxJNNu47cjX2QqYIH/risFUCyAsX3qC3XbG3kN1NNPbGybMFMMu2nEjq7MQPCZsl0Q4zI4pK8ZxliU1V6q7vcYhU6P86fcLse7KUv02UoCLDiJLS6c0frKUl628OlBPfCZIhh8qXATwPvU4c0BTWUKWQMOH+UMPFiOiz6LjDFu2koC8bFG7Q+jUxJvnj12rk2t3yde328w2t0KHc5/reFRFbfJ9sg55PKc68EPaJ5g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use init_sync_kiocb() in filemap_splice_read() rather than open coding it. Requested-by: Christoph Hellwig Signed-off-by: David Howells cc: Christoph Hellwig cc: Jens Axboe cc: Al Viro cc: John Hubbard cc: David Hildenbrand cc: Matthew Wilcox cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- Notes: ver #2) - Don't attempt to filter IOCB_* flags. fs/splice.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 7c0ff187f87a..4ea63d6a9040 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -419,15 +419,14 @@ static ssize_t filemap_splice_read(struct file *in, loff_t *ppos, size_t len, unsigned int flags) { struct folio_batch fbatch; + struct kiocb iocb; size_t total_spliced = 0, used, npages; loff_t isize, end_offset; bool writably_mapped; int i, error = 0; - struct kiocb iocb = { - .ki_filp = in, - .ki_pos = *ppos, - }; + init_sync_kiocb(&iocb, in); + iocb.ki_pos = *ppos; /* Work out how much data we can actually add into the pipe */ used = pipe_occupancy(pipe->head, pipe->tail);