From patchwork Tue Aug 28 00:03:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10577677 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 2AB5E1805 for ; Tue, 28 Aug 2018 00:03:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2360729DE1 for ; Tue, 28 Aug 2018 00:03:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16D4329DE3; Tue, 28 Aug 2018 00:03:42 +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=ham 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 32BA029DC5 for ; Tue, 28 Aug 2018 00:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727389AbeH1Dw3 (ORCPT ); Mon, 27 Aug 2018 23:52:29 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:41440 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727206AbeH1Dw3 (ORCPT ); Mon, 27 Aug 2018 23:52:29 -0400 Received: by mail-pl1-f193.google.com with SMTP id b12-v6so311257plr.8 for ; Mon, 27 Aug 2018 17:03:35 -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=htnXvlfY3aukwWbuxjlA51Cx7hekSzTvkWCuHfh0Dac=; b=ltxmg8QDkN37676QwOLpyBp/6a2mIs4q/q1ZUmDD0dADwN3Vvk0ZAuy3szLl2skBhA R3ELkr1IR6laqnc5ZNhHD0Pot/hupjzvbwq73lm2Te1/TEYgbknrNLMGafQsZ1V1XxLe sjrzUhEq1Pbn7dKYbbVbT1HWFYBto528ay1l++V5rGRLMLi+uH4gsFGTonV0k4RGtVIv 9ksRRJf+lk8uqZCF6h4DCTjxAilL3WqS0FBvpmv9KNy+Dy2knp7VGcjOwub906NNZxwS EKDZfxabUZ1cRbX/a33pAAzxTSK+5qN2IvHexRpTvKHN856KII9QD1/hVnfViWiQaYau tISg== 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=htnXvlfY3aukwWbuxjlA51Cx7hekSzTvkWCuHfh0Dac=; b=GcWvr3CACCYncemBmbJmkhqua9y23WPLxzWvJpn4VELNkCYBDHJPLW/+DLss4azG8y 64rrJSsi6xZIP+qm7WbvJbD6P1QNUBRiQWrx5ZyBLNKSFBJhAwbACg4pGyphZo4dEbp7 lKijVwyjLZAUFfj90Sxd9xNXP6xGhc2tW5rJMFHlwRIJskJyUOCOy6Y4lbzUIaiEQ9fo xQhN5GwCnooKFOb25UuNDUfhO56SdCMavBAZ/rC6N25fjghQroIS5V9X+3AcoxSNlK7W K5fxe/8s05jGrA2SB++eq5wXHQ3Pz22bMLN5M0U3A7GmPss12IVeIYTFdwGqwJEsJK/O ysQw== X-Gm-Message-State: APzg51DvcdEiKJxCT4QnIyj0cyzkfj2SMXFDNDK0UF4W7LMiFoQyTTHX znTnz++5pZXTF3dwPzmmxHMsQKoQUZw= X-Google-Smtp-Source: ANB0VdaQjMyDBjY5AtWMl33U5Az+NhE+WyrrJtghB03JsnUqxoQiA0rx4uvJIVGUlQFagpZjDLX53A== X-Received: by 2002:a17:902:28c7:: with SMTP id f65-v6mr14900309plb.240.1535414614489; Mon, 27 Aug 2018 17:03:34 -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.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 17:03:33 -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 5/6] fs: pass iocb to direct I/O submit_io() Date: Mon, 27 Aug 2018 17:03:18 -0700 Message-Id: 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 Btrfs abuses current->journal_info in btrfs_direct_IO() in order to pass around some state to get_block() and submit_io(). However, iocb->private is free for Btrfs to use, we just need it passed to submit_io(). Btrfs is the only user of submit_io(), so this doesn't affect any other filesystems. Signed-off-by: Omar Sandoval --- fs/btrfs/inode.c | 4 ++-- fs/direct-io.c | 3 ++- include/linux/fs.h | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b61ea6dd9956..6efa6a6e3e20 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8427,8 +8427,8 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip) return 0; } -static void btrfs_submit_direct(struct bio *dio_bio, struct inode *inode, - loff_t file_offset) +static void btrfs_submit_direct(struct kiocb *iocb, struct bio *dio_bio, + struct inode *inode, loff_t file_offset) { struct btrfs_dio_private *dip = NULL; struct bio *bio = NULL; diff --git a/fs/direct-io.c b/fs/direct-io.c index 80e488afe6c6..aa367e70456d 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -473,7 +473,8 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio) dio->bio_disk = bio->bi_disk; if (sdio->submit_io) { - sdio->submit_io(bio, dio->inode, sdio->logical_offset_in_bio); + sdio->submit_io(dio->iocb, bio, dio->inode, + sdio->logical_offset_in_bio); dio->bio_cookie = BLK_QC_T_NONE; } else dio->bio_cookie = submit_bio(bio); diff --git a/include/linux/fs.h b/include/linux/fs.h index f1a235f0fa21..daf1df811f67 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3003,8 +3003,8 @@ extern int generic_file_open(struct inode * inode, struct file * filp); extern int nonseekable_open(struct inode * inode, struct file * filp); #ifdef CONFIG_BLOCK -typedef void (dio_submit_t)(struct bio *bio, struct inode *inode, - loff_t file_offset); +typedef void (dio_submit_t)(struct kiocb *iocb, struct bio *bio, + struct inode *inode, loff_t file_offset); enum { /* need locking between buffered and direct access */