linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHES][RFC] packing struct block_device flags
@ 2024-04-28  5:12 Al Viro
  2024-04-28  5:14 ` [PATCH 1/8] Use bdev_is_paritition() instead of open-coding it Al Viro
                   ` (8 more replies)
  0 siblings, 9 replies; 24+ messages in thread
From: Al Viro @ 2024-04-28  5:12 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Yu Kuai, linux-block, Christian Brauner, Christoph Hellwig,
	Jens Axboe

	We have several bool members in struct block_device.
It would be nice to pack that stuff, preferably without
blowing the cacheline boundaries.

	That had been suggested a while ago, and initial
implementation by Yu Kuai <yukuai1@huaweicloud.com> ran into
objections re atomicity, along with the obvious suggestion to
use unsigned long and test_bit/set_bit/clear_bit for access.
Unfortunately, that *does* blow the cacheline boundaries.

	However, it's not hard to do that without bitops;
we have an 8-bit assign-once partition number nearby, and
folding it into a 32-bit member leaves us up to 24 bits for
flags.  Using cmpxchg for setting/clearing flags is not
hard, and 32bit cmpxchg is supported everywhere.

	Series below does that conversion.  Please, review.
Individual patches in followups, the branch is in
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git #work.bd_flags

Shortlog:
Al Viro (8):
      Use bdev_is_paritition() instead of open-coding it
      wrapper for access to ->bd_partno
      bdev: infrastructure for flags
      bdev: move ->bd_read_only to ->__bd_flags
      bdev: move ->bd_write_holder into ->__bd_flags
      bdev: move ->bd_has_subit_bio to ->__bd_flags
      bdev: move ->bd_ro_warned to ->__bd_flags
      bdev: move ->bd_make_it_fail to ->__bd_flags

Diffstat:
 block/bdev.c              | 17 ++++++++---------
 block/blk-core.c          | 17 ++++++++++-------
 block/blk-mq.c            |  2 +-
 block/early-lookup.c      |  2 +-
 block/genhd.c             | 15 ++++++++++-----
 block/ioctl.c             |  5 ++++-
 block/partitions/core.c   | 12 ++++++------
 include/linux/blk_types.h | 19 +++++++++++--------
 include/linux/blkdev.h    | 42 +++++++++++++++++++++++++++++++++++++++---
 include/linux/part_stat.h |  2 +-
 lib/vsprintf.c            |  4 ++--
 11 files changed, 93 insertions(+), 44 deletions(-)

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

end of thread, other threads:[~2024-05-03  0:11 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-28  5:12 [PATCHES][RFC] packing struct block_device flags Al Viro
2024-04-28  5:14 ` [PATCH 1/8] Use bdev_is_paritition() instead of open-coding it Al Viro
2024-04-29  5:19   ` Christoph Hellwig
2024-04-28  5:15 ` [PATCH 2/8] wrapper for access to ->bd_partno Al Viro
2024-04-28  5:16 ` [PATCH 3/8] bdev: infrastructure for flags Al Viro
2024-04-28  5:17 ` [PATCH 4/8] bdev: move ->bd_read_only to ->__bd_flags Al Viro
2024-04-28  5:18 ` [PATCH 5/8] bdev: move ->bd_write_holder into ->__bd_flags Al Viro
2024-04-28  5:19 ` [PATCH 6/8] bdev: move ->bd_has_subit_bio to ->__bd_flags Al Viro
2024-04-28  5:19 ` [PATCH 7/8] bdev: move ->bd_ro_warned " Al Viro
2024-04-28  5:21 ` [PATCH 8/8] bdev: move ->bd_make_it_fail " Al Viro
2024-04-29  5:23 ` [PATCHES][RFC] packing struct block_device flags Christoph Hellwig
2024-04-29  7:31   ` Al Viro
2024-04-29 17:02     ` Al Viro
2024-04-29 18:13       ` Al Viro
2024-04-29 18:30         ` Al Viro
2024-05-03  0:06           ` Al Viro
2024-05-03  0:07             ` [PATCH 1/8] Use bdev_is_paritition() instead of open-coding it Al Viro
2024-05-03  0:07             ` [PATCH 2/8] wrapper for access to ->bd_partno Al Viro
2024-05-03  0:08             ` [PATCH v2 3/8] bdev: infrastructure for flags Al Viro
2024-05-03  0:09             ` [PATCH v2 4/8] bdev: move ->bd_read_only to ->__bd_flags Al Viro
2024-05-03  0:09             ` [PATCH v2 5/8] bdev: move ->bd_write_holder into ->__bd_flags Al Viro
2024-05-03  0:10             ` [PATCH v2 6/8] bdev: move ->bd_has_subit_bio to ->__bd_flags Al Viro
2024-05-03  0:10             ` [PATCH v2 7/8] bdev: move ->bd_ro_warned " Al Viro
2024-05-03  0:11             ` [PATCH v2 8/8] bdev: move ->bd_make_it_fail " Al Viro

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).