From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Axboe Subject: [PATCH 01/18] fs: add an iopoll method to struct file_operations Date: Wed, 30 Jan 2019 14:55:23 -0700 Message-ID: <20190130215540.20871-2-axboe@kernel.dk> References: <20190130215540.20871-1-axboe@kernel.dk> Return-path: In-Reply-To: <20190130215540.20871-1-axboe@kernel.dk> Sender: owner-linux-aio@kvack.org To: linux-aio@kvack.org, linux-block@vger.kernel.org, linux-api@vger.kernel.org Cc: hch@lst.de, jmoyer@redhat.com, avi@scylladb.com, jannh@google.com, Jens Axboe List-Id: linux-api@vger.kernel.org From: Christoph Hellwig This new methods is used to explicitly poll for I/O completion for an iocb. It must be called for any iocb submitted asynchronously (that is with a non-null ki_complete) which has the IOCB_HIPRI flag set. The method is assisted by a new ki_cookie field in struct iocb to store the polling cookie. Reviewed-by: Johannes Thumshirn Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- Documentation/filesystems/vfs.txt | 3 +++ include/linux/fs.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 8dc8e9c2913f..761c6fd24a53 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt @@ -857,6 +857,7 @@ struct file_operations { ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); ssize_t (*read_iter) (struct kiocb *, struct iov_iter *); ssize_t (*write_iter) (struct kiocb *, struct iov_iter *); + int (*iopoll)(struct kiocb *kiocb, bool spin); int (*iterate) (struct file *, struct dir_context *); int (*iterate_shared) (struct file *, struct dir_context *); __poll_t (*poll) (struct file *, struct poll_table_struct *); @@ -902,6 +903,8 @@ otherwise noted. write_iter: possibly asynchronous write with iov_iter as source + iopoll: called when aio wants to poll for completions on HIPRI iocbs + iterate: called when the VFS needs to read the directory contents iterate_shared: called when the VFS needs to read the directory contents diff --git a/include/linux/fs.h b/include/linux/fs.h index 811c77743dad..ccb0b7a63aa5 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -310,6 +310,7 @@ struct kiocb { int ki_flags; u16 ki_hint; u16 ki_ioprio; /* See linux/ioprio.h */ + unsigned int ki_cookie; /* for ->iopoll */ } __randomize_layout; static inline bool is_sync_kiocb(struct kiocb *kiocb) @@ -1786,6 +1787,7 @@ struct file_operations { ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); ssize_t (*read_iter) (struct kiocb *, struct iov_iter *); ssize_t (*write_iter) (struct kiocb *, struct iov_iter *); + int (*iopoll)(struct kiocb *kiocb, bool spin); int (*iterate) (struct file *, struct dir_context *); int (*iterate_shared) (struct file *, struct dir_context *); __poll_t (*poll) (struct file *, struct poll_table_struct *); -- 2.17.1 -- To unsubscribe, send a message with 'unsubscribe linux-aio' in the body to majordomo@kvack.org. For more info on Linux AIO, see: http://www.kvack.org/aio/ Don't email: aart@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 623B0C282D7 for ; Wed, 30 Jan 2019 23:46:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B8562086C for ; Wed, 30 Jan 2019 23:46:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="O3PHY/li" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725780AbfA3XqP (ORCPT ); Wed, 30 Jan 2019 18:46:15 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:51003 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbfA3XqP (ORCPT ); Wed, 30 Jan 2019 18:46:15 -0500 Received: by mail-it1-f193.google.com with SMTP id z7so1159910iti.0 for ; Wed, 30 Jan 2019 15:46:14 -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=FY7i8A/t+ar+CVDsIpMVwrTPPHLhDb6dZzvnPNdG5Kc=; b=O3PHY/lijoi3P1ZKipncXgt0bhrW+slSxeEEVrSU1H1YJCmDbK5xXXtSdTOmN5Hl/K f2EJbzufXeLyVrx9k0+U/TALUhvk9raPXN0/kkWvK/3x4jaWG0g8EnfOHk4JuTky0MwY /6BJhxzSwAbWpdnNqdz7F7PRFXCcOS10ahbEMeQphUTe5O4AtvExSJqFIWGoaNYczsDF Vwss3ormhe/01mzya2iJElqSA4IcV8OuL4rQF4dIfTvZW225vbCnipJeSA8qGDtH7x9g VNNoDglCbc/+BnHU9jE8CvzFc1DXtcb/QY/SjtlIqchhBcWs/oUYpp0HGPjmgOt/0yr4 V0tQ== 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=FY7i8A/t+ar+CVDsIpMVwrTPPHLhDb6dZzvnPNdG5Kc=; b=SMjlVE4f10Jftj6Ojrd8BdJDcK9FvR2c3vwuL395joIUh9hKHJkc25NyP0HOHNWWeo XYnd3qJC2F68V3iW+fjqC+APySKRJrsMTrh0gt9TCS91+Lt9kLW0Q0ejix9VWtLej/1g OoKoGGBuYV05zcWhv6YvLPiVwmCa2taRQ19yCIcSXCSNruo6JoRX5YmsmdembMO8kqk+ UyxQHu6EfdB4qFV4hZ5XWqbjQISjZDQy+FP/54pIISOXVT4fS68g31DICbPAO0yEDZY3 PqhA8NeIm9ilojb8g51iwVKwHB1czJzRbKuCrIQy2N/Xc28cqZYgJVzV8PnAuh327kzR OZ4A== X-Gm-Message-State: AHQUAubBWPUXgZD+HJv0z0LRXXRTQ4ZkV5JYpCeHfZ5W7xmqbPCQyv4d Nrn62g3ISYyIeaY5LB1ZzFP9i9SvbuQ= X-Google-Smtp-Source: AHgI3IaVlGcRxnvn0V5oMou9W3nzZ4TyaTdjlIK+nqiLZhBm8Klu8SaDNPgb46Rg5yk48gohdbujhw== X-Received: by 2002:a24:13c2:: with SMTP id 185mr11677441itz.104.1548885346412; Wed, 30 Jan 2019 13:55:46 -0800 (PST) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id 189sm1805081itw.33.2019.01.30.13.55.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jan 2019 13:55:45 -0800 (PST) From: Jens Axboe To: linux-aio@kvack.org, linux-block@vger.kernel.org, linux-api@vger.kernel.org Cc: hch@lst.de, jmoyer@redhat.com, avi@scylladb.com, jannh@google.com, Jens Axboe Subject: [PATCH 01/18] fs: add an iopoll method to struct file_operations Date: Wed, 30 Jan 2019 14:55:23 -0700 Message-Id: <20190130215540.20871-2-axboe@kernel.dk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130215540.20871-1-axboe@kernel.dk> References: <20190130215540.20871-1-axboe@kernel.dk> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Christoph Hellwig This new methods is used to explicitly poll for I/O completion for an iocb. It must be called for any iocb submitted asynchronously (that is with a non-null ki_complete) which has the IOCB_HIPRI flag set. The method is assisted by a new ki_cookie field in struct iocb to store the polling cookie. Reviewed-by: Johannes Thumshirn Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- Documentation/filesystems/vfs.txt | 3 +++ include/linux/fs.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 8dc8e9c2913f..761c6fd24a53 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt @@ -857,6 +857,7 @@ struct file_operations { ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); ssize_t (*read_iter) (struct kiocb *, struct iov_iter *); ssize_t (*write_iter) (struct kiocb *, struct iov_iter *); + int (*iopoll)(struct kiocb *kiocb, bool spin); int (*iterate) (struct file *, struct dir_context *); int (*iterate_shared) (struct file *, struct dir_context *); __poll_t (*poll) (struct file *, struct poll_table_struct *); @@ -902,6 +903,8 @@ otherwise noted. write_iter: possibly asynchronous write with iov_iter as source + iopoll: called when aio wants to poll for completions on HIPRI iocbs + iterate: called when the VFS needs to read the directory contents iterate_shared: called when the VFS needs to read the directory contents diff --git a/include/linux/fs.h b/include/linux/fs.h index 811c77743dad..ccb0b7a63aa5 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -310,6 +310,7 @@ struct kiocb { int ki_flags; u16 ki_hint; u16 ki_ioprio; /* See linux/ioprio.h */ + unsigned int ki_cookie; /* for ->iopoll */ } __randomize_layout; static inline bool is_sync_kiocb(struct kiocb *kiocb) @@ -1786,6 +1787,7 @@ struct file_operations { ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); ssize_t (*read_iter) (struct kiocb *, struct iov_iter *); ssize_t (*write_iter) (struct kiocb *, struct iov_iter *); + int (*iopoll)(struct kiocb *kiocb, bool spin); int (*iterate) (struct file *, struct dir_context *); int (*iterate_shared) (struct file *, struct dir_context *); __poll_t (*poll) (struct file *, struct poll_table_struct *); -- 2.17.1