Message ID | 1544739929-21651-2-git-send-email-sandeen@sandeen.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | iomap: 1 cleanup, 1 fix, 1 optimization | expand |
On Thu, Dec 13, 2018 at 04:25:27PM -0600, Eric Sandeen wrote: > From: Eric Sandeen <sandeen@redhat.com> > > because iomap_page_create initializes the uptodate bitmap using the macro, > not the open-coded value. I find the use of SECTOR_SIZE rather confusing, especially as often the sector size might actually be something else. It also forces us to pull in another huge header file.
On 12/15/18 4:51 AM, Christoph Hellwig wrote: > On Thu, Dec 13, 2018 at 04:25:27PM -0600, Eric Sandeen wrote: >> From: Eric Sandeen <sandeen@redhat.com> >> >> because iomap_page_create initializes the uptodate bitmap using the macro, >> not the open-coded value. > > I find the use of SECTOR_SIZE rather confusing, especially as often > the sector size might actually be something else. It also forces > us to pull in another huge header file. Then we should hard code "512" in iomap_page_create I guess. Just need consistency. -Eric
On Mon, Dec 17, 2018 at 05:45:10PM -0600, Eric Sandeen wrote: > Then we should hard code "512" in iomap_page_create I guess. Just need > consistency. Fine with me.
On Tue, Dec 18, 2018 at 07:06:17PM +0100, Christoph Hellwig wrote: > On Mon, Dec 17, 2018 at 05:45:10PM -0600, Eric Sandeen wrote: > > Then we should hard code "512" in iomap_page_create I guess. Just need > > consistency. > > Fine with me. Please don't just hardcode 512 here. AFAICT the usage in iomap.c seems to be "minimum expected fs block size" so that the iop's uptodate bitmap is sized to handle the worst case blocks-per-page. Can we please have a "#define IOMAP_MIN_FS_BLOCKSIZE SECTOR_SIZE" to capture the intent behind the 512? Or, if you don't want to require all includers of iomap.h to also have to include blkdev.h, define it to 512 and have a BUILD_BUG_ON somewhere so that we don't leave a subtle bug if we ever change SECTOR_SIZE? --D
On 12/18/18 12:19 PM, Darrick J. Wong wrote: > On Tue, Dec 18, 2018 at 07:06:17PM +0100, Christoph Hellwig wrote: >> On Mon, Dec 17, 2018 at 05:45:10PM -0600, Eric Sandeen wrote: >>> Then we should hard code "512" in iomap_page_create I guess. Just need >>> consistency. >> >> Fine with me. > > Please don't just hardcode 512 here. AFAICT the usage in iomap.c seems > to be "minimum expected fs block size" so that the iop's uptodate bitmap > is sized to handle the worst case blocks-per-page. > > Can we please have a "#define IOMAP_MIN_FS_BLOCKSIZE SECTOR_SIZE" to > capture the intent behind the 512? Or, if you don't want to require all > includers of iomap.h to also have to include blkdev.h, define it to 512 > and have a BUILD_BUG_ON somewhere so that we don't leave a subtle bug if > we ever change SECTOR_SIZE? Right, seems like something needs to tie this into the rest of reality and not just blaze past it if we somehow ever encounter a block size < 512. -Eric
diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 9a42581..edcdb3a 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -4,6 +4,7 @@ #include <linux/atomic.h> #include <linux/bitmap.h> +#include <linux/blkdev.h> #include <linux/mm.h> #include <linux/types.h> #include <linux/mm_types.h> @@ -104,12 +105,13 @@ struct iomap_ops { /* * Structure allocate for each page when block size < PAGE_SIZE to track - * sub-page uptodate status and I/O completions. + * sub-page uptodate status and I/O completions. Allocate bitmap to + * accomodate blocks as small as SECTOR_SIZE */ struct iomap_page { atomic_t read_count; atomic_t write_count; - DECLARE_BITMAP(uptodate, PAGE_SIZE / 512); + DECLARE_BITMAP(uptodate, PAGE_SIZE / SECTOR_SIZE); }; static inline struct iomap_page *to_iomap_page(struct page *page)