From patchwork Mon Apr 30 16:57:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Manzanares X-Patchwork-Id: 10372135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A7C826038F for ; Mon, 30 Apr 2018 16:58:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9690B223C7 for ; Mon, 30 Apr 2018 16:58:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 877E12853C; Mon, 30 Apr 2018 16:58:41 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 1D3E9223C7 for ; Mon, 30 Apr 2018 16:58:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755115AbeD3Q57 (ORCPT ); Mon, 30 Apr 2018 12:57:59 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:20729 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755102AbeD3Q56 (ORCPT ); Mon, 30 Apr 2018 12:57:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1525107683; x=1556643683; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=m8SxWnk6c99ThL8PmFdq7NnPTh8PykOjDb3RspSTvZ4=; b=J48tvXpP8U6c7d+t3SVtKWV/SXn1vlPHS0OCTvsAjNa/S6CM0FwkE9yU hzqQqAvGJfO/jJN24gJKbgQ12LBNUw6y+h/R1tjdkUyHnc0iFJV3gkhnM 20aG1Wdt6guADtoYaqZ75tcTeX5GdXwLX4gtNZySZ5f2Skg2fze0C80Xi vFa59bIL/mF8gj/0t9UNdSMylrweupbseuTxTThMQvREXBzMYjooVKjyD 39Xu1MD1ZxYeCz9h2vwOfrzTwU1PB5kgbUrBvY5DH/3BP1+bRv2VhkGsc waJiepsrKDlcak5ViZ8dG9mBN4HCRZMWwImcBSDlfErg2txliJqElO+gx g==; X-IronPort-AV: E=Sophos;i="5.49,346,1520870400"; d="scan'208";a="173714669" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 01 May 2018 01:01:22 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 30 Apr 2018 09:49:18 -0700 Received: from penguito-adamm.sdcorp.global.sandisk.com ([10.11.47.13]) by uls-op-cesaip02.wdc.com with ESMTP; 30 Apr 2018 09:57:58 -0700 From: adam.manzanares@wdc.com To: viro@zeniv.linux.org.uk, bcrl@kvack.org Cc: linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, linux-abi-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Adam Manzanares Subject: [PATCH 1/2] fs: add RWF_IOPRIO Date: Mon, 30 Apr 2018 09:57:39 -0700 Message-Id: <20180430165740.2842-2-adam.manzanares@wdc.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180430165740.2842-1-adam.manzanares@wdc.com> References: <20180430165740.2842-1-adam.manzanares@wdc.com> 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: Adam Manzanares This is the per-I/O equivalent of the ioprio_set system call. When the RWF_IOPRIO flag is set then the aio_reqprio field of the iocb is interpreted as an I/O scheduling class and priority. Signed-off-by: Adam Manzanares --- include/linux/fs.h | 4 ++++ include/uapi/linux/fs.h | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 760d8da1b6c7..32614eb72a4a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -292,6 +292,7 @@ enum rw_hint { #define IOCB_SYNC (1 << 5) #define IOCB_WRITE (1 << 6) #define IOCB_NOWAIT (1 << 7) +#define IOCB_IOPRIO (1 << 8) struct kiocb { struct file *ki_filp; @@ -300,6 +301,7 @@ struct kiocb { void *private; int ki_flags; enum rw_hint ki_hint; + u16 ki_ioprio; /* See linux/ioprio.h */ } __randomize_layout; static inline bool is_sync_kiocb(struct kiocb *kiocb) @@ -3243,6 +3245,8 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags) ki->ki_flags |= (IOCB_DSYNC | IOCB_SYNC); if (flags & RWF_APPEND) ki->ki_flags |= IOCB_APPEND; + if (flags & RWF_IOPRIO) + ki->ki_flags |= IOCB_IOPRIO; return 0; } diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index d2a8313fabd7..c8f69a00b566 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -380,8 +380,11 @@ typedef int __bitwise __kernel_rwf_t; /* per-IO O_APPEND */ #define RWF_APPEND ((__force __kernel_rwf_t)0x00000010) +/* per-IO IOPRIO */ +#define RWF_IOPRIO ((__force __kernel_rwf_t)0x00000020) + /* mask of flags supported by the kernel */ #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\ - RWF_APPEND) + RWF_APPEND | RWF_IOPRIO) #endif /* _UAPI_LINUX_FS_H */