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

* [PATCH V5 1/9] block: add a helper function to read nr_setcs
  2019-08-21  6:14 [PATCH V5 0/9] block: use right accessor to read nr_sects Chaitanya Kulkarni
@ 2019-08-21  6:14 ` 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
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 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

This patch introduces helper function to read the number of sectors
from struct block_device->bd_part member. For more details Please refer
to the comment in the include/linux/genhd.h for part_nr_sects_read().

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 include/linux/blkdev.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4798bb25f1ee..aa5801c8ff73 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1468,6 +1468,11 @@ static inline void put_dev_sector(Sector p)
 	put_page(p.v);
 }
 
+static inline sector_t bdev_nr_sects(struct block_device *bdev)
+{
+	return part_nr_sects_read(bdev->bd_part);
+}
+
 int kblockd_schedule_work(struct work_struct *work);
 int kblockd_schedule_work_on(int cpu, struct work_struct *work);
 int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);
-- 
2.17.0


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

* [PATCH V5 2/9] blk-zoned: update blkdev_nr_zones() with helper
  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  6:14 ` Chaitanya Kulkarni
  2019-08-21  6:14 ` [PATCH V5 3/9] blk-zoned: update blkdev_report_zone() " Chaitanya Kulkarni
                   ` (7 subsequent siblings)
  9 siblings, 0 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

This patch updates the blkdev_nr_zones() with newly introduced helper
function to read the nr_sects from block device's hd_parts with the
help if part_nr_sects_read().

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 block/blk-zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 4bc5f260248a..3f5e9bf03486 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -93,7 +93,7 @@ unsigned int blkdev_nr_zones(struct block_device *bdev)
 	if (!blk_queue_is_zoned(q))
 		return 0;
 
-	return __blkdev_nr_zones(q, bdev->bd_part->nr_sects);
+	return __blkdev_nr_zones(q, bdev_nr_sects(bdev));
 }
 EXPORT_SYMBOL_GPL(blkdev_nr_zones);
 
-- 
2.17.0


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

* [PATCH V5 3/9] blk-zoned: update blkdev_report_zone() with helper
  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  6:14 ` [PATCH V5 2/9] blk-zoned: update blkdev_nr_zones() with helper Chaitanya Kulkarni
@ 2019-08-21  6:14 ` Chaitanya Kulkarni
  2019-08-21  6:14 ` [PATCH V5 4/9] blk-zoned: update blkdev_reset_zones() " Chaitanya Kulkarni
                   ` (6 subsequent siblings)
  9 siblings, 0 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

This patch updates the blkdev_report_zone(s)() with newly introduced
helper function to read the nr_sects from block device's hd_parts with
the help of part_nr_sects_read().

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 block/blk-zoned.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 3f5e9bf03486..7e0c0b54d194 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -109,7 +109,7 @@ static bool blkdev_report_zone(struct block_device *bdev, struct blk_zone *rep)
 		return false;
 
 	rep->start -= offset;
-	if (rep->start + rep->len > bdev->bd_part->nr_sects)
+	if (rep->start + rep->len > bdev_nr_sects(bdev))
 		return false;
 
 	if (rep->type == BLK_ZONE_TYPE_CONVENTIONAL)
@@ -178,13 +178,13 @@ int blkdev_report_zones(struct block_device *bdev, sector_t sector,
 	if (WARN_ON_ONCE(!bdev->bd_disk->fops->report_zones))
 		return -EOPNOTSUPP;
 
-	if (!*nr_zones || sector >= bdev->bd_part->nr_sects) {
+	if (!*nr_zones || sector >= bdev_nr_sects(bdev)) {
 		*nr_zones = 0;
 		return 0;
 	}
 
 	nrz = min(*nr_zones,
-		  __blkdev_nr_zones(q, bdev->bd_part->nr_sects - sector));
+		  __blkdev_nr_zones(q, bdev_nr_sects(bdev) - sector));
 	ret = blk_report_zones(bdev->bd_disk, get_start_sect(bdev) + sector,
 			       zones, &nrz);
 	if (ret)
-- 
2.17.0


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

* [PATCH V5 4/9] blk-zoned: update blkdev_reset_zones() with helper
  2019-08-21  6:14 [PATCH V5 0/9] block: use right accessor to read nr_sects Chaitanya Kulkarni
                   ` (2 preceding siblings ...)
  2019-08-21  6:14 ` [PATCH V5 3/9] blk-zoned: update blkdev_report_zone() " Chaitanya Kulkarni
@ 2019-08-21  6:14 ` Chaitanya Kulkarni
  2019-08-21  6:14 ` [PATCH V5 5/9] bcache: update cached_dev_init() " Chaitanya Kulkarni
                   ` (5 subsequent siblings)
  9 siblings, 0 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

This patch updates the blkdev_reset_zones() with newly introduced
helper function to read the nr_sects from block device's hd_parts with
the help of part_nr_sects_read().

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 block/blk-zoned.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 7e0c0b54d194..53f9df376cfb 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -267,7 +267,7 @@ int blkdev_reset_zones(struct block_device *bdev,
 	if (bdev_read_only(bdev))
 		return -EPERM;
 
-	if (!nr_sectors || end_sector > bdev->bd_part->nr_sects)
+	if (!nr_sectors || end_sector > bdev_nr_sects(bdev))
 		/* Out of range */
 		return -EINVAL;
 
@@ -280,7 +280,7 @@ int blkdev_reset_zones(struct block_device *bdev,
 		return -EINVAL;
 
 	if ((nr_sectors & (zone_sectors - 1)) &&
-	    end_sector != bdev->bd_part->nr_sects)
+	    end_sector != bdev_nr_sects(bdev))
 		return -EINVAL;
 
 	blk_start_plug(&plug);
-- 
2.17.0


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

* [PATCH V5 5/9] bcache: update cached_dev_init() with helper
  2019-08-21  6:14 [PATCH V5 0/9] block: use right accessor to read nr_sects Chaitanya Kulkarni
                   ` (3 preceding siblings ...)
  2019-08-21  6:14 ` [PATCH V5 4/9] blk-zoned: update blkdev_reset_zones() " Chaitanya Kulkarni
@ 2019-08-21  6:14 ` Chaitanya Kulkarni
  2019-08-21  6:14 ` [PATCH V5 6/9] f2fs: use helper in init_blkz_info() Chaitanya Kulkarni
                   ` (4 subsequent siblings)
  9 siblings, 0 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

In the bcache when initializing the cached device we don't actually
use any sort of locking when reading the number of sectors from the
part. This patch updates the cached_dev_init() with newly introduced
helper function to read the nr_sects from block device's hd_parts with
the help of part_nr_sects_read().

Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/md/bcache/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 20ed838e9413..79c848fa5912 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1305,7 +1305,7 @@ static int cached_dev_init(struct cached_dev *dc, unsigned int block_size)
 			q->limits.raid_partial_stripes_expensive;
 
 	ret = bcache_device_init(&dc->disk, block_size,
-			 dc->bdev->bd_part->nr_sects - dc->sb.data_offset);
+			 bdev_nr_sects(dc->bdev) - dc->sb.data_offset);
 	if (ret)
 		return ret;
 
-- 
2.17.0


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

* [PATCH V5 6/9] f2fs: use helper in init_blkz_info()
  2019-08-21  6:14 [PATCH V5 0/9] block: use right accessor to read nr_sects Chaitanya Kulkarni
                   ` (4 preceding siblings ...)
  2019-08-21  6:14 ` [PATCH V5 5/9] bcache: update cached_dev_init() " Chaitanya Kulkarni
@ 2019-08-21  6:14 ` Chaitanya Kulkarni
  2019-08-21  6:14 ` [PATCH V5 7/9] blktrace: use helper in blk_trace_setup_lba() Chaitanya Kulkarni
                   ` (3 subsequent siblings)
  9 siblings, 0 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

This patch updates the init_blkz_info() with newly introduced helper
function to read the nr_sects from block device's hd_parts with the
help of part_nr_sects_read().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 78a1b873e48a..78f8f834aa44 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -2775,7 +2775,7 @@ static int init_percpu_info(struct f2fs_sb_info *sbi)
 static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)
 {
 	struct block_device *bdev = FDEV(devi).bdev;
-	sector_t nr_sectors = bdev->bd_part->nr_sects;
+	sector_t nr_sectors = bdev_nr_sects(bdev);
 	sector_t sector = 0;
 	struct blk_zone *zones;
 	unsigned int i, nr_zones;
-- 
2.17.0


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

* [PATCH V5 7/9] blktrace: use helper in blk_trace_setup_lba()
  2019-08-21  6:14 [PATCH V5 0/9] block: use right accessor to read nr_sects Chaitanya Kulkarni
                   ` (5 preceding siblings ...)
  2019-08-21  6:14 ` [PATCH V5 6/9] f2fs: use helper in init_blkz_info() Chaitanya Kulkarni
@ 2019-08-21  6:14 ` Chaitanya Kulkarni
  2019-08-21  6:14 ` [COMPILE TESTED PATCH V5 8/9] target/pscsi: use helper in pscsi_get_blocks() Chaitanya Kulkarni
                   ` (2 subsequent siblings)
  9 siblings, 0 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

This patch updates the blk_trace_setup_lba() with newly introduced
helper function to read the nr_sects from block device's hd_parts with
the help of part_nr_sects_read().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 kernel/trace/blktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 2d6e93ab0478..801f8c465bff 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -461,7 +461,7 @@ static void blk_trace_setup_lba(struct blk_trace *bt,
 
 	if (part) {
 		bt->start_lba = part->start_sect;
-		bt->end_lba = part->start_sect + part->nr_sects;
+		bt->end_lba = part->start_sect + bdev_nr_sects(bdev);
 	} else {
 		bt->start_lba = 0;
 		bt->end_lba = -1ULL;
-- 
2.17.0


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

* [COMPILE TESTED PATCH V5 8/9] target/pscsi: use helper in pscsi_get_blocks()
  2019-08-21  6:14 [PATCH V5 0/9] block: use right accessor to read nr_sects Chaitanya Kulkarni
                   ` (6 preceding siblings ...)
  2019-08-21  6:14 ` [PATCH V5 7/9] blktrace: use helper in blk_trace_setup_lba() Chaitanya Kulkarni
@ 2019-08-21  6:14 ` 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
  9 siblings, 0 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

This patch updates the pscsi_get_blocks() with newly introduced helper
function to read the nr_sects from block device's hd_parts with the
help of part_nr_sects_read().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_pscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index c9d92b3e777d..da481edab2de 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -1030,7 +1030,7 @@ static sector_t pscsi_get_blocks(struct se_device *dev)
 	struct pscsi_dev_virt *pdv = PSCSI_DEV(dev);
 
 	if (pdv->pdv_bd && pdv->pdv_bd->bd_part)
-		return pdv->pdv_bd->bd_part->nr_sects;
+		return bdev_nr_sects(pdv->pdv_bd);
 
 	return 0;
 }
-- 
2.17.0


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

* [COMPILE TESTED PATCH V5 9/9] xen/blkback: use helper in vbd_sz()
  2019-08-21  6:14 [PATCH V5 0/9] block: use right accessor to read nr_sects Chaitanya Kulkarni
                   ` (7 preceding siblings ...)
  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 ` Chaitanya Kulkarni
  2019-08-21 15:20 ` [PATCH V5 0/9] block: use right accessor to read nr_sects Bart Van Assche
  9 siblings, 0 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

This patch updates the vbd_sz() macro with newly introduced helper
function to read the nr_sects from block device's hd_parts with the
help of part_nr_sects_read().

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/block/xen-blkback/common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 1d3002d773f7..f96cb8d1cb99 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -359,7 +359,7 @@ struct pending_req {
 
 
 #define vbd_sz(_v)	((_v)->bdev->bd_part ? \
-			 (_v)->bdev->bd_part->nr_sects : \
+			  bdev_nr_sects((_v)->bdev) : \
 			  get_capacity((_v)->bdev->bd_disk))
 
 #define xen_blkif_get(_b) (atomic_inc(&(_b)->refcnt))
-- 
2.17.0


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

* Re: [PATCH V5 1/9] block: add a helper function to read nr_setcs
  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
  0 siblings, 0 replies; 12+ messages in thread
From: Bart Van Assche @ 2019-08-21 15:18 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-block
  Cc: colyli, linux-bcache, linux-btrace, xen-devel, kent.overstreet,
	yuchao0, jaegeuk, damien.lemoal, konrad.wilk, roger.pau,
	linux-scsi

On 8/20/19 11:14 PM, Chaitanya Kulkarni wrote:
> This patch introduces helper function to read the number of sectors
> from struct block_device->bd_part member. For more details Please refer
> to the comment in the include/linux/genhd.h for part_nr_sects_read().
> 
> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
> Reviewed-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
                                                    ^^^^^^^^^^
This looks weird.


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

* Re: [PATCH V5 0/9] block: use right accessor to read nr_sects
  2019-08-21  6:14 [PATCH V5 0/9] block: use right accessor to read nr_sects Chaitanya Kulkarni
                   ` (8 preceding siblings ...)
  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 ` Bart Van Assche
  9 siblings, 0 replies; 12+ messages in thread
From: Bart Van Assche @ 2019-08-21 15:20 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-block
  Cc: colyli, linux-bcache, linux-btrace, xen-devel, kent.overstreet,
	yuchao0, jaegeuk, damien.lemoal, konrad.wilk, roger.pau,
	linux-scsi

On 8/20/19 11:14 PM, Chaitanya Kulkarni wrote:
> 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.

For the entire series:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

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