From patchwork Mon Feb 13 15:33:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13138597 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 D82A4C6379F for ; Mon, 13 Feb 2023 15:33:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 675A36B0078; Mon, 13 Feb 2023 10:33:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 627BE6B007D; Mon, 13 Feb 2023 10:33:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C8466B007E; Mon, 13 Feb 2023 10:33:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 34A436B0078 for ; Mon, 13 Feb 2023 10:33:26 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0714D120532 for ; Mon, 13 Feb 2023 15:33:26 +0000 (UTC) X-FDA: 80462662812.25.2B6D7B1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 5703540022 for ; Mon, 13 Feb 2023 15:33:24 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EoZ4+zo9; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676302404; 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=ca8UTnSiTWSXh2fx1ERwdofqvmrxJyibt1lDFh9GbX/INvv1iXU7UfqaXr7CSqmJK94zcp +YKZ4jHbYMEj8sSkzOS2Ed6GwHUs+qbbaUcYQSdZH8ymxBgh1IBMQLqwZb/Z1AoroPyGfv +IyrY4UnicvjnaTMApGpXSdOlvNaTQw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EoZ4+zo9; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676302404; a=rsa-sha256; cv=none; b=XrZNJK3lsT8PCPs9IG21ip+hPoa0utyBvMdr9GTBvybGTLhnHYrJcjKiSrqCVmrw0/E+bw W8tUhT5l7rsJo/1EMA5rCQPudUFghk5NBphi79jM/TI6B+nyg//hA50JZ9acGUBl+3fsZb x2GjAfyy2naXDoc8P4lz5bzFme5LXj8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676302403; 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=EoZ4+zo9eJbbHbmh7cOYqBY15uCH//mg80tA1UsDa2VJo76jZvkIjSW/BwT+ZRDgFGK9J+ I3XQoSf0k/NdNaWDKdEMeVz0UEj0sRhji2G+ePR2ksVD5mvntEY8WeLURGMhomuSTtSLpn WUNLalUoiMgJJLreQnvcBZbDJit/yKg= 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-325-ffjTGi4LPyGsidvz5tnMXw-1; Mon, 13 Feb 2023 10:33:15 -0500 X-MC-Unique: ffjTGi4LPyGsidvz5tnMXw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 590D43C14851; Mon, 13 Feb 2023 15:33:14 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53FA22026D4B; Mon, 13 Feb 2023 15:33:12 +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 v2 3/4] splice: Use init_sync_kiocb() in filemap_splice_read() Date: Mon, 13 Feb 2023 15:33:00 +0000 Message-Id: <20230213153301.2338806-4-dhowells@redhat.com> In-Reply-To: <20230213153301.2338806-1-dhowells@redhat.com> References: <20230213153301.2338806-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5703540022 X-Stat-Signature: 91bt6pq99o1um8otk9z3y8ezsea1ubb9 X-HE-Tag: 1676302404-416203 X-HE-Meta: U2FsdGVkX1+GEfX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N/bTQWKAlVKd+c+hTQg3LSedzPoq1Hn/rA8Yr/HccZiuJ93AkmY7Nj5g8GtrQtmjCKKpko8THDs+YDb2YhEsoh710RZb56gLiNNQ6ou67KYNyaaUkx2Cp0M6zDdv6dYByTVn5VzaLNtsHHwcB3YMkTjcBXYZtCkZqJNv1Gz9BoulamoYQTWFRUc7YXiHmeD88cwmVnOsrsQGuyWk2j0zYmA9BtEkcByqjD/PznHP0yFIvMOGsGgXKNoJ+Yz1VF60z08kv36XLOm65YU12tjTzv7ik46hJT/vIhEAPUAvgg2MVLZUkREMCiMEt/zSXNIKYwD6OBRqFpg2Xhbyibz11BERiDuVbYLUt4IA2J3Lr0VI6XmWnQKx0rFJZjFPHkr6EWH8+7g7XOs+7233aO5WgjnQmg== 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 Reviewed-by: David Hildenbrand --- 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);