All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] quota: swapping s_prj_quota_inum superblock field
@ 2017-12-13 12:20 Artem Blagodarenko
  2017-12-13 23:46 ` Andreas Dilger
  0 siblings, 1 reply; 2+ messages in thread
From: Artem Blagodarenko @ 2017-12-13 12:20 UTC (permalink / raw)
  To: linux-ext4; +Cc: adilger.kernel

ext2fs_swap_super() swaps s_usr_quota_inum and
s_grp_quota_inum fields but not s_prj_quota_inum.

This patch adds s_prj_quota_inum swapping.

Lustre-bug: https://jira.hpdd.intel.com/browse/LU-9309
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>`
---
 lib/ext2fs/swapfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index b9d8f557..c1da8509 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -79,6 +79,7 @@ void ext2fs_swap_super(struct ext2_super_block * sb)
 	sb->s_snapshot_r_blocks_count =
 		ext2fs_swab64(sb->s_snapshot_r_blocks_count);
 	sb->s_snapshot_list = ext2fs_swab32(sb->s_snapshot_list);
+	sb->s_prj_quota_inum = ext2fs_swab32(sb->s_prj_quota_inum);
 	sb->s_usr_quota_inum = ext2fs_swab32(sb->s_usr_quota_inum);
 	sb->s_grp_quota_inum = ext2fs_swab32(sb->s_grp_quota_inum);
 	sb->s_overhead_blocks = ext2fs_swab32(sb->s_overhead_blocks);
-- 
2.14.3 (Apple Git-98)

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

* Re: [PATCH] quota: swapping s_prj_quota_inum superblock field
  2017-12-13 12:20 [PATCH] quota: swapping s_prj_quota_inum superblock field Artem Blagodarenko
@ 2017-12-13 23:46 ` Andreas Dilger
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Dilger @ 2017-12-13 23:46 UTC (permalink / raw)
  To: Artem Blagodarenko; +Cc: linux-ext4, Wang Shilong

[-- Attachment #1: Type: text/plain, Size: 1891 bytes --]


> On Dec 13, 2017, at 5:20 AM, Artem Blagodarenko <artem.blagodarenko@gmail.com> wrote:
> 
> ext2fs_swap_super() swaps s_usr_quota_inum and
> s_grp_quota_inum fields but not s_prj_quota_inum.
> 
> This patch adds s_prj_quota_inum swapping.
> 
> Lustre-bug: https://jira.hpdd.intel.com/browse/LU-9309
> Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>

I was going to give this a Reviewed-by: but two things bothered me:
- the swabbing should be done in field declaration order, so that it
  is easier to see that all of the fields have been handled properly
- looking to see what other fields might not have proper swabbing, it
  turns out there are several other fields that are not being swabbed:

  s_raid_stride, s_raid_stripe_width, s_{first,last}_error_*, s_lpf_ino

So instead of this one-line fix I'm going to push a patch that fixes all
of these in a consistent manner, and adds some build-time checking to
ext2fs_swap_super(), ext2fs_swap_group_desc2() and ext2fs_swap_inode_large()
to try and catch future cases where we are not adding swabbing.

Cheers, Andreas

> ---
> lib/ext2fs/swapfs.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
> index b9d8f557..c1da8509 100644
> --- a/lib/ext2fs/swapfs.c
> +++ b/lib/ext2fs/swapfs.c
> @@ -79,6 +79,7 @@ void ext2fs_swap_super(struct ext2_super_block * sb)
> 	sb->s_snapshot_r_blocks_count =
> 		ext2fs_swab64(sb->s_snapshot_r_blocks_count);
> 	sb->s_snapshot_list = ext2fs_swab32(sb->s_snapshot_list);
> +	sb->s_prj_quota_inum = ext2fs_swab32(sb->s_prj_quota_inum);
> 	sb->s_usr_quota_inum = ext2fs_swab32(sb->s_usr_quota_inum);
> 	sb->s_grp_quota_inum = ext2fs_swab32(sb->s_grp_quota_inum);
> 	sb->s_overhead_blocks = ext2fs_swab32(sb->s_overhead_blocks);
> --
> 2.14.3 (Apple Git-98)
> 


Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

end of thread, other threads:[~2017-12-13 23:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-13 12:20 [PATCH] quota: swapping s_prj_quota_inum superblock field Artem Blagodarenko
2017-12-13 23:46 ` Andreas Dilger

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.