From patchwork Thu Feb 27 21:12:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410123 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF86617E0 for ; Thu, 27 Feb 2020 21:30:50 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D846F20801 for ; Thu, 27 Feb 2020 21:30:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D846F20801 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 89153348F9E; Thu, 27 Feb 2020 13:26:14 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 4466821FE60 for ; Thu, 27 Feb 2020 13:19:45 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id A69EC8A2F; Thu, 27 Feb 2020 16:18:16 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id A4AC646D; Thu, 27 Feb 2020 16:18:16 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:12:31 -0500 Message-Id: <1582838290-17243-284-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 283/622] lustre: uapi: fix file heat support X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Andreas Dilger Change the LL_IOC_HEAT_SET ioctl number assignment to reduce the number of different values used, since we are running out. Use a __u64 as the IOC struct argument instead of a "long" since that is what is actually passed, and it avoids being CPU-dependent. Move the LU_HEAT_FLAG_* values into an enum to avoid a generic "flags" argument in the code. This makes it clear what is passed. Clean up code style for lfs_heat_get() and lfs_heat_set(). Fixes: 868c66dca13f ("lustre: llite: add file heat support") WC-bug-id: https://jira.whamcloud.com/browse/LU-10602 Lustre-commit: ac1f97a88101 ("LU-10602 utils: fix file heat support") Signed-off-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/34757 Reviewed-by: Wang Shilong Reviewed-by: Alex Zhuravlev Reviewed-by: Yingjin Qian Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/file.c | 2 +- include/uapi/linux/lustre/lustre_user.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c index 76d3b4c..e9d0ff9 100644 --- a/fs/lustre/llite/file.c +++ b/fs/lustre/llite/file.c @@ -3193,7 +3193,7 @@ static void ll_heat_get(struct inode *inode, struct lu_heat *heat) spin_unlock(&lli->lli_heat_lock); } -static int ll_heat_set(struct inode *inode, u64 flags) +static int ll_heat_set(struct inode *inode, enum lu_heat_flag flags) { struct ll_inode_info *lli = ll_i2info(inode); int rc = 0; diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h index 03ec680..d52879e 100644 --- a/include/uapi/linux/lustre/lustre_user.h +++ b/include/uapi/linux/lustre/lustre_user.h @@ -354,7 +354,7 @@ struct ll_ioc_lease_id { #define LL_IOC_GETPARENT _IOWR('f', 249, struct getparent) #define LL_IOC_LADVISE _IOR('f', 250, struct llapi_lu_ladvise) #define LL_IOC_HEAT_GET _IOWR('f', 251, struct lu_heat) -#define LL_IOC_HEAT_SET _IOW('f', 252, long) +#define LL_IOC_HEAT_SET _IOW('f', 251, __u64) #define LL_STATFS_LMV 1 #define LL_STATFS_LOV 2 @@ -2010,8 +2010,10 @@ enum lu_heat_flag_bit { LU_HEAT_FLAG_BIT_CLEAR, }; -#define LU_HEAT_FLAG_CLEAR (1 << LU_HEAT_FLAG_BIT_CLEAR) -#define LU_HEAT_FLAG_OFF (1 << LU_HEAT_FLAG_BIT_OFF) +enum lu_heat_flag { + LU_HEAT_FLAG_OFF = 1ULL << LU_HEAT_FLAG_BIT_OFF, + LU_HEAT_FLAG_CLEAR = 1ULL << LU_HEAT_FLAG_BIT_CLEAR, +}; enum obd_heat_type { OBD_HEAT_READSAMPLE = 0,