Patchwork [1/3] ext4: Fix compilation with -DDX_DEBUG v2

login
register
mail settings
Submitter Bernd Schubert
Date June 20, 2011, 8:28 p.m.
Message ID <20110620202849.2473133.84386.stgit@localhost.localdomain>
Download mbox | patch
Permalink /patch/101199/
State Superseded
Headers show

Comments

Bernd Schubert - June 20, 2011, 8:28 p.m.
changes from v1 -> v2:
Use %p as suggested by Coly Li

Compilation of ext4/namei.c brought up an error and warning messages
when compiled with -DDX_DEBUG


Signed-off-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
---
 fs/ext4/namei.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bernd Schubert - June 21, 2011, 3:26 p.m.
On 06/21/2011 05:40 AM, Coly Li wrote:
>
>
> On 2011年06月21日 04:28, Bernd Schubert Wrote:
>> changes from v1 ->  v2:
>> Use %p as suggested by Coly Li
>>
>> Compilation of ext4/namei.c brought up an error and warning messages
>> when compiled with -DDX_DEBUG
>>
>>
>> Signed-off-by: Bernd Schubert<bernd.schubert@itwm.fraunhofer.de>
>> ---
>>   fs/ext4/namei.c |    4 ++--
>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
>> index b754b77..bfb749f 100644
>> --- a/fs/ext4/namei.c
>> +++ b/fs/ext4/namei.c
>> @@ -288,7 +288,7 @@ static struct stats dx_show_leaf(struct dx_hash_info *hinfo, struct ext4_dir_ent
>>   				char *name = de->name;
>>   				while (len--) printk("%c", *name++);
>>   				ext4fs_dirhash(de->name, de->name_len,&h);
>> -				printk(":%x.%u ", h.hash,
>> +				printk(":%x.%p ", h.hash,
>>   				       ((char *) de - base));
>>   			}
>>   			space += EXT4_DIR_REC_LEN(de->name_len);
>> @@ -1013,7 +1013,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct q
>>
>>   	*err = -ENOENT;
>>   errout:
>> -	dxtrace(printk(KERN_DEBUG "%s not found\n", name));
>> +	dxtrace(printk(KERN_DEBUG "%s not found\n", d_name->name));
>>   	dx_release (frames);
>>   	return NULL;
>>   }
>>
>>
>
> It's OK for me.
>
> Reviewed-by: Coly Li<bosong.ly@taobao.com>
>

Arg, actually we have to change the printk to

				printk(":%x.%p ", h.hash,
  				       (void *) ((char *) de - base));

to avoid another warning. Seems I forgot to enable -DDX_DEBUG when I 
tested it :(


Cheers,
Bernd
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - July 16, 2011, 11:41 p.m.
On Mon, Jun 20, 2011 at 10:28:49PM +0200, Bernd Schubert wrote:
> changes from v1 -> v2:
> Use %p as suggested by Coly Li

The problem with %p:

    1)  It prints numbers that will never be larger than 4096 with as 
        "00000012"
    2)  It prints the number 0 as "  (null)".

These two things mean that we get messages like this:

names: foo:7141e93c.  (null) bar:745c4a06.00000012 baz:79817344.00000024 quux:7e85a800.00000036 ...

instead of:

names: foo:7141e93c.0 bar:745c4a06.12 baz:79817344.24 quux:7e85a800.36 ...

(did anyone even try this and check to see what would happen with %p?)

I've applied this patch, with a change so that we print the number
with %u and with an explicit cast to unsigned.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index b754b77..bfb749f 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -288,7 +288,7 @@  static struct stats dx_show_leaf(struct dx_hash_info *hinfo, struct ext4_dir_ent
 				char *name = de->name;
 				while (len--) printk("%c", *name++);
 				ext4fs_dirhash(de->name, de->name_len, &h);
-				printk(":%x.%u ", h.hash,
+				printk(":%x.%p ", h.hash,
 				       ((char *) de - base));
 			}
 			space += EXT4_DIR_REC_LEN(de->name_len);
@@ -1013,7 +1013,7 @@  static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct q
 
 	*err = -ENOENT;
 errout:
-	dxtrace(printk(KERN_DEBUG "%s not found\n", name));
+	dxtrace(printk(KERN_DEBUG "%s not found\n", d_name->name));
 	dx_release (frames);
 	return NULL;
 }