Whamcloud - gitweb
LU-15317 libcfs: Remove D_TTY 51/45751/3
authorPatrick Farrell <pfarrell@whamcloud.com>
Mon, 6 Dec 2021 02:33:02 +0000 (21:33 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 6 Jan 2022 22:03:20 +0000 (22:03 +0000)
The D_TTY flag is almost entirely unused and certainly not
needed.  Remove it so we have a spare flag to use for
iotrace.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I1127cbcf6ee51adc07d560a8827fa1e32d16c90c
Reviewed-on: https://review.whamcloud.com/45751
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/debug.c
libcfs/libcfs/tracefile.c
lnet/include/uapi/linux/lnet/libcfs_debug.h
lustre/llite/file.c

index d3b77af..8873cfb 100644 (file)
@@ -53,7 +53,7 @@ module_param(libcfs_subsystem_debug, int, 0644);
 MODULE_PARM_DESC(libcfs_subsystem_debug, "Lustre kernel debug subsystem mask");
 
 unsigned int libcfs_debug = (D_CANTMASK | D_NETERROR | D_HA | D_CONFIG |
 MODULE_PARM_DESC(libcfs_subsystem_debug, "Lustre kernel debug subsystem mask");
 
 unsigned int libcfs_debug = (D_CANTMASK | D_NETERROR | D_HA | D_CONFIG |
-                            D_IOCTL | D_LFSCK | D_TTY);
+                            D_IOCTL | D_LFSCK);
 EXPORT_SYMBOL(libcfs_debug);
 module_param(libcfs_debug, int, 0644);
 MODULE_PARM_DESC(libcfs_debug, "Lustre kernel debug mask");
 EXPORT_SYMBOL(libcfs_debug);
 module_param(libcfs_debug, int, 0644);
 MODULE_PARM_DESC(libcfs_debug, "Lustre kernel debug mask");
index c117d1a..ac473c5 100644 (file)
@@ -42,7 +42,6 @@
 #include <linux/kthread.h>
 #include <linux/pagemap.h>
 #include <linux/poll.h>
 #include <linux/kthread.h>
 #include <linux/pagemap.h>
 #include <linux/poll.h>
-#include <linux/tty.h>
 #include <linux/uaccess.h>
 #include <libcfs/linux/linux-fs.h>
 #include <libcfs/libcfs.h>
 #include <linux/uaccess.h>
 #include <libcfs/linux/linux-fs.h>
 #include <libcfs/libcfs.h>
@@ -328,41 +327,6 @@ static void cfs_set_ptldebug_header(struct ptldebug_header *header,
        header->ph_extern_pid = 0;
 }
 
        header->ph_extern_pid = 0;
 }
 
-/**
- * tty_write_msg - write a message to a certain tty, not just the console.
- * @tty: the destination tty_struct
- * @msg: the message to write
- *
- * tty_write_message is not exported, so write a same function for it
- *
- */
-static void tty_write_msg(struct tty_struct *tty, const char *msg)
-{
-       mutex_lock(&tty->atomic_write_lock);
-       tty_lock(tty);
-       if (tty->ops->write && tty->count > 0)
-               tty->ops->write(tty, msg, strlen(msg));
-       tty_unlock(tty);
-       mutex_unlock(&tty->atomic_write_lock);
-       wake_up_interruptible_poll(&tty->write_wait, POLLOUT);
-}
-
-static void cfs_tty_write_message(const char *prefix, int mask, const char *msg)
-{
-       struct tty_struct *tty;
-
-       tty = get_current_tty();
-       if (!tty)
-               return;
-
-       tty_write_msg(tty, prefix);
-       if ((mask & D_EMERG) || (mask & D_ERROR))
-               tty_write_msg(tty, "Error");
-       tty_write_msg(tty, ": ");
-       tty_write_msg(tty, msg);
-       tty_kref_put(tty);
-}
-
 static void cfs_vprint_to_console(struct ptldebug_header *hdr, int mask,
                                  struct va_format *vaf, const char *file,
                                  const char *fn)
 static void cfs_vprint_to_console(struct ptldebug_header *hdr, int mask,
                                  struct va_format *vaf, const char *file,
                                  const char *fn)
@@ -397,10 +361,6 @@ static void cfs_vprint_to_console(struct ptldebug_header *hdr, int mask,
                else if (mask & (D_CONSOLE | libcfs_printk))
                        pr_info("%s: %pV", prefix, vaf);
        }
                else if (mask & (D_CONSOLE | libcfs_printk))
                        pr_info("%s: %pV", prefix, vaf);
        }
-
-       if (mask & D_TTY)
-               /* tty_write_msg doesn't handle formatting */
-               cfs_tty_write_message(prefix, mask, vaf->fmt);
 }
 
 static void cfs_print_to_console(struct ptldebug_header *hdr, int mask,
 }
 
 static void cfs_print_to_console(struct ptldebug_header *hdr, int mask,
@@ -511,14 +471,6 @@ int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata,
        if (*(string_buf + needed - 1) != '\n') {
                pr_info("Lustre: format at %s:%d:%s doesn't end in newline\n",
                        file, msgdata->msg_line, msgdata->msg_fn);
        if (*(string_buf + needed - 1) != '\n') {
                pr_info("Lustre: format at %s:%d:%s doesn't end in newline\n",
                        file, msgdata->msg_line, msgdata->msg_fn);
-       } else if (mask & D_TTY) {
-               /* TTY needs '\r\n' to move carriage to leftmost position */
-               if (needed < 2 || *(string_buf + needed - 2) != '\r')
-                       pr_info("Lustre: format at %s:%d:%s doesn't end in '\\r\\n'\n",
-                               file, msgdata->msg_line, msgdata->msg_fn);
-               if (strnchr(string_buf, needed, '%'))
-                       pr_info("Lustre: format at %s:%d:%s mustn't contain %%\n",
-                               file, msgdata->msg_line, msgdata->msg_fn);
        }
 
        header.ph_len = known_size + needed;
        }
 
        header.ph_len = known_size + needed;
@@ -598,8 +550,7 @@ console:
        }
 
        if (cdls != NULL && cdls->cdls_count != 0) {
        }
 
        if (cdls != NULL && cdls->cdls_count != 0) {
-               /* Do not allow print this to TTY */
-               cfs_print_to_console(&header, mask & ~D_TTY, file,
+               cfs_print_to_console(&header, mask, file,
                                     msgdata->msg_fn,
                                     "Skipped %d previous similar message%s\n",
                                     cdls->cdls_count,
                                     msgdata->msg_fn,
                                     "Skipped %d previous similar message%s\n",
                                     cdls->cdls_count,
index 82dfdae..3358506 100644 (file)
@@ -105,7 +105,6 @@ struct ptldebug_header {
 #define D_TRACE         0x00000001 /* ENTRY/EXIT markers */
 #define D_INODE         0x00000002
 #define D_SUPER         0x00000004
 #define D_TRACE         0x00000001 /* ENTRY/EXIT markers */
 #define D_INODE         0x00000002
 #define D_SUPER         0x00000004
-#define D_TTY           0x00000008 /* notification printed to TTY */
 #define D_MALLOC        0x00000010 /* print malloc, free information */
 #define D_CACHE         0x00000020 /* cache-related items */
 #define D_INFO          0x00000040 /* general information */
 #define D_MALLOC        0x00000010 /* print malloc, free information */
 #define D_CACHE         0x00000020 /* cache-related items */
 #define D_INFO          0x00000040 /* general information */
index 9ec9e63..a970888 100644 (file)
@@ -4999,7 +4999,7 @@ ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock)
         */
        if (!(fd->fd_flags & LL_FILE_FLOCK_WARNING)) {
                fd->fd_flags |= LL_FILE_FLOCK_WARNING;
         */
        if (!(fd->fd_flags & LL_FILE_FLOCK_WARNING)) {
                fd->fd_flags |= LL_FILE_FLOCK_WARNING;
-               CDEBUG_LIMIT(D_TTY | D_CONSOLE,
+               CDEBUG_LIMIT(D_CONSOLE,
                             "flock disabled, mount with '-o [local]flock' to enable\r\n");
        }
        RETURN(-ENOSYS);
                             "flock disabled, mount with '-o [local]flock' to enable\r\n");
        }
        RETURN(-ENOSYS);