Skip to content

Commit e352bd7

Browse files
committed
2 parents 4906ef3 + 14380d1 commit e352bd7

File tree

5 files changed

+25
-18
lines changed

5 files changed

+25
-18
lines changed

block/bfq-iosched.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6844,16 +6844,24 @@ static struct bfq_queue *bfq_waker_bfqq(struct bfq_queue *bfqq)
68446844
if (new_bfqq == waker_bfqq) {
68456845
/*
68466846
* If waker_bfqq is in the merge chain, and current
6847-
* is the only procress.
6847+
* is the only process, waker_bfqq can be freed.
68486848
*/
68496849
if (bfqq_process_refs(waker_bfqq) == 1)
68506850
return NULL;
6851-
break;
6851+
6852+
return waker_bfqq;
68526853
}
68536854

68546855
new_bfqq = new_bfqq->new_bfqq;
68556856
}
68566857

6858+
/*
6859+
* If waker_bfqq is not in the merge chain, and it's procress reference
6860+
* is 0, waker_bfqq can be freed.
6861+
*/
6862+
if (bfqq_process_refs(waker_bfqq) == 0)
6863+
return NULL;
6864+
68576865
return waker_bfqq;
68586866
}
68596867

block/blk-cgroup.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,10 +1325,14 @@ void blkcg_unpin_online(struct cgroup_subsys_state *blkcg_css)
13251325
struct blkcg *blkcg = css_to_blkcg(blkcg_css);
13261326

13271327
do {
1328+
struct blkcg *parent;
1329+
13281330
if (!refcount_dec_and_test(&blkcg->online_pin))
13291331
break;
1332+
1333+
parent = blkcg_parent(blkcg);
13301334
blkcg_destroy_blkgs(blkcg);
1331-
blkcg = blkcg_parent(blkcg);
1335+
blkcg = parent;
13321336
} while (blkcg);
13331337
}
13341338

block/blk-sysfs.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -800,10 +800,8 @@ int blk_register_queue(struct gendisk *disk)
800800
* faster to shut down and is made fully functional here as
801801
* request_queues for non-existent devices never get registered.
802802
*/
803-
if (!blk_queue_init_done(q)) {
804-
blk_queue_flag_set(QUEUE_FLAG_INIT_DONE, q);
805-
percpu_ref_switch_to_percpu(&q->q_usage_counter);
806-
}
803+
blk_queue_flag_set(QUEUE_FLAG_INIT_DONE, q);
804+
percpu_ref_switch_to_percpu(&q->q_usage_counter);
807805

808806
return ret;
809807

block/genhd.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -706,13 +706,10 @@ void del_gendisk(struct gendisk *disk)
706706
* If the disk does not own the queue, allow using passthrough requests
707707
* again. Else leave the queue frozen to fail all I/O.
708708
*/
709-
if (!test_bit(GD_OWNS_QUEUE, &disk->state)) {
710-
blk_queue_flag_clear(QUEUE_FLAG_INIT_DONE, q);
709+
if (!test_bit(GD_OWNS_QUEUE, &disk->state))
711710
__blk_mq_unfreeze_queue(q, true);
712-
} else {
713-
if (queue_is_mq(q))
714-
blk_mq_exit_queue(q);
715-
}
711+
else if (queue_is_mq(q))
712+
blk_mq_exit_queue(q);
716713
}
717714
EXPORT_SYMBOL(del_gendisk);
718715

drivers/block/zram/zram_drv.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,12 +1223,16 @@ static void zram_meta_free(struct zram *zram, u64 disksize)
12231223
size_t num_pages = disksize >> PAGE_SHIFT;
12241224
size_t index;
12251225

1226+
if (!zram->table)
1227+
return;
1228+
12261229
/* Free all pages that are still in this zram device */
12271230
for (index = 0; index < num_pages; index++)
12281231
zram_free_page(zram, index);
12291232

12301233
zs_destroy_pool(zram->mem_pool);
12311234
vfree(zram->table);
1235+
zram->table = NULL;
12321236
}
12331237

12341238
static bool zram_meta_alloc(struct zram *zram, u64 disksize)
@@ -1243,6 +1247,7 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize)
12431247
zram->mem_pool = zs_create_pool(zram->disk->disk_name);
12441248
if (!zram->mem_pool) {
12451249
vfree(zram->table);
1250+
zram->table = NULL;
12461251
return false;
12471252
}
12481253

@@ -2002,11 +2007,6 @@ static void zram_reset_device(struct zram *zram)
20022007

20032008
zram->limit_pages = 0;
20042009

2005-
if (!init_done(zram)) {
2006-
up_write(&zram->init_lock);
2007-
return;
2008-
}
2009-
20102010
set_capacity_and_notify(zram->disk, 0);
20112011
part_stat_set_all(zram->disk->part0, 0);
20122012

0 commit comments

Comments
 (0)