zrc 58 drivers/md/dm-zoned-reclaim.c static int dmz_reclaim_align_wp(struct dmz_reclaim *zrc, struct dm_zone *zone, zrc 61 drivers/md/dm-zoned-reclaim.c struct dmz_metadata *zmd = zrc->metadata; zrc 77 drivers/md/dm-zoned-reclaim.c ret = blkdev_issue_zeroout(zrc->dev->bdev, zrc 81 drivers/md/dm-zoned-reclaim.c dmz_dev_err(zrc->dev, zrc 85 drivers/md/dm-zoned-reclaim.c dmz_check_bdev(zrc->dev); zrc 100 drivers/md/dm-zoned-reclaim.c struct dmz_reclaim *zrc = context; zrc 103 drivers/md/dm-zoned-reclaim.c zrc->kc_err = -EIO; zrc 105 drivers/md/dm-zoned-reclaim.c zrc->kc_err = 0; zrc 107 drivers/md/dm-zoned-reclaim.c clear_bit_unlock(DMZ_RECLAIM_KCOPY, &zrc->flags); zrc 109 drivers/md/dm-zoned-reclaim.c wake_up_bit(&zrc->flags, DMZ_RECLAIM_KCOPY); zrc 115 drivers/md/dm-zoned-reclaim.c static int dmz_reclaim_copy(struct dmz_reclaim *zrc, zrc 118 drivers/md/dm-zoned-reclaim.c struct dmz_metadata *zmd = zrc->metadata; zrc 119 drivers/md/dm-zoned-reclaim.c struct dmz_dev *dev = zrc->dev; zrc 154 drivers/md/dm-zoned-reclaim.c ret = dmz_reclaim_align_wp(zrc, dst_zone, block); zrc 168 drivers/md/dm-zoned-reclaim.c set_bit(DMZ_RECLAIM_KCOPY, &zrc->flags); zrc 169 drivers/md/dm-zoned-reclaim.c dm_kcopyd_copy(zrc->kc, &src, 1, &dst, flags, zrc 170 drivers/md/dm-zoned-reclaim.c dmz_reclaim_kcopy_end, zrc); zrc 173 drivers/md/dm-zoned-reclaim.c wait_on_bit_io(&zrc->flags, DMZ_RECLAIM_KCOPY, zrc 175 drivers/md/dm-zoned-reclaim.c if (zrc->kc_err) zrc 176 drivers/md/dm-zoned-reclaim.c return zrc->kc_err; zrc 190 drivers/md/dm-zoned-reclaim.c static int dmz_reclaim_buf(struct dmz_reclaim *zrc, struct dm_zone *dzone) zrc 194 drivers/md/dm-zoned-reclaim.c struct dmz_metadata *zmd = zrc->metadata; zrc 197 drivers/md/dm-zoned-reclaim.c dmz_dev_debug(zrc->dev, zrc 203 drivers/md/dm-zoned-reclaim.c ret = dmz_reclaim_copy(zrc, bzone, dzone); zrc 213 drivers/md/dm-zoned-reclaim.c dmz_invalidate_blocks(zmd, bzone, 0, zrc->dev->zone_nr_blocks); zrc 229 drivers/md/dm-zoned-reclaim.c static int dmz_reclaim_seq_data(struct dmz_reclaim *zrc, struct dm_zone *dzone) zrc 233 drivers/md/dm-zoned-reclaim.c struct dmz_metadata *zmd = zrc->metadata; zrc 236 drivers/md/dm-zoned-reclaim.c dmz_dev_debug(zrc->dev, zrc 242 drivers/md/dm-zoned-reclaim.c ret = dmz_reclaim_copy(zrc, dzone, bzone); zrc 255 drivers/md/dm-zoned-reclaim.c dmz_invalidate_blocks(zmd, dzone, 0, zrc->dev->zone_nr_blocks); zrc 274 drivers/md/dm-zoned-reclaim.c static int dmz_reclaim_rnd_data(struct dmz_reclaim *zrc, struct dm_zone *dzone) zrc 278 drivers/md/dm-zoned-reclaim.c struct dmz_metadata *zmd = zrc->metadata; zrc 288 drivers/md/dm-zoned-reclaim.c dmz_dev_debug(zrc->dev, zrc 294 drivers/md/dm-zoned-reclaim.c ret = dmz_reclaim_copy(zrc, dzone, szone); zrc 309 drivers/md/dm-zoned-reclaim.c dmz_invalidate_blocks(zmd, dzone, 0, zrc->dev->zone_nr_blocks); zrc 326 drivers/md/dm-zoned-reclaim.c static void dmz_reclaim_empty(struct dmz_reclaim *zrc, struct dm_zone *dzone) zrc 328 drivers/md/dm-zoned-reclaim.c struct dmz_metadata *zmd = zrc->metadata; zrc 342 drivers/md/dm-zoned-reclaim.c static int dmz_do_reclaim(struct dmz_reclaim *zrc) zrc 344 drivers/md/dm-zoned-reclaim.c struct dmz_metadata *zmd = zrc->metadata; zrc 360 drivers/md/dm-zoned-reclaim.c dmz_reclaim_empty(zrc, dzone); zrc 367 drivers/md/dm-zoned-reclaim.c ret = dmz_reclaim_rnd_data(zrc, dzone); zrc 384 drivers/md/dm-zoned-reclaim.c ret = dmz_reclaim_buf(zrc, dzone); zrc 392 drivers/md/dm-zoned-reclaim.c ret = dmz_reclaim_seq_data(zrc, dzone); zrc 402 drivers/md/dm-zoned-reclaim.c ret = dmz_flush_metadata(zrc->metadata); zrc 404 drivers/md/dm-zoned-reclaim.c dmz_dev_debug(zrc->dev, zrc 410 drivers/md/dm-zoned-reclaim.c dmz_dev_debug(zrc->dev, "Reclaimed zone %u in %u ms", zrc 418 drivers/md/dm-zoned-reclaim.c static inline int dmz_target_idle(struct dmz_reclaim *zrc) zrc 420 drivers/md/dm-zoned-reclaim.c return time_is_before_jiffies(zrc->atime + DMZ_IDLE_PERIOD); zrc 426 drivers/md/dm-zoned-reclaim.c static bool dmz_should_reclaim(struct dmz_reclaim *zrc) zrc 428 drivers/md/dm-zoned-reclaim.c struct dmz_metadata *zmd = zrc->metadata; zrc 434 drivers/md/dm-zoned-reclaim.c if (dmz_target_idle(zrc) && nr_unmap_rnd < nr_rnd) zrc 453 drivers/md/dm-zoned-reclaim.c struct dmz_reclaim *zrc = container_of(work, struct dmz_reclaim, work.work); zrc 454 drivers/md/dm-zoned-reclaim.c struct dmz_metadata *zmd = zrc->metadata; zrc 459 drivers/md/dm-zoned-reclaim.c if (dmz_bdev_is_dying(zrc->dev)) zrc 462 drivers/md/dm-zoned-reclaim.c if (!dmz_should_reclaim(zrc)) { zrc 463 drivers/md/dm-zoned-reclaim.c mod_delayed_work(zrc->wq, &zrc->work, DMZ_IDLE_PERIOD); zrc 476 drivers/md/dm-zoned-reclaim.c if (dmz_target_idle(zrc) || p_unmap_rnd < DMZ_RECLAIM_LOW_UNMAP_RND / 2) { zrc 478 drivers/md/dm-zoned-reclaim.c zrc->kc_throttle.throttle = 100; zrc 481 drivers/md/dm-zoned-reclaim.c zrc->kc_throttle.throttle = min(75U, 100U - p_unmap_rnd / 2); zrc 484 drivers/md/dm-zoned-reclaim.c dmz_dev_debug(zrc->dev, zrc 486 drivers/md/dm-zoned-reclaim.c zrc->kc_throttle.throttle, zrc 487 drivers/md/dm-zoned-reclaim.c (dmz_target_idle(zrc) ? "Idle" : "Busy"), zrc 490 drivers/md/dm-zoned-reclaim.c ret = dmz_do_reclaim(zrc); zrc 492 drivers/md/dm-zoned-reclaim.c dmz_dev_debug(zrc->dev, "Reclaim error %d\n", ret); zrc 493 drivers/md/dm-zoned-reclaim.c if (!dmz_check_bdev(zrc->dev)) zrc 497 drivers/md/dm-zoned-reclaim.c dmz_schedule_reclaim(zrc); zrc 506 drivers/md/dm-zoned-reclaim.c struct dmz_reclaim *zrc; zrc 509 drivers/md/dm-zoned-reclaim.c zrc = kzalloc(sizeof(struct dmz_reclaim), GFP_KERNEL); zrc 510 drivers/md/dm-zoned-reclaim.c if (!zrc) zrc 513 drivers/md/dm-zoned-reclaim.c zrc->dev = dev; zrc 514 drivers/md/dm-zoned-reclaim.c zrc->metadata = zmd; zrc 515 drivers/md/dm-zoned-reclaim.c zrc->atime = jiffies; zrc 518 drivers/md/dm-zoned-reclaim.c zrc->kc = dm_kcopyd_client_create(&zrc->kc_throttle); zrc 519 drivers/md/dm-zoned-reclaim.c if (IS_ERR(zrc->kc)) { zrc 520 drivers/md/dm-zoned-reclaim.c ret = PTR_ERR(zrc->kc); zrc 521 drivers/md/dm-zoned-reclaim.c zrc->kc = NULL; zrc 526 drivers/md/dm-zoned-reclaim.c INIT_DELAYED_WORK(&zrc->work, dmz_reclaim_work); zrc 527 drivers/md/dm-zoned-reclaim.c zrc->wq = alloc_ordered_workqueue("dmz_rwq_%s", WQ_MEM_RECLAIM, zrc 529 drivers/md/dm-zoned-reclaim.c if (!zrc->wq) { zrc 534 drivers/md/dm-zoned-reclaim.c *reclaim = zrc; zrc 535 drivers/md/dm-zoned-reclaim.c queue_delayed_work(zrc->wq, &zrc->work, 0); zrc 539 drivers/md/dm-zoned-reclaim.c if (zrc->kc) zrc 540 drivers/md/dm-zoned-reclaim.c dm_kcopyd_client_destroy(zrc->kc); zrc 541 drivers/md/dm-zoned-reclaim.c kfree(zrc); zrc 549 drivers/md/dm-zoned-reclaim.c void dmz_dtr_reclaim(struct dmz_reclaim *zrc) zrc 551 drivers/md/dm-zoned-reclaim.c cancel_delayed_work_sync(&zrc->work); zrc 552 drivers/md/dm-zoned-reclaim.c destroy_workqueue(zrc->wq); zrc 553 drivers/md/dm-zoned-reclaim.c dm_kcopyd_client_destroy(zrc->kc); zrc 554 drivers/md/dm-zoned-reclaim.c kfree(zrc); zrc 560 drivers/md/dm-zoned-reclaim.c void dmz_suspend_reclaim(struct dmz_reclaim *zrc) zrc 562 drivers/md/dm-zoned-reclaim.c cancel_delayed_work_sync(&zrc->work); zrc 568 drivers/md/dm-zoned-reclaim.c void dmz_resume_reclaim(struct dmz_reclaim *zrc) zrc 570 drivers/md/dm-zoned-reclaim.c queue_delayed_work(zrc->wq, &zrc->work, DMZ_IDLE_PERIOD); zrc 576 drivers/md/dm-zoned-reclaim.c void dmz_reclaim_bio_acc(struct dmz_reclaim *zrc) zrc 578 drivers/md/dm-zoned-reclaim.c zrc->atime = jiffies; zrc 584 drivers/md/dm-zoned-reclaim.c void dmz_schedule_reclaim(struct dmz_reclaim *zrc) zrc 586 drivers/md/dm-zoned-reclaim.c if (dmz_should_reclaim(zrc)) zrc 587 drivers/md/dm-zoned-reclaim.c mod_delayed_work(zrc->wq, &zrc->work, 0); zrc 248 drivers/md/dm-zoned.h struct dmz_reclaim **zrc); zrc 249 drivers/md/dm-zoned.h void dmz_dtr_reclaim(struct dmz_reclaim *zrc); zrc 250 drivers/md/dm-zoned.h void dmz_suspend_reclaim(struct dmz_reclaim *zrc); zrc 251 drivers/md/dm-zoned.h void dmz_resume_reclaim(struct dmz_reclaim *zrc); zrc 252 drivers/md/dm-zoned.h void dmz_reclaim_bio_acc(struct dmz_reclaim *zrc); zrc 253 drivers/md/dm-zoned.h void dmz_schedule_reclaim(struct dmz_reclaim *zrc);