linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] md superblock write alignment on 512e devices
@ 2020-10-29 20:13 Christopher Unkel
  2020-10-29 20:13 ` [PATCH v2 1/3] md: factor out repeated sb alignment logic Christopher Unkel
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Christopher Unkel @ 2020-10-29 20:13 UTC (permalink / raw)
  To: linux-raid, Song Liu, Christoph Hellwig; +Cc: linux-kernel, Christopher Unkel

Hello,

Thanks for the feedback on the previous patch series.

A updated patch series with the same function as the first patch
(https://lkml.org/lkml/2020/10/22/1058 "md: align superblock writes to
physical blocks") follows.

As suggested, it introduces a helper function, which can be used to
reduce some code duplication.  It handles the case in super_1_sync()
where the superblock is extended by the addition of new component
devices.

I think it also fixes a bug where the existing code in super_1_load()
ought to be rejecting the array with EINVAL: if the superblock padded
out to the *logical* block length runs into the bitmap.  For example, if
the bitmap offset is 2 (bitmap 1K after superblock) and the logical
block size is 4K, the superblock padded out to 4K runs into the bitmap.
This case may be unusual (perhaps only happens if the array is created
on a 512n device and then raw contents are copied onto a 4kn device) but
I think it is possible.

With respect to the option of simply replacing
queue_logical_block_size() with queue_physical_block_size(), I think
this can result in the code rejecting devices that can be loaded, but
for which the physical block alignment can't be respected--the longer
padded size would trigger the EINVAL cases testing against
data_offset/new_data_offset.  I think it's better to proceed in such
cases, just with unaligned superblock writes as would presently happen.
Also if I'm right about the above bug, then I think this subsitution
would be more likely to trigger it.

Thanks,

  --Chris


Christopher Unkel (3):
  md: factor out repeated sb alignment logic
  md: align superblock writes to physical blocks
  md: reuse sb length-checking logic

 drivers/md/md.c | 69 +++++++++++++++++++++++++++++++++++++------------
 1 file changed, 52 insertions(+), 17 deletions(-)

-- 
2.17.1


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

end of thread, other threads:[~2020-11-05  3:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 20:13 [PATCH v2 0/3] md superblock write alignment on 512e devices Christopher Unkel
2020-10-29 20:13 ` [PATCH v2 1/3] md: factor out repeated sb alignment logic Christopher Unkel
2020-10-29 20:13 ` [PATCH 2/3] md: align superblock writes to physical blocks Christopher Unkel
2020-11-02  8:02   ` Xiao Ni
2020-10-29 20:13 ` [PATCH 3/3] md: reuse sb length-checking logic Christopher Unkel
2020-11-02  7:42 ` [PATCH v2 0/3] md superblock write alignment on 512e devices Xiao Ni
2020-11-03 20:12   ` Chris Unkel
2020-11-05  3:29     ` Xiao Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).