All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3][RFC] ext3: add a message in remount/umount for ext3
@ 2009-09-15  6:24 Toshiyuki Okajima
  2009-09-15 14:23 ` Andreas Dilger
  0 siblings, 1 reply; 3+ messages in thread
From: Toshiyuki Okajima @ 2009-09-15  6:24 UTC (permalink / raw)
  To: tytso, akpm; +Cc: sct, adilger, linux-ext4

From: Toshiyuki Okajima <toshi.okajima@jp.fujitsu.com>

ext3 doesn't log a record of having unmounted the filesystem. And ext3 doesn't 
log a record when the filesystem is remounted also with read-only. Therefore 
in the system log, we cannot judge whether or not at the certain time this 
filesystem user touches it.
For enterprise users, they often want to know when a certain filesystem is 
mounted/remounted/unmounted.

So, we output the message to the system log when the filesystem is 
remounted/unmounted.

Signed-off-by: Toshiyuki Okajima <toshi.okajima@jp.fujitsu.com>
---
 fs/ext3/super.c |   32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff -Nurp linux-2.6.31.orig/fs/ext3/super.c linux-2.6.31/fs/ext3/super.c
--- linux-2.6.31.orig/fs/ext3/super.c	2009-09-10 07:13:59.000000000 +0900
+++ linux-2.6.31/fs/ext3/super.c	2009-09-11 17:08:24.742407628 +0900
@@ -328,6 +328,26 @@ void ext3_update_dynamic_rev(struct supe
 	 */
 }
 
+static void ext3_print_mount_message(struct super_block *sb, 
+					int is_remount)
+{
+	printk(KERN_INFO "EXT3 FS %s on %s, ", 
+			is_remount? "remounted": "mounted", sb->s_id);
+	if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
+		char b[BDEVNAME_SIZE];
+
+		printk("external journal on %s\n",
+			bdevname(EXT3_SB(sb)->s_journal->j_dev, b));
+	} else {
+		printk("internal journal\n");
+	}
+}
+
+static void ext3_print_umount_message(struct super_block *sb)
+{
+	printk(KERN_INFO "EXT3 FS unmounted from %s\n", sb->s_id);
+}
+
 /*
  * Open the external journal device
  */
@@ -448,6 +468,7 @@ static void ext3_put_super (struct super
 	sb->s_fs_info = NULL;
 	kfree(sbi->s_blockgroup_lock);
 	kfree(sbi);
+	ext3_print_umount_message(sb);
 
 	unlock_kernel();
 }
@@ -1296,15 +1317,6 @@ static int ext3_setup_super(struct super
 			EXT3_INODES_PER_GROUP(sb),
 			sbi->s_mount_opt);
 
-	printk(KERN_INFO "EXT3 FS on %s, ", sb->s_id);
-	if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
-		char b[BDEVNAME_SIZE];

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/3][RFC] ext3: add a message in remount/umount for ext3
  2009-09-15  6:24 [PATCH 2/3][RFC] ext3: add a message in remount/umount for ext3 Toshiyuki Okajima
@ 2009-09-15 14:23 ` Andreas Dilger
  2009-09-16  4:49   ` Toshiyuki Okajima
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Dilger @ 2009-09-15 14:23 UTC (permalink / raw)
  To: Toshiyuki Okajima; +Cc: tytso, akpm, linux-ext4

[NB - removed Stephen from CC list]

On Sep 15, 2009  15:24 +0900, Toshiyuki Okajima wrote:
> +static void ext3_print_mount_message(struct super_block *sb, 
> +					int is_remount)
> +{
> +	printk(KERN_INFO "EXT3 FS %s on %s, ", 
> +			is_remount? "remounted": "mounted", sb->s_id);
> +	if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
> +		char b[BDEVNAME_SIZE];
> +
> +		printk("external journal on %s\n",
> +			bdevname(EXT3_SB(sb)->s_journal->j_dev, b));
> +	} else {
> +		printk("internal journal\n");
> +	}

This won't necessarily work as you expected, because the separate
printk() calls will result in the message being printed on separate
lines of output.

Instead, this should print this all in a single line:

	char jbuf[BDEVNAME_SIZE + 20] = "internal journal";

	if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
		sprintf(jbuf, "external journal on ");
		bdevname(EXT3_SB(sb)->s_journal->j_dev,
			 jbuf + 20));
	}
	
	printk(KERN_INFO "EXT3 FS %s on %s, %s\n", 
	       is_remount? "remounted": "mounted", sb->s_id, jbuf)

> @@ -1296,15 +1317,6 @@ static int ext3_setup_super(struct super
> -	printk(KERN_INFO "EXT3 FS on %s, ", sb->s_id);
> -	if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
> -		char b[BDEVNAME_SIZE];
> -
> -		printk("external journal on %s\n",
> -			bdevname(EXT3_SB(sb)->s_journal->j_dev, b));
> -	} else {
> -		printk("internal journal\n");
> -	}

Interesting, it was broken already...  Well, best to fix it anyways.
The same should be done for the ext4 patch.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/3][RFC] ext3: add a message in remount/umount for ext3
  2009-09-15 14:23 ` Andreas Dilger
@ 2009-09-16  4:49   ` Toshiyuki Okajima
  0 siblings, 0 replies; 3+ messages in thread
From: Toshiyuki Okajima @ 2009-09-16  4:49 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: tytso, akpm, linux-ext4

Hi Andreas,

On Tue, 15 Sep 2009 08:23:33 -0600
Andreas Dilger <adilger@sun.com> wrote:
> [NB - removed Stephen from CC list]
> 
> On Sep 15, 2009  15:24 +0900, Toshiyuki Okajima wrote:
> > +static void ext3_print_mount_message(struct super_block *sb, 
> > +					int is_remount)
> > +{
> > +	printk(KERN_INFO "EXT3 FS %s on %s, ", 
> > +			is_remount? "remounted": "mounted", sb->s_id);
> > +	if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
> > +		char b[BDEVNAME_SIZE];
> > +
> > +		printk("external journal on %s\n",
> > +			bdevname(EXT3_SB(sb)->s_journal->j_dev, b));
> > +	} else {
> > +		printk("internal journal\n");
> > +	}
> 
> This won't necessarily work as you expected, because the separate
> printk() calls will result in the message being printed on separate
> lines of output.
Thanks for your comment.
I'll apply it into new patch.

> 
> Instead, this should print this all in a single line:
> 
> 	char jbuf[BDEVNAME_SIZE + 20] = "internal journal";
> 
> 	if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
> 		sprintf(jbuf, "external journal on ");
> 		bdevname(EXT3_SB(sb)->s_journal->j_dev,
> 			 jbuf + 20));
> 	}
> 	
> 	printk(KERN_INFO "EXT3 FS %s on %s, %s\n", 
> 	       is_remount? "remounted": "mounted", sb->s_id, jbuf)
> 
> > @@ -1296,15 +1317,6 @@ static int ext3_setup_super(struct super
> > -	printk(KERN_INFO "EXT3 FS on %s, ", sb->s_id);
> > -	if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
> > -		char b[BDEVNAME_SIZE];
> > -
> > -		printk("external journal on %s\n",
> > -			bdevname(EXT3_SB(sb)->s_journal->j_dev, b));
> > -	} else {
> > -		printk("internal journal\n");
> > -	}
> 
> Interesting, it was broken already...  Well, best to fix it anyways.
> The same should be done for the ext4 patch.

Thanks,
Toshiyuki Okajima

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-16  4:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-15  6:24 [PATCH 2/3][RFC] ext3: add a message in remount/umount for ext3 Toshiyuki Okajima
2009-09-15 14:23 ` Andreas Dilger
2009-09-16  4:49   ` Toshiyuki Okajima

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.