From patchwork Wed Jan 23 15:35:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10777415 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 F23C01399 for ; Wed, 23 Jan 2019 15:35:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E39A42CA5A for ; Wed, 23 Jan 2019 15:35:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7F1C2CF75; Wed, 23 Jan 2019 15:35:47 +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 8C08C2CA5A for ; Wed, 23 Jan 2019 15:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726095AbfAWPfr (ORCPT ); Wed, 23 Jan 2019 10:35:47 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:38366 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726029AbfAWPfq (ORCPT ); Wed, 23 Jan 2019 10:35:46 -0500 Received: by mail-pl1-f193.google.com with SMTP id e5so1354922plb.5 for ; Wed, 23 Jan 2019 07:35:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/hv74R61uSx6qH8M6q4G3Wff9psoZdekyLR18O4KJGE=; b=OyR2jGy8GKWmCU4KHGs9ZDnW4JkOKPZSVECtlEqqVLpskwoNmGZ8g9WCXURbWPef9B HN8w1TMKgLYOspncHvI+4j2QFhIJBKTI4g22rFy4YrMfOgXzxQR3YjtofRHrgkTq67jy hb6nxQVFuOy4KisNmoDFtt0g9+dEiY5XIAVgE8AL33wXB2gbmhOHcUoF1NQcklylLP+a rI7WIEJqf1PnBk7rEWlzIl+TvhQlAjpPQ0cFUmHVUSgV1VSee11BdmM+7PYMFA59ZXfo VQ+EW4a36f4iqeFoyprExmsf7xjH/nYLdssa4/FkEPo24noigyyeIVcF0YQqlqdhpNyD u1dw== 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=/hv74R61uSx6qH8M6q4G3Wff9psoZdekyLR18O4KJGE=; b=ueRNoUvCxFGrYyyxS5UyNNaqAErIDKZDYqRgnzwVUNnUxAQO0pv/2/EYnhMtdY1h59 d2IZYW/hoZrLr1Brklfhzjws1Wt5d+o1QLngyax7U81fCGj6RBHjepKp5M7KOAl5jAfo jUqPM4qx+4GuEHmbp7fO2DbIk8IXkv/L65yQMC6ts4zrcvmmUiZH8TrUA8hr3WYrIgP+ py+E7MPvLbFpuLtCNElvI074JBwH3v9fHureAaf0PP5BL7jHowpt+jiQfc1NHvpsMxR5 RZ1uPVj2ifpkUHqmfBIztIZ+uHZYYP6CRuW/udUrHSw4KOOVD8L5DLwU5qr9fLUQPk3s gmHA== X-Gm-Message-State: AJcUukd+zPJb9RuVU8pmHQu1zSL3Qbu5idAPy8yNuEdihJUCScDQL+st ZpUY6lMEz+ypIn7TboMrZDRxRB/X/WXAKQ== X-Google-Smtp-Source: ALg8bN45vTPFu/DGOK2VlprkMzuL7BblKMxYBCbWGXK6j1dlQJrUQsTnOZvZ5kaxlTaOFi3tP4ffBQ== X-Received: by 2002:a17:902:b707:: with SMTP id d7mr2535035pls.29.1548257745448; Wed, 23 Jan 2019 07:35:45 -0800 (PST) Received: from x1.localdomain (66.29.188.166.static.utbb.net. [66.29.188.166]) by smtp.gmail.com with ESMTPSA id u8sm30731715pfl.16.2019.01.23.07.35.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 07:35:44 -0800 (PST) From: Jens Axboe To: linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, linux-block@vger.kernel.org Cc: hch@lst.de, jmoyer@redhat.com, avi@scylladb.com, Jens Axboe Subject: [PATCH 02/18] block: wire up block device iopoll method Date: Wed, 23 Jan 2019 08:35:13 -0700 Message-Id: <20190123153536.7081-3-axboe@kernel.dk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190123153536.7081-1-axboe@kernel.dk> References: <20190123153536.7081-1-axboe@kernel.dk> 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: Christoph Hellwig Just call blk_poll on the iocb cookie, we can derive the block device from the inode trivially. Reviewed-by: Johannes Thumshirn Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- fs/block_dev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index 58a4c1217fa8..f18d076a2596 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -293,6 +293,14 @@ struct blkdev_dio { static struct bio_set blkdev_dio_pool; +static int blkdev_iopoll(struct kiocb *kiocb, bool wait) +{ + struct block_device *bdev = I_BDEV(kiocb->ki_filp->f_mapping->host); + struct request_queue *q = bdev_get_queue(bdev); + + return blk_poll(q, READ_ONCE(kiocb->ki_cookie), wait); +} + static void blkdev_bio_end_io(struct bio *bio) { struct blkdev_dio *dio = bio->bi_private; @@ -410,6 +418,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) bio->bi_opf |= REQ_HIPRI; qc = submit_bio(bio); + WRITE_ONCE(iocb->ki_cookie, qc); break; } @@ -2076,6 +2085,7 @@ const struct file_operations def_blk_fops = { .llseek = block_llseek, .read_iter = blkdev_read_iter, .write_iter = blkdev_write_iter, + .iopoll = blkdev_iopoll, .mmap = generic_file_mmap, .fsync = blkdev_fsync, .unlocked_ioctl = block_ioctl,