Thread (7 messages) 7 messages, 3 authors, 2023-02-21

Re: [PATCH v2] md: Use optimal I/O size for last bitmap page

From: Christoph Hellwig <hch@infradead.org>
Date: 2023-02-21 14:44:51

This becomes prety unreadable with all the long lines.

Can you do a little refactoring, with:

 1) a prep patch that splits out a helper to write the bitmap
    to one device (i.e. the main loop body)
 2) add a helper that returns the optimal I/O sizse in your new
    patch.  Please also use unsigned int instead of plain int for
    the I/O size everywhere as it can't be signed.
 			/* DATA  BITMAP METADATA  */
+			loff_t off = offset + (long)(page->index * (PAGE_SIZE/512));
And all the arithmetics here look ott to say nicely.

page->index is a pgoff_t, and multiplying it could cause overflows
on 32-bit architetures, so you need to cast it to a 64-bit type before
multiplying it.  It also will be unsigned, and I'm not quite sure
if loff_t is the right type for something that is in Linux block
number uints, that would usually be a sector_t.  Last but not least
it should be using SECTOR_SIZe and have whitespaces around the
operators.

I know at least some of this is pre-existing in the coe, but I think
this is a good time to get it right.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help