Thread (11 messages) 11 messages, 2 authors, 2019-08-01

Re: [PATCH 2/4] blk-zoned: implement REQ_OP_ZONE_RESET_ALL

From: Damien Le Moal <hidden>
Date: 2019-08-01 08:40:05

On 2019/08/01 13:51, Chaitanya Kulkarni wrote:>>> +/*
quoted
quoted
+ * 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help