On 2019/08/01 13:51, Chaitanya Kulkarni wrote:>>> +/*
>>> + * Special case of zone reset operation to reset all zones in one command,
>>> + * useful for applications like mkfs.
>>> + */
>>> +static int __blkdev_reset_all_zones(struct block_device *bdev, gfp_t
>>> gfp_mask)
>>> +{
>>> + struct bio *bio = NULL;
>>
>> There is no need to initialize the bio to NULL here.
>
> [CK] Would you prefer something like following that declares and allocate in
> one line which is similar in blk-lib.c:-blk_next_bio() function ? or we
> should keep declaration and allocation on the different line :-
Whichever is fine with me.
> /*
> * Special case of zone reset operation to reset all zones in one command,
> * useful for applications like mkfs.
> */
> static int __blkdev_reset_all_zones(struct block_device *bdev, gfp_t gfp_mask)
> {
> struct bio *bio = bio_alloc(gfp_mask, 0);
> int ret;
>
>
> /* across the zones operations, don't need any sectors */
May be change this comment to something less cryptic, e.g.:
/* For REQ_OP_ZONE_RESET_ALL, BIO sector and size are not needed */
> bio_set_dev(bio, bdev);
> bio_set_op_attrs(bio, REQ_OP_ZONE_RESET_ALL, 0);
>
> ret = submit_bio_wait(bio);
> bio_put(bio);
>
> return ret;
> }
--
Damien Le Moal
Western Digital Research