[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] block: refactor duplicated macros
On Wed, Mar 4, 2020 at 9:57 PM Dan Williams <dan.j.williams@xxxxxxxxx> wrote: > > On Sun, Feb 23, 2020 at 9:04 AM Matteo Croce <mcroce@xxxxxxxxxx> wrote: > > > > The macros PAGE_SECTORS, PAGE_SECTORS_SHIFT and SECTOR_MASK are defined > > several times in different flavours across the whole tree. > > Define them just once in a common header. > > > > Signed-off-by: Matteo Croce <mcroce@xxxxxxxxxx> > > --- > > block/blk-lib.c | 2 +- > > drivers/block/brd.c | 3 --- > > drivers/block/null_blk_main.c | 4 ---- > > drivers/block/zram/zram_drv.c | 8 ++++---- > > drivers/block/zram/zram_drv.h | 2 -- > > drivers/dax/super.c | 2 +- > > For the dax change: > > Acked-by: Dan Williams <dan.j.williams@xxxxxxxxx> > > However... > > [..] > > include/linux/blkdev.h | 4 ++++ > [..] > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > > index 053ea4b51988..b3c9be6906a0 100644 > > --- a/include/linux/blkdev.h > > +++ b/include/linux/blkdev.h > > @@ -910,6 +910,10 @@ static inline struct request_queue > > *bdev_get_queue(struct block_device *bdev) > > #define SECTOR_SIZE (1 << SECTOR_SHIFT) > > #endif > > > > +#define PAGE_SECTORS_SHIFT (PAGE_SHIFT - SECTOR_SHIFT) > > +#define PAGE_SECTORS (1 << PAGE_SECTORS_SHIFT) > > +#define SECTOR_MASK (PAGE_SECTORS - 1) > > + > > ...I think SECTOR_MASK is misnamed given it considers pages, and > should probably match the polarity of PAGE_MASK, i.e. > > #define PAGE_SECTORS_MASK (~(PAGE_SECTORS - 1)) > Makes sense. I just kept the same value as in drivers/block/null_blk_main.c -- Matteo Croce per aspera ad upstream _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |