Skip to content

Commit

Permalink
block: blkdev_issue_secure_erase loop style
Browse files Browse the repository at this point in the history
Use consistent coding style in this file. All the other loops for the
same purpose use "while (nr_sects)", so they win.

Reviewed-by: Ming Lei <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Keith Busch <[email protected]>
Reviewed-by: Chaitanya Kulkarni <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
keithbusch authored and axboe committed Feb 24, 2024
1 parent 03f1212 commit 5affe49
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions block/blk-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ int blkdev_issue_secure_erase(struct block_device *bdev, sector_t sector,
return -EPERM;

blk_start_plug(&plug);
for (;;) {
while (nr_sects) {
unsigned int len = min_t(sector_t, nr_sects, max_sectors);

bio = blk_next_bio(bio, bdev, 0, REQ_OP_SECURE_ERASE, gfp);
Expand All @@ -331,13 +331,12 @@ int blkdev_issue_secure_erase(struct block_device *bdev, sector_t sector,

sector += len;
nr_sects -= len;
if (!nr_sects) {
ret = submit_bio_wait(bio);
bio_put(bio);
break;
}
cond_resched();
}
if (bio) {
ret = submit_bio_wait(bio);
bio_put(bio);
}
blk_finish_plug(&plug);

return ret;
Expand Down

0 comments on commit 5affe49

Please sign in to comment.