All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation.
@ 2012-06-24 14:22 Tao Ma
  2012-07-03 16:58 ` Darrick J. Wong
  2012-09-03  3:15 ` Tao Ma
  0 siblings, 2 replies; 5+ messages in thread
From: Tao Ma @ 2012-06-24 14:22 UTC (permalink / raw)
  To: linux-ext4; +Cc: Darrick J. Wong, Theodore Ts'o

From: Tao Ma <boyu.mt@taobao.com>

As I mentioned in the kernel part patch with the subject
"ext4: Use s_csum_seed instead of i_csum_seed for xattr block csum",
it is not easy for the kernel to use the proper inode csum seed.
So always use the fs.csum_seed for the xattr block csum calculation.

Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
---
 lib/ext2fs/csum.c |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c
index a7096d2..5ccbc1c 100644
--- a/lib/ext2fs/csum.c
+++ b/lib/ext2fs/csum.c
@@ -119,21 +119,9 @@ static errcode_t ext2fs_ext_attr_block_csum(ext2_filsys fs, ext2_ino_t inum,
 	struct ext2_inode inode;
 
 	hdr->h_checksum = 0;
-	if (ext2fs_le32_to_cpu(hdr->h_refcount) != 1) {
-		block = ext2fs_cpu_to_le64(block);
-		*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block,
-					sizeof(block));
-	} else {
-		retval = ext2fs_read_inode(fs, inum, &inode);
-		if (retval)
-			return retval;
-		inum = ext2fs_cpu_to_le32(inum);
-		gen = ext2fs_cpu_to_le32(inode.i_generation);
-		*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&inum,
-					sizeof(inum));
-		*crc = ext2fs_crc32c_le(*crc, (unsigned char *)&gen,
-					sizeof(gen));
-	}
+	block = ext2fs_cpu_to_le64(block);
+	*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block,
+				sizeof(block));
 	*crc = ext2fs_crc32c_le(*crc, (unsigned char *)buf, fs->blocksize);
 	hdr->h_checksum = old_crc;
 
-- 
1.7.1


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

* Re: [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation.
  2012-06-24 14:22 [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation Tao Ma
@ 2012-07-03 16:58 ` Darrick J. Wong
  2012-07-04  1:44   ` Tao Ma
  2012-09-03  3:15 ` Tao Ma
  1 sibling, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2012-07-03 16:58 UTC (permalink / raw)
  To: Tao Ma; +Cc: linux-ext4, Theodore Ts'o

On Sun, Jun 24, 2012 at 10:22:36PM +0800, Tao Ma wrote:
> From: Tao Ma <boyu.mt@taobao.com>
> 
> As I mentioned in the kernel part patch with the subject
> "ext4: Use s_csum_seed instead of i_csum_seed for xattr block csum",
> it is not easy for the kernel to use the proper inode csum seed.
> So always use the fs.csum_seed for the xattr block csum calculation.
> 
> Cc: Darrick J. Wong <djwong@us.ibm.com>

Acked-by: Darrick J. Wong <djwong@us.ibm.com>

(I assume there's a similar patch for e2fsprogs?)

--D
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> Signed-off-by: Tao Ma <boyu.mt@taobao.com>
> ---
>  lib/ext2fs/csum.c |   18 +++---------------
>  1 files changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c
> index a7096d2..5ccbc1c 100644
> --- a/lib/ext2fs/csum.c
> +++ b/lib/ext2fs/csum.c
> @@ -119,21 +119,9 @@ static errcode_t ext2fs_ext_attr_block_csum(ext2_filsys fs, ext2_ino_t inum,
>  	struct ext2_inode inode;
> 
>  	hdr->h_checksum = 0;
> -	if (ext2fs_le32_to_cpu(hdr->h_refcount) != 1) {
> -		block = ext2fs_cpu_to_le64(block);
> -		*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block,
> -					sizeof(block));
> -	} else {
> -		retval = ext2fs_read_inode(fs, inum, &inode);
> -		if (retval)
> -			return retval;
> -		inum = ext2fs_cpu_to_le32(inum);
> -		gen = ext2fs_cpu_to_le32(inode.i_generation);
> -		*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&inum,
> -					sizeof(inum));
> -		*crc = ext2fs_crc32c_le(*crc, (unsigned char *)&gen,
> -					sizeof(gen));
> -	}
> +	block = ext2fs_cpu_to_le64(block);
> +	*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block,
> +				sizeof(block));
>  	*crc = ext2fs_crc32c_le(*crc, (unsigned char *)buf, fs->blocksize);
>  	hdr->h_checksum = old_crc;
> 
> -- 
> 1.7.1
> 
> --
> 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
> 


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

* Re: [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation.
  2012-07-03 16:58 ` Darrick J. Wong
@ 2012-07-04  1:44   ` Tao Ma
  2012-07-04  3:03     ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Tao Ma @ 2012-07-04  1:44 UTC (permalink / raw)
  To: djwong; +Cc: linux-ext4, Theodore Ts'o

On 07/04/2012 12:58 AM, Darrick J. Wong wrote:
> On Sun, Jun 24, 2012 at 10:22:36PM +0800, Tao Ma wrote:
>> From: Tao Ma <boyu.mt@taobao.com>
>>
>> As I mentioned in the kernel part patch with the subject
>> "ext4: Use s_csum_seed instead of i_csum_seed for xattr block csum",
>> it is not easy for the kernel to use the proper inode csum seed.
>> So always use the fs.csum_seed for the xattr block csum calculation.
>>
>> Cc: Darrick J. Wong <djwong@us.ibm.com>
> 
> Acked-by: Darrick J. Wong <djwong@us.ibm.com>
> 
> (I assume there's a similar patch for e2fsprogs?)
uh, sorry, but this *is* the patch for e2fsprogs. Something wrong here?

Thanks
Tao
> 
> --D
>> Cc: "Theodore Ts'o" <tytso@mit.edu>
>> Signed-off-by: Tao Ma <boyu.mt@taobao.com>
>> ---
>>  lib/ext2fs/csum.c |   18 +++---------------
>>  1 files changed, 3 insertions(+), 15 deletions(-)
>>
>> diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c
>> index a7096d2..5ccbc1c 100644
>> --- a/lib/ext2fs/csum.c
>> +++ b/lib/ext2fs/csum.c
>> @@ -119,21 +119,9 @@ static errcode_t ext2fs_ext_attr_block_csum(ext2_filsys fs, ext2_ino_t inum,
>>  	struct ext2_inode inode;
>>
>>  	hdr->h_checksum = 0;
>> -	if (ext2fs_le32_to_cpu(hdr->h_refcount) != 1) {
>> -		block = ext2fs_cpu_to_le64(block);
>> -		*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block,
>> -					sizeof(block));
>> -	} else {
>> -		retval = ext2fs_read_inode(fs, inum, &inode);
>> -		if (retval)
>> -			return retval;
>> -		inum = ext2fs_cpu_to_le32(inum);
>> -		gen = ext2fs_cpu_to_le32(inode.i_generation);
>> -		*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&inum,
>> -					sizeof(inum));
>> -		*crc = ext2fs_crc32c_le(*crc, (unsigned char *)&gen,
>> -					sizeof(gen));
>> -	}
>> +	block = ext2fs_cpu_to_le64(block);
>> +	*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block,
>> +				sizeof(block));
>>  	*crc = ext2fs_crc32c_le(*crc, (unsigned char *)buf, fs->blocksize);
>>  	hdr->h_checksum = old_crc;
>>
>> -- 
>> 1.7.1
>>
>> --
>> 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
>>
> 
> --
> 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
> 



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

* Re: [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation.
  2012-07-04  1:44   ` Tao Ma
@ 2012-07-04  3:03     ` Darrick J. Wong
  0 siblings, 0 replies; 5+ messages in thread
From: Darrick J. Wong @ 2012-07-04  3:03 UTC (permalink / raw)
  To: Tao Ma; +Cc: linux-ext4, Theodore Ts'o

On Wed, Jul 04, 2012 at 09:44:36AM +0800, Tao Ma wrote:
> On 07/04/2012 12:58 AM, Darrick J. Wong wrote:
> > On Sun, Jun 24, 2012 at 10:22:36PM +0800, Tao Ma wrote:
> >> From: Tao Ma <boyu.mt@taobao.com>
> >>
> >> As I mentioned in the kernel part patch with the subject
> >> "ext4: Use s_csum_seed instead of i_csum_seed for xattr block csum",
> >> it is not easy for the kernel to use the proper inode csum seed.
> >> So always use the fs.csum_seed for the xattr block csum calculation.
> >>
> >> Cc: Darrick J. Wong <djwong@us.ibm.com>
> > 
> > Acked-by: Darrick J. Wong <djwong@us.ibm.com>
> > 
> > (I assume there's a similar patch for e2fsprogs?)
> uh, sorry, but this *is* the patch for e2fsprogs. Something wrong here?

Oops, I got confused.  Please ignore my baffled comment. :/

--D
> 
> Thanks
> Tao
> > 
> > --D
> >> Cc: "Theodore Ts'o" <tytso@mit.edu>
> >> Signed-off-by: Tao Ma <boyu.mt@taobao.com>
> >> ---
> >>  lib/ext2fs/csum.c |   18 +++---------------
> >>  1 files changed, 3 insertions(+), 15 deletions(-)
> >>
> >> diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c
> >> index a7096d2..5ccbc1c 100644
> >> --- a/lib/ext2fs/csum.c
> >> +++ b/lib/ext2fs/csum.c
> >> @@ -119,21 +119,9 @@ static errcode_t ext2fs_ext_attr_block_csum(ext2_filsys fs, ext2_ino_t inum,
> >>  	struct ext2_inode inode;
> >>
> >>  	hdr->h_checksum = 0;
> >> -	if (ext2fs_le32_to_cpu(hdr->h_refcount) != 1) {
> >> -		block = ext2fs_cpu_to_le64(block);
> >> -		*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block,
> >> -					sizeof(block));
> >> -	} else {
> >> -		retval = ext2fs_read_inode(fs, inum, &inode);
> >> -		if (retval)
> >> -			return retval;
> >> -		inum = ext2fs_cpu_to_le32(inum);
> >> -		gen = ext2fs_cpu_to_le32(inode.i_generation);
> >> -		*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&inum,
> >> -					sizeof(inum));
> >> -		*crc = ext2fs_crc32c_le(*crc, (unsigned char *)&gen,
> >> -					sizeof(gen));
> >> -	}
> >> +	block = ext2fs_cpu_to_le64(block);
> >> +	*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block,
> >> +				sizeof(block));
> >>  	*crc = ext2fs_crc32c_le(*crc, (unsigned char *)buf, fs->blocksize);
> >>  	hdr->h_checksum = old_crc;
> >>
> >> -- 
> >> 1.7.1
> >>
> >> --
> >> 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
> >>
> > 
> > --
> > 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
> > 
> 
> 


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

* Re: [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation.
  2012-06-24 14:22 [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation Tao Ma
  2012-07-03 16:58 ` Darrick J. Wong
@ 2012-09-03  3:15 ` Tao Ma
  1 sibling, 0 replies; 5+ messages in thread
From: Tao Ma @ 2012-09-03  3:15 UTC (permalink / raw)
  To: linux-ext4; +Cc: Darrick J. Wong, Theodore Ts'o

Hi Ted,
	As the corresponding kernel change has been merged, can this patch be
merged to the e2fsporgs also?

Thanks
Tao
On 06/24/2012 10:22 PM, Tao Ma wrote:
> From: Tao Ma <boyu.mt@taobao.com>
> 
> As I mentioned in the kernel part patch with the subject
> "ext4: Use s_csum_seed instead of i_csum_seed for xattr block csum",
> it is not easy for the kernel to use the proper inode csum seed.
> So always use the fs.csum_seed for the xattr block csum calculation.
> 
> Cc: Darrick J. Wong <djwong@us.ibm.com>
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> Signed-off-by: Tao Ma <boyu.mt@taobao.com>
> ---
>  lib/ext2fs/csum.c |   18 +++---------------
>  1 files changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c
> index a7096d2..5ccbc1c 100644
> --- a/lib/ext2fs/csum.c
> +++ b/lib/ext2fs/csum.c
> @@ -119,21 +119,9 @@ static errcode_t ext2fs_ext_attr_block_csum(ext2_filsys fs, ext2_ino_t inum,
>  	struct ext2_inode inode;
>  
>  	hdr->h_checksum = 0;
> -	if (ext2fs_le32_to_cpu(hdr->h_refcount) != 1) {
> -		block = ext2fs_cpu_to_le64(block);
> -		*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block,
> -					sizeof(block));
> -	} else {
> -		retval = ext2fs_read_inode(fs, inum, &inode);
> -		if (retval)
> -			return retval;
> -		inum = ext2fs_cpu_to_le32(inum);
> -		gen = ext2fs_cpu_to_le32(inode.i_generation);
> -		*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&inum,
> -					sizeof(inum));
> -		*crc = ext2fs_crc32c_le(*crc, (unsigned char *)&gen,
> -					sizeof(gen));
> -	}
> +	block = ext2fs_cpu_to_le64(block);
> +	*crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block,
> +				sizeof(block));
>  	*crc = ext2fs_crc32c_le(*crc, (unsigned char *)buf, fs->blocksize);
>  	hdr->h_checksum = old_crc;
>  
> 


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

end of thread, other threads:[~2012-09-03  3:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-24 14:22 [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation Tao Ma
2012-07-03 16:58 ` Darrick J. Wong
2012-07-04  1:44   ` Tao Ma
2012-07-04  3:03     ` Darrick J. Wong
2012-09-03  3:15 ` Tao Ma

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.