Re: [PATCH V3 RESEND] SYSV: logging update

2014-09-20 Thread Fabian Frederick


> On 20 September 2014 at 01:00 Andrew Morton  wrote:
>
>
> On Sat, 13 Sep 2014 23:12:36 +0200 Fabian Frederick  wrote:
>
> > -use current logging functions
> > -replace no level printk by pr_err
> > -add debug.c / sysv_err function to include sb->s_id
> > -use pr_fmt with standard KBUILD_MODNAME ": "
> > -use __builtin_return_address to display function name
> > logging format is now:
> > sysv: (sb->s_id) sysv_fill_super [sysv]: msg
>
> Is this patch tested?

Yes but looking at it again I wonder if __builtin_return_address is the best
function to use. %pf displays "sysv_fill_super [sysv]".
Maybe a trivial question but is there a way to have it simply display function
name ?

Of course I hope to have more feedback/testing to improve this patch.

Regards,
Fabian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3 RESEND] SYSV: logging update

2014-09-20 Thread Fabian Frederick


 On 20 September 2014 at 01:00 Andrew Morton a...@linux-foundation.org wrote:


 On Sat, 13 Sep 2014 23:12:36 +0200 Fabian Frederick f...@skynet.be wrote:

  -use current logging functions
  -replace no level printk by pr_err
  -add debug.c / sysv_err function to include sb-s_id
  -use pr_fmt with standard KBUILD_MODNAME : 
  -use __builtin_return_address to display function name
  logging format is now:
  sysv: (sb-s_id) sysv_fill_super [sysv]: msg

 Is this patch tested?

Yes but looking at it again I wonder if __builtin_return_address is the best
function to use. %pf displays sysv_fill_super [sysv].
Maybe a trivial question but is there a way to have it simply display function
name ?

Of course I hope to have more feedback/testing to improve this patch.

Regards,
Fabian
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3 RESEND] SYSV: logging update

2014-09-19 Thread Andrew Morton
On Sat, 13 Sep 2014 23:12:36 +0200 Fabian Frederick  wrote:

> -use current logging functions
> -replace no level printk by pr_err
> -add debug.c / sysv_err function to include sb->s_id
> -use pr_fmt with standard KBUILD_MODNAME ": "
> -use __builtin_return_address to display function name
> logging format is now:
> sysv: (sb->s_id) sysv_fill_super [sysv]: msg

Is this patch tested?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3 RESEND] SYSV: logging update

2014-09-19 Thread Andrew Morton
On Sat, 13 Sep 2014 23:12:36 +0200 Fabian Frederick f...@skynet.be wrote:

 -use current logging functions
 -replace no level printk by pr_err
 -add debug.c / sysv_err function to include sb-s_id
 -use pr_fmt with standard KBUILD_MODNAME : 
 -use __builtin_return_address to display function name
 logging format is now:
 sysv: (sb-s_id) sysv_fill_super [sysv]: msg

Is this patch tested?
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V3 RESEND] SYSV: logging update

2014-09-13 Thread Fabian Frederick
-use current logging functions
-replace no level printk by pr_err
-add debug.c / sysv_err function to include sb->s_id
-use pr_fmt with standard KBUILD_MODNAME ": "
-use __builtin_return_address to display function name
logging format is now:
sysv: (sb->s_id) sysv_fill_super [sysv]: msg

Cc: Christoph Hellwig 
Cc: Joe Perches 
Cc: Andrew Morton 
Signed-off-by: Fabian Frederick 
---
V3:

Suggestions by Joe Perches:
-use builtin function(0) instead of __func__
-use const sb in sysv_err
-use standard KBUILD_MODNAME ": " fmt
-remove \n from sysv_err

V2: add sb->s_id in logging (suggested by Christoph Hellwig)
 
 fs/sysv/Makefile |  2 +-
 fs/sysv/balloc.c | 24 +++-
 fs/sysv/debug.c  | 15 +++
 fs/sysv/ialloc.c | 12 +---
 fs/sysv/inode.c  | 15 ++-
 fs/sysv/itree.c  |  2 +-
 fs/sysv/super.c  | 28 +++-
 fs/sysv/sysv.h   |  3 +++
 8 files changed, 53 insertions(+), 48 deletions(-)
 create mode 100644 fs/sysv/debug.c

diff --git a/fs/sysv/Makefile b/fs/sysv/Makefile
index 3591f9d..46721fb 100644
--- a/fs/sysv/Makefile
+++ b/fs/sysv/Makefile
@@ -5,4 +5,4 @@
 obj-$(CONFIG_SYSV_FS) += sysv.o
 
 sysv-objs := ialloc.o balloc.o inode.o itree.o file.o dir.o \
-namei.o super.o symlink.o
+namei.o super.o symlink.o debug.o
diff --git a/fs/sysv/balloc.c b/fs/sysv/balloc.c
index 921c053..3473fb9 100644
--- a/fs/sysv/balloc.c
+++ b/fs/sysv/balloc.c
@@ -56,7 +56,7 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
return;
 
if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) {
-   printk("sysv_free_block: trying to free block not in 
datazone\n");
+   sysv_err(sb, "trying to free block not in datazone\n");
return;
}
 
@@ -64,7 +64,7 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
count = fs16_to_cpu(sbi, *sbi->s_bcache_count);
 
if (count > sbi->s_flc_size) {
-   printk("sysv_free_block: flc_count > flc_size\n");
+   sysv_err(sb, "flc_count > flc_size\n");
mutex_unlock(>s_lock);
return;
}
@@ -76,7 +76,7 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
block += sbi->s_block_base;
bh = sb_getblk(sb, block);
if (!bh) {
-   printk("sysv_free_block: getblk() failed\n");
+   sysv_err(sb, "getblk() failed\n");
mutex_unlock(>s_lock);
return;
}
@@ -118,8 +118,7 @@ sysv_zone_t sysv_new_block(struct super_block * sb)
*sbi->s_bcache_count = cpu_to_fs16(sbi, count);
 
if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) {
-   printk("sysv_new_block: new block %d is not in data zone\n",
-   block);
+   sysv_err(sb, "new block %d is not in data zone\n", block);
goto Enospc;
}
 
@@ -128,14 +127,14 @@ sysv_zone_t sysv_new_block(struct super_block * sb)
 
block += sbi->s_block_base;
if (!(bh = sb_bread(sb, block))) {
-   printk("sysv_new_block: cannot read free-list block\n");
+   sysv_err(sb, "cannot read free-list block\n");
/* retry this same block next time */
*sbi->s_bcache_count = cpu_to_fs16(sbi, 1);
goto Enospc;
}
count = fs16_to_cpu(sbi, *(__fs16*)bh->b_data);
if (count > sbi->s_flc_size) {
-   printk("sysv_new_block: free-list block with >flc_size 
entries\n");
+   sysv_err(sb, "free-list block with >flc_size 
entries\n");
brelse(bh);
goto Enospc;
}
@@ -215,22 +214,21 @@ done:
return count;
 
 Einval:
-   printk("sysv_count_free_blocks: new block %d is not in data zone\n",
-   block);
+   sysv_err(sb, "new block %d is not in data zone\n", block);
goto trust_sb;
 Eio:
-   printk("sysv_count_free_blocks: cannot read free-list block\n");
+   sysv_err(sb, "cannot read free-list block\n");
goto trust_sb;
 E2big:
-   printk("sysv_count_free_blocks: >flc_size entries in free-list 
block\n");
+   sysv_err(sb, ">flc_size entries in free-list block\n");
if (bh)
brelse(bh);
 trust_sb:
count = sb_count;
goto done;
 Ecount:
-   printk("sysv_count_free_blocks: free block count was %d, "
-   "correcting to %d\n", sb_count, count);
+   sysv_err(sb, "free block count was %d, correcting to %d\n",
+sb_count, count);
if (!(sb->s_flags & MS_RDONLY)) {
*sbi->s_free_blocks = cpu_to_fs32(sbi, count);
dirty_sb(sb);
diff --git a/fs/sysv/debug.c 

[PATCH V3 RESEND] SYSV: logging update

2014-09-13 Thread Fabian Frederick
-use current logging functions
-replace no level printk by pr_err
-add debug.c / sysv_err function to include sb-s_id
-use pr_fmt with standard KBUILD_MODNAME : 
-use __builtin_return_address to display function name
logging format is now:
sysv: (sb-s_id) sysv_fill_super [sysv]: msg

Cc: Christoph Hellwig h...@infradead.org
Cc: Joe Perches j...@perches.com
Cc: Andrew Morton a...@linux-foundation.org
Signed-off-by: Fabian Frederick f...@skynet.be
---
V3:

Suggestions by Joe Perches:
-use builtin function(0) instead of __func__
-use const sb in sysv_err
-use standard KBUILD_MODNAME :  fmt
-remove \n from sysv_err

V2: add sb-s_id in logging (suggested by Christoph Hellwig)
 
 fs/sysv/Makefile |  2 +-
 fs/sysv/balloc.c | 24 +++-
 fs/sysv/debug.c  | 15 +++
 fs/sysv/ialloc.c | 12 +---
 fs/sysv/inode.c  | 15 ++-
 fs/sysv/itree.c  |  2 +-
 fs/sysv/super.c  | 28 +++-
 fs/sysv/sysv.h   |  3 +++
 8 files changed, 53 insertions(+), 48 deletions(-)
 create mode 100644 fs/sysv/debug.c

diff --git a/fs/sysv/Makefile b/fs/sysv/Makefile
index 3591f9d..46721fb 100644
--- a/fs/sysv/Makefile
+++ b/fs/sysv/Makefile
@@ -5,4 +5,4 @@
 obj-$(CONFIG_SYSV_FS) += sysv.o
 
 sysv-objs := ialloc.o balloc.o inode.o itree.o file.o dir.o \
-namei.o super.o symlink.o
+namei.o super.o symlink.o debug.o
diff --git a/fs/sysv/balloc.c b/fs/sysv/balloc.c
index 921c053..3473fb9 100644
--- a/fs/sysv/balloc.c
+++ b/fs/sysv/balloc.c
@@ -56,7 +56,7 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
return;
 
if (block  sbi-s_firstdatazone || block = sbi-s_nzones) {
-   printk(sysv_free_block: trying to free block not in 
datazone\n);
+   sysv_err(sb, trying to free block not in datazone\n);
return;
}
 
@@ -64,7 +64,7 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
count = fs16_to_cpu(sbi, *sbi-s_bcache_count);
 
if (count  sbi-s_flc_size) {
-   printk(sysv_free_block: flc_count  flc_size\n);
+   sysv_err(sb, flc_count  flc_size\n);
mutex_unlock(sbi-s_lock);
return;
}
@@ -76,7 +76,7 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
block += sbi-s_block_base;
bh = sb_getblk(sb, block);
if (!bh) {
-   printk(sysv_free_block: getblk() failed\n);
+   sysv_err(sb, getblk() failed\n);
mutex_unlock(sbi-s_lock);
return;
}
@@ -118,8 +118,7 @@ sysv_zone_t sysv_new_block(struct super_block * sb)
*sbi-s_bcache_count = cpu_to_fs16(sbi, count);
 
if (block  sbi-s_firstdatazone || block = sbi-s_nzones) {
-   printk(sysv_new_block: new block %d is not in data zone\n,
-   block);
+   sysv_err(sb, new block %d is not in data zone\n, block);
goto Enospc;
}
 
@@ -128,14 +127,14 @@ sysv_zone_t sysv_new_block(struct super_block * sb)
 
block += sbi-s_block_base;
if (!(bh = sb_bread(sb, block))) {
-   printk(sysv_new_block: cannot read free-list block\n);
+   sysv_err(sb, cannot read free-list block\n);
/* retry this same block next time */
*sbi-s_bcache_count = cpu_to_fs16(sbi, 1);
goto Enospc;
}
count = fs16_to_cpu(sbi, *(__fs16*)bh-b_data);
if (count  sbi-s_flc_size) {
-   printk(sysv_new_block: free-list block with flc_size 
entries\n);
+   sysv_err(sb, free-list block with flc_size 
entries\n);
brelse(bh);
goto Enospc;
}
@@ -215,22 +214,21 @@ done:
return count;
 
 Einval:
-   printk(sysv_count_free_blocks: new block %d is not in data zone\n,
-   block);
+   sysv_err(sb, new block %d is not in data zone\n, block);
goto trust_sb;
 Eio:
-   printk(sysv_count_free_blocks: cannot read free-list block\n);
+   sysv_err(sb, cannot read free-list block\n);
goto trust_sb;
 E2big:
-   printk(sysv_count_free_blocks: flc_size entries in free-list 
block\n);
+   sysv_err(sb, flc_size entries in free-list block\n);
if (bh)
brelse(bh);
 trust_sb:
count = sb_count;
goto done;
 Ecount:
-   printk(sysv_count_free_blocks: free block count was %d, 
-   correcting to %d\n, sb_count, count);
+   sysv_err(sb, free block count was %d, correcting to %d\n,
+sb_count, count);
if (!(sb-s_flags  MS_RDONLY)) {
*sbi-s_free_blocks = cpu_to_fs32(sbi, count);
dirty_sb(sb);
diff --git a/fs/sysv/debug.c