From: "Theodore Ts'o" This patch versus 2.6.6-rc2 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). --- 25-akpm/drivers/block/ll_rw_blk.c | 2 +- 25-akpm/fs/fs-writeback.c | 19 +++++++++++++++++-- 25-akpm/fs/super.c | 1 + 3 files changed, 19 insertions(+), 3 deletions(-) diff -puN drivers/block/ll_rw_blk.c~improve-laptop-modes-block_dump-output drivers/block/ll_rw_blk.c --- 25/drivers/block/ll_rw_blk.c~improve-laptop-modes-block_dump-output 2004-04-27 19:17:55.082277008 -0700 +++ 25-akpm/drivers/block/ll_rw_blk.c 2004-04-27 19:17:55.092275488 -0700 @@ -2451,7 +2451,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, diff -puN fs/fs-writeback.c~improve-laptop-modes-block_dump-output fs/fs-writeback.c --- 25/fs/fs-writeback.c~improve-laptop-modes-block_dump-output 2004-04-27 19:17:55.083276856 -0700 +++ 25-akpm/fs/fs-writeback.c 2004-04-27 19:17:55.093275336 -0700 @@ -75,8 +75,23 @@ void __mark_inode_dirty(struct inode *in 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) { diff -puN fs/super.c~improve-laptop-modes-block_dump-output fs/super.c --- 25/fs/super.c~improve-laptop-modes-block_dump-output 2004-04-27 19:17:55.085276552 -0700 +++ 25-akpm/fs/super.c 2004-04-27 19:17:55.094275184 -0700 @@ -267,6 +267,7 @@ retry: 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); _