]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: make the ioctl cmd more readable in debug log
authorXiubo Li <xiubli@redhat.com>
Wed, 16 Mar 2022 06:49:34 +0000 (14:49 +0800)
committerXiubo Li <xiubli@redhat.com>
Thu, 18 Aug 2022 02:59:50 +0000 (10:59 +0800)
    ioctl file 0000000004e6b054 cmd 2148296211 arg 824635143532

The numerical cmd valye in the ioctl debug log message is too hard to
understand even when you look at it in the code. Make it more readable.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/ioctl.c

index 477ecc667aee93355eae6b971a0c0a5092fb3cdd..b9f0f4e460abf309c8714a41c8b8f1d775608ef2 100644 (file)
@@ -313,11 +313,48 @@ static long ceph_set_encryption_policy(struct file *file, unsigned long arg)
        return ret;
 }
 
+static const char *ceph_ioctl_cmd_name(const unsigned int cmd)
+{
+       switch (cmd) {
+       case CEPH_IOC_GET_LAYOUT:
+               return "get_layout";
+       case CEPH_IOC_SET_LAYOUT:
+               return "set_layout";
+       case CEPH_IOC_SET_LAYOUT_POLICY:
+               return "set_layout_policy";
+       case CEPH_IOC_GET_DATALOC:
+               return "get_dataloc";
+       case CEPH_IOC_LAZYIO:
+               return "lazyio";
+       case CEPH_IOC_SYNCIO:
+               return "syncio";
+       case FS_IOC_SET_ENCRYPTION_POLICY:
+               return "set encryption_policy";
+       case FS_IOC_GET_ENCRYPTION_POLICY:
+               return "get_encryption_policy";
+       case FS_IOC_GET_ENCRYPTION_POLICY_EX:
+               return "get_encryption_policy_ex";
+       case FS_IOC_ADD_ENCRYPTION_KEY:
+               return "add_encryption_key";
+       case FS_IOC_REMOVE_ENCRYPTION_KEY:
+               return "remove_encryption_key";
+       case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
+               return "remove_encryption_key_all_users";
+       case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
+               return "get_encryption_key_status";
+       case FS_IOC_GET_ENCRYPTION_NONCE:
+               return "get_encryption_nonce";
+       default:
+               return "unknown";
+       }
+}
+
 long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        int ret;
 
-       dout("ioctl file %p cmd %u arg %lu\n", file, cmd, arg);
+       dout("ioctl file %p cmd %s arg %lu\n", file,
+            ceph_ioctl_cmd_name(cmd), arg);
        switch (cmd) {
        case CEPH_IOC_GET_LAYOUT:
                return ceph_ioctl_get_layout(file, (void __user *)arg);