Commit 6835de14 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Improve laptop mode's block_dump output

From: "Theodore Ts'o" <tytso@mit.edu>

This patch versus improves the output produced by "echo 1 >
/proc/sys/vm/block_dump", in the following ways:

1) The messages are printed with KERN_DEBUG, so that even if sysklogd is
   running, if configured appropriately, it will not need to write to log
   files.

2) The inode which is dirtied by a process is now identified more
   precisely by inode number and filesystem ID, and by a dcache name if
   present.

3) In the generic filesystem sget function, the superblock id (s_id) is
   filled in with the filesystem type by default.  Filesystems which are
   block-device based will override s_id, but this allows pseudo
   filesystems such as tmpfs, procfs, etc.  to be identified in (2).
parent 475c3656
......@@ -2444,7 +2444,7 @@ void submit_bio(int rw, struct bio *bio)
if (unlikely(block_dump)) {
char b[BDEVNAME_SIZE];
printk("%s(%d): %s block %Lu on %s\n",
printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
current->comm, current->pid,
(rw & WRITE) ? "WRITE" : "READ",
(unsigned long long)bio->bi_sector,
......
......@@ -75,8 +75,23 @@ void __mark_inode_dirty(struct inode *inode, int flags)
if ((inode->i_state & flags) == flags)
return;
if (unlikely(block_dump))
printk("%s(%d): dirtied file\n", current->comm, current->pid);
if (unlikely(block_dump)) {
struct dentry *dentry = NULL;
const char *name = "?";
if (!list_empty(&inode->i_dentry)) {
dentry = list_entry(inode->i_dentry.next,
struct dentry, d_alias);
if (dentry && dentry->d_name.name)
name = (const char *) dentry->d_name.name;
}
if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev"))
printk(KERN_DEBUG
"%s(%d): dirtied inode %lu (%s) on %s\n",
current->comm, current->pid, inode->i_ino,
name, inode->i_sb->s_id);
}
spin_lock(&inode_lock);
if ((inode->i_state & flags) != flags) {
......
......@@ -266,6 +266,7 @@ struct super_block *sget(struct file_system_type *type,
return ERR_PTR(err);
}
s->s_type = type;
strlcpy(s->s_id, type->name, sizeof(s->s_id));
list_add(&s->s_list, super_blocks.prev);
list_add(&s->s_instances, &type->fs_supers);
spin_unlock(&sb_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment