linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V5 0/9] block: use right accessor to read nr_sects
@ 2019-08-21  6:14 Chaitanya Kulkarni
  2019-08-21  6:14 ` [PATCH V5 1/9] block: add a helper function to read nr_setcs Chaitanya Kulkarni
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Chaitanya Kulkarni @ 2019-08-21  6:14 UTC (permalink / raw)
  To: linux-block
  Cc: colyli, linux-bcache, linux-btrace, xen-devel, kent.overstreet,
	yuchao0, jaegeuk, damien.lemoal, konrad.wilk, roger.pau,
	bvanassche, linux-scsi, Chaitanya Kulkarni

Hi,

In the blk-zoned, bcache, f2fs, target-pscsi, xen and blktrace
implementation block device->hd_part->number of sectors field is
accessed directly without any appropriate locking or accessor function. 
There is an existing accessor function present in the in 
include/linux/genhd.h which should be used to read the
bdev->hd_part->nr_sects.

From ${KERN_DIR}/include/linux/genhd.h:-
<snip>
714 /*
715  * Any access of part->nr_sects which is not protected by partition
716  * bd_mutex or gendisk bdev bd_mutex, should be done using this
717  * accessor function.
718  *
719  * Code written along the lines of i_size_read() and i_size_write().
720  * CONFIG_PREEMPT case optimizes the case of UP kernel with preemption
721  * on.
722  */
723 static inline sector_t part_nr_sects_read(struct hd_struct *part)
724 {
<snip>

This patch series introduces a helper function on the top of the
part_nr_sects_read() and removes the all direct accesses to the
bdev->hd_part->nr_sects.

This series is based on :-

1. Repo :-
   git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git.
2. Branch :- for-next.

Changes from V4:-

1. Adjust code for latest branch.

Chaitanya Kulkarni (9):
  block: add a helper function to read nr_setcs
  blk-zoned: update blkdev_nr_zones() with helper
  blk-zoned: update blkdev_report_zone() with helper
  blk-zoned: update blkdev_reset_zones() with helper
  bcache: update cached_dev_init() with helper
  f2fs: use helper in init_blkz_info()
  blktrace: use helper in blk_trace_setup_lba()
  target/pscsi: use helper in pscsi_get_blocks()
  xen/blkback: use helper in vbd_sz()

 block/blk-zoned.c                  | 12 ++++++------
 drivers/block/xen-blkback/common.h |  2 +-
 drivers/md/bcache/super.c          |  2 +-
 drivers/target/target_core_pscsi.c |  2 +-
 fs/f2fs/super.c                    |  2 +-
 include/linux/blkdev.h             |  5 +++++
 kernel/trace/blktrace.c            |  2 +-
 7 files changed, 16 insertions(+), 11 deletions(-)

-- 
2.17.0


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

end of thread, other threads:[~2019-08-21 15:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-21  6:14 [PATCH V5 0/9] block: use right accessor to read nr_sects Chaitanya Kulkarni
2019-08-21  6:14 ` [PATCH V5 1/9] block: add a helper function to read nr_setcs Chaitanya Kulkarni
2019-08-21 15:18   ` Bart Van Assche
2019-08-21  6:14 ` [PATCH V5 2/9] blk-zoned: update blkdev_nr_zones() with helper Chaitanya Kulkarni
2019-08-21  6:14 ` [PATCH V5 3/9] blk-zoned: update blkdev_report_zone() " Chaitanya Kulkarni
2019-08-21  6:14 ` [PATCH V5 4/9] blk-zoned: update blkdev_reset_zones() " Chaitanya Kulkarni
2019-08-21  6:14 ` [PATCH V5 5/9] bcache: update cached_dev_init() " Chaitanya Kulkarni
2019-08-21  6:14 ` [PATCH V5 6/9] f2fs: use helper in init_blkz_info() Chaitanya Kulkarni
2019-08-21  6:14 ` [PATCH V5 7/9] blktrace: use helper in blk_trace_setup_lba() Chaitanya Kulkarni
2019-08-21  6:14 ` [COMPILE TESTED PATCH V5 8/9] target/pscsi: use helper in pscsi_get_blocks() Chaitanya Kulkarni
2019-08-21  6:14 ` [COMPILE TESTED PATCH V5 9/9] xen/blkback: use helper in vbd_sz() Chaitanya Kulkarni
2019-08-21 15:20 ` [PATCH V5 0/9] block: use right accessor to read nr_sects Bart Van Assche

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