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:
ae723cf8161f ("LU-10602 llite: add file heat support")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: If06212d2d62d085a2104cf54ae9a10e512eb2efd
Reviewed-on: https://review.whamcloud.com/34757
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Tested-by: Jenkins
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
#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_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)
#ifndef FS_IOC_FSGETXATTR
/*
#ifndef FS_IOC_FSGETXATTR
/*
LU_HEAT_FLAG_BIT_CLEAR,
};
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,
enum obd_heat_type {
OBD_HEAT_READSAMPLE = 0,
spin_unlock(&lli->lli_heat_lock);
}
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;
{
struct ll_inode_info *lli = ll_i2info(inode);
int rc = 0;
static const char *const heat_names[] = LU_HEAT_NAMES;
static int lfs_heat_get(int argc, char **argv)
{
static const char *const heat_names[] = LU_HEAT_NAMES;
static int lfs_heat_get(int argc, char **argv)
{
- struct lu_heat *heat;
- int rc = 0, rc2;
- char *path;
- int fd;
- int i;
+ struct lu_heat *heat;
+ int rc = 0, rc2;
+ char *path;
+ int fd;
+ int i;
if (argc <= 1)
return CMD_HELP;
if (argc <= 1)
return CMD_HELP;
static int lfs_heat_set(int argc, char **argv)
{
static int lfs_heat_set(int argc, char **argv)
{
- struct option long_opts[] = {
- {"clear", no_argument, 0, 'c'},
- {"off", no_argument, 0, 'o'},
- {"on", no_argument, 0, 'O'},
- {0, 0, 0, 0}
- };
- char short_opts[] = "coO";
- int rc = 0, rc2;
- char *path;
- int fd;
- __u64 flags = 0;
- int c;
+ struct option long_opts[] = {
+ { .val = 'c', .name = "clear", .has_arg = no_argument },
+ { .val = 'o', .name = "off", .has_arg = no_argument },
+ { .val = 'O', .name = "on", .has_arg = no_argument },
+ { .name = NULL } };
+ enum lu_heat_flag flags = 0;
+ int rc = 0, rc2;
+ char *path;
+ int fd;
+ int c;
if (argc <= 1)
return CMD_HELP;
optind = 0;
if (argc <= 1)
return CMD_HELP;
optind = 0;
- while ((c = getopt_long(argc, argv, short_opts,
- long_opts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "coO", long_opts, NULL)) != -1) {
switch (c) {
case 'c':
flags |= LU_HEAT_FLAG_CLEAR;
switch (c) {
case 'c':
flags |= LU_HEAT_FLAG_CLEAR;