ceph: cleanup the dir debug log and xattr_version
diff mbox series

Message ID 20191219021518.60891-1-xiubli@redhat.com
State New
Headers show
Series
  • ceph: cleanup the dir debug log and xattr_version
Related show

Commit Message

Xiubo Li Dec. 19, 2019, 2:15 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

In the debug logs about the di->offset or ctx->pos it is in hex
format, but some others are using the dec format. It is a little
hard to read.

For the xattr version, it is u64 type, using a shorter type may
truncate it.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/dir.c   | 4 ++--
 fs/ceph/xattr.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Jeff Layton Dec. 19, 2019, 11:10 a.m. UTC | #1
On Wed, 2019-12-18 at 21:15 -0500, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
> 
> In the debug logs about the di->offset or ctx->pos it is in hex
> format, but some others are using the dec format. It is a little
> hard to read.
> 
> For the xattr version, it is u64 type, using a shorter type may
> truncate it.
> 
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/dir.c   | 4 ++--
>  fs/ceph/xattr.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> index 5c97bdbb0772..8d14a2867e7c 100644
> --- a/fs/ceph/dir.c
> +++ b/fs/ceph/dir.c
> @@ -1192,7 +1192,7 @@ void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di)
>  	struct dentry *dn = di->dentry;
>  	struct ceph_mds_client *mdsc;
>  
> -	dout("dentry_dir_lease_touch %p %p '%pd' (offset %lld)\n",
> +	dout("dentry_dir_lease_touch %p %p '%pd' (offset %llx)\n",
>  	     di, dn, dn, di->offset);

If you're printing hex values, it's generally a good idea to prefix them
with "0x" so that it's clear that they are in hex.

>  
>  	if (!list_empty(&di->lease_list)) {
> @@ -1577,7 +1577,7 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
>  
>  	mdsc = ceph_sb_to_client(dir->i_sb)->mdsc;
>  
> -	dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,
> +	dout("d_revalidate %p '%pd' inode %p offset %llx\n", dentry,
>  	     dentry, inode, ceph_dentry(dentry)->offset);
>  
>  	/* always trust cached snapped dentries, snapdir dentry */
> diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
> index 6e5e145d51d1..c8609dfd6b37 100644
> --- a/fs/ceph/xattr.c
> +++ b/fs/ceph/xattr.c
> @@ -655,7 +655,7 @@ static int __build_xattrs(struct inode *inode)
>  	u32 len;
>  	const char *name, *val;
>  	struct ceph_inode_info *ci = ceph_inode(inode);
> -	int xattr_version;
> +	u64 xattr_version;
>  	struct ceph_inode_xattr **xattrs = NULL;
>  	int err = 0;
>  	int i;

Merged, but I went ahead and added the "0x" prefixes on these values.

Thanks,
Xiubo Li Dec. 19, 2019, 11:31 a.m. UTC | #2
On 2019/12/19 19:10, Jeff Layton wrote:
> On Wed, 2019-12-18 at 21:15 -0500, xiubli@redhat.com wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> In the debug logs about the di->offset or ctx->pos it is in hex
>> format, but some others are using the dec format. It is a little
>> hard to read.
>>
>> For the xattr version, it is u64 type, using a shorter type may
>> truncate it.
>>
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>>   fs/ceph/dir.c   | 4 ++--
>>   fs/ceph/xattr.c | 2 +-
>>   2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
>> index 5c97bdbb0772..8d14a2867e7c 100644
>> --- a/fs/ceph/dir.c
>> +++ b/fs/ceph/dir.c
>> @@ -1192,7 +1192,7 @@ void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di)
>>   	struct dentry *dn = di->dentry;
>>   	struct ceph_mds_client *mdsc;
>>   
>> -	dout("dentry_dir_lease_touch %p %p '%pd' (offset %lld)\n",
>> +	dout("dentry_dir_lease_touch %p %p '%pd' (offset %llx)\n",
>>   	     di, dn, dn, di->offset);
> If you're printing hex values, it's generally a good idea to prefix them
> with "0x" so that it's clear that they are in hex.

Yeah, make sense.

Thanks.


>
>>   
>>   	if (!list_empty(&di->lease_list)) {
>> @@ -1577,7 +1577,7 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
>>   
>>   	mdsc = ceph_sb_to_client(dir->i_sb)->mdsc;
>>   
>> -	dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,
>> +	dout("d_revalidate %p '%pd' inode %p offset %llx\n", dentry,
>>   	     dentry, inode, ceph_dentry(dentry)->offset);
>>   
>>   	/* always trust cached snapped dentries, snapdir dentry */
>> diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
>> index 6e5e145d51d1..c8609dfd6b37 100644
>> --- a/fs/ceph/xattr.c
>> +++ b/fs/ceph/xattr.c
>> @@ -655,7 +655,7 @@ static int __build_xattrs(struct inode *inode)
>>   	u32 len;
>>   	const char *name, *val;
>>   	struct ceph_inode_info *ci = ceph_inode(inode);
>> -	int xattr_version;
>> +	u64 xattr_version;
>>   	struct ceph_inode_xattr **xattrs = NULL;
>>   	int err = 0;
>>   	int i;
> Merged, but I went ahead and added the "0x" prefixes on these values.
>
> Thanks,

Patch
diff mbox series

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 5c97bdbb0772..8d14a2867e7c 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1192,7 +1192,7 @@  void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di)
 	struct dentry *dn = di->dentry;
 	struct ceph_mds_client *mdsc;
 
-	dout("dentry_dir_lease_touch %p %p '%pd' (offset %lld)\n",
+	dout("dentry_dir_lease_touch %p %p '%pd' (offset %llx)\n",
 	     di, dn, dn, di->offset);
 
 	if (!list_empty(&di->lease_list)) {
@@ -1577,7 +1577,7 @@  static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
 
 	mdsc = ceph_sb_to_client(dir->i_sb)->mdsc;
 
-	dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,
+	dout("d_revalidate %p '%pd' inode %p offset %llx\n", dentry,
 	     dentry, inode, ceph_dentry(dentry)->offset);
 
 	/* always trust cached snapped dentries, snapdir dentry */
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 6e5e145d51d1..c8609dfd6b37 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -655,7 +655,7 @@  static int __build_xattrs(struct inode *inode)
 	u32 len;
 	const char *name, *val;
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	int xattr_version;
+	u64 xattr_version;
 	struct ceph_inode_xattr **xattrs = NULL;
 	int err = 0;
 	int i;