From patchwork Tue Aug 28 00:03:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10577681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 196D31803 for ; Tue, 28 Aug 2018 00:03:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1317329DA9 for ; Tue, 28 Aug 2018 00:03:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 077BC29DAD; Tue, 28 Aug 2018 00:03:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9684C29DD4 for ; Tue, 28 Aug 2018 00:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727367AbeH1Dw2 (ORCPT ); Mon, 27 Aug 2018 23:52:28 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40796 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727318AbeH1Dw2 (ORCPT ); Mon, 27 Aug 2018 23:52:28 -0400 Received: by mail-pf1-f195.google.com with SMTP id s13-v6so326142pfi.7 for ; Mon, 27 Aug 2018 17:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ES1vZ3SxfCEh3K8LHqL9bXNZgMbp8rxL5IuBUGW4t/g=; b=AAuojD1djFD7TyPDaLo6bNbJyqnp10pHr3EWlpknvv77Yf+ylCelhucfnMl7oG90nD eFHEcuvYYSpT1dqnTshnKlGt22IYbV1ijxrKyIPmk5PLRtPK7zF52d5WZiauB3rrPRvS jbYfVYBJCPEky2biR64WenCCwiXo1tUx/i+qM4GqaGEzpiqMldus7h+uY8xiY9Z9Ogwa upso7EW9kEcfsZeN6TSlMPIgU6y1n2n9Y2whyQfJwCt4WdHAaJPaxXVwI2zUUbcFnZcZ 3tZRiz6GDyP9vPEBqOVUL9DR29ONzyecR6YsiUbtEzCqeHK4ir768wSCUpxYxopuXK+K tufg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ES1vZ3SxfCEh3K8LHqL9bXNZgMbp8rxL5IuBUGW4t/g=; b=BLQk6KwchNIXdcBWvhcZYRlWG3q7hvNBFkWiH8/8AxfCaO/ziumlMcBfTyNwIGvoFR xBM7Ucqsnk6F7Ev5jAHOys127tyR/ACEIs3eWwNIbikdf5TRCc/B2LVKo6tDHqHXxpun XxoTUXnqLyGNy8RhWw5LpRPUUlOIAeMuCmeXIAXXkO2YqhUCwAspI2/BEKYwIGJQByUN SAWeU6/9vhS5gZxOnP3SfVJHI0VlgKs8agBnMa4oWamzZO1T4Xf6ADle3gZshcRNABJt hqw6gXp4OGho82LxKwaBE7tWyrlAzFq2qsecPt+qfjrDVuKnlrveovIBV078xtV8+SyW w+SA== X-Gm-Message-State: APzg51DQD67NExavgzmlBTlUbJ2VV9ODNaju2owjVqopHFAJYCHiGYFl c35HhKmYFEEIr9Zgb4bmYwYXTXaWWdw= X-Google-Smtp-Source: ANB0Vdam5g4z+6L1JorRDEFWY+M4HwjVlgquLa1MQnurb6+9k+CS2WFD7WlgUTF4PhQYWVX5GKAnbA== X-Received: by 2002:a63:4b46:: with SMTP id k6-v6mr13865679pgl.351.1535414613381; Mon, 27 Aug 2018 17:03:33 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::7:5f0c]) by smtp.gmail.com with ESMTPSA id z22-v6sm455315pgc.67.2018.08.27.17.03.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 17:03:32 -0700 (PDT) From: Omar Sandoval To: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, Al Viro Cc: David Sterba , kernel-team@fb.com Subject: [RFC PATCH v2 4/6] fs: stop propagating bh->b_private for direct I/O Date: Mon, 27 Aug 2018 17:03:17 -0700 Message-Id: <711728042a285870799943d3431cd3f3783b585c.1535414064.git.osandov@fb.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval Currently, the direct I/O code saves the value of bh->b_private set by the filesystem and passes it to the end_io callback. However, struct kiocb already has a ->private member which can be used for this purpose, with the added benefit of being available before get_block is called, too. The only users of the bh->b_private functionality have been converted to use iocb->private, so stop passing it around. Signed-off-by: Omar Sandoval --- fs/direct-io.c | 7 +------ fs/ext4/inode.c | 3 +-- fs/ocfs2/aops.c | 5 +---- include/linux/fs.h | 3 +-- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/fs/direct-io.c b/fs/direct-io.c index f631aa98849b..80e488afe6c6 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -122,8 +122,6 @@ struct dio { loff_t i_size; /* i_size when submitted */ dio_iodone_t *end_io; /* IO completion function */ - void *private; /* copy from map_bh.b_private */ - /* BIO completion state */ spinlock_t bio_lock; /* protects BIO fields below */ int page_errors; /* errno from get_user_pages() */ @@ -288,7 +286,7 @@ static ssize_t dio_complete(struct dio *dio, ssize_t ret, unsigned int flags) if (dio->end_io) { // XXX: ki_pos?? - err = dio->end_io(dio->iocb, offset, ret, dio->private); + err = dio->end_io(dio->iocb, offset, ret); if (err) ret = err; } @@ -716,9 +714,6 @@ static int get_more_blocks(struct dio *dio, struct dio_submit *sdio, ret = (*sdio->get_block)(dio->iocb, dio->inode, fs_startblk, map_bh, create); - /* Store for completion */ - dio->private = map_bh->b_private; - if (ret == 0 && buffer_defer_completion(map_bh)) ret = dio_set_defer_completion(dio); } diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 841d79919cef..0f42793765bf 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3612,8 +3612,7 @@ const struct iomap_ops ext4_iomap_ops = { .iomap_end = ext4_iomap_end, }; -static int ext4_end_io_dio(struct kiocb *iocb, loff_t offset, - ssize_t size, void *private) +static int ext4_end_io_dio(struct kiocb *iocb, loff_t offset, ssize_t size) { ext4_io_end_t *io_end = iocb->private; diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index fc4a18b6ad3c..c1232df20be5 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c @@ -2404,10 +2404,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode, * particularly interested in the aio/dio case. We use the rw_lock DLM lock * to protect io on one node from truncation on another. */ -static int ocfs2_dio_end_io(struct kiocb *iocb, - loff_t offset, - ssize_t bytes, - void *private) +static int ocfs2_dio_end_io(struct kiocb *iocb, loff_t offset, ssize_t bytes) { struct ocfs2_dio_write_ctxt *dwc; struct inode *inode = file_inode(iocb->ki_filp); diff --git a/include/linux/fs.h b/include/linux/fs.h index 85db69835023..f1a235f0fa21 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -83,8 +83,7 @@ typedef int (get_block_t)(struct inode *inode, sector_t iblock, typedef int (dio_get_block_t)(struct kiocb *iocb, struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create); -typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, - ssize_t bytes, void *private); +typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, ssize_t bytes); #define MAY_EXEC 0x00000001 #define MAY_WRITE 0x00000002