diff --git a/drivers/block/zram/zram_group/group_writeback.c b/drivers/block/zram/zram_group/group_writeback.c index 18b7f0532924a5bd04134e277b3e65261b4c1a76..ceeb5cf4321db059f0b52ed441f80b44448d5152 100644 --- a/drivers/block/zram/zram_group/group_writeback.c +++ b/drivers/block/zram/zram_group/group_writeback.c @@ -40,31 +40,31 @@ static bool obj_can_wb(struct zram *zram, u32 index, u16 gid) { /* overwrited obj, just skip */ if (zram_get_memcg_id(zram, index) != gid) { - pr_info("obj %u is from group %u instead of group %u.\n", + pr_debug("obj %u is from group %u instead of group %u.\n", index, zram_get_memcg_id(zram, index), gid); return false; } if (!zgrp_obj_is_isolated(zram->zgrp, index)) { - pr_info("obj %u is not isolated.\n", index); + pr_debug("obj %u is not isolated.\n", index); return false; } /* need not to writeback, put back the obj as HOTEST */ if (zram_test_flag(zram, index, ZRAM_SAME)) { - pr_info("obj %u is filled with same element.\n", index); + pr_debug("obj %u is filled with same element.\n", index); goto insert; } if (zram_test_flag(zram, index, ZRAM_WB)) { - pr_info("obj %u is writeback.\n", index); + pr_debug("obj %u is writeback.\n", index); goto insert; } /* obj is needed by a pagefault req, do not writeback it. */ if (zram_test_flag(zram, index, ZRAM_FAULT)) { - pr_info("obj %u is needed by a pagefault request.\n", index); + pr_debug("obj %u is needed by a pagefault request.\n", index); goto insert; } /* should never happen */ if (zram_test_flag(zram, index, ZRAM_GWB)) { - pr_info("obj %u is group writeback.\n", index); + pr_debug("obj %u is group writeback.\n", index); BUG(); return false; } @@ -122,7 +122,7 @@ static u32 move_obj_to_hpio(struct zram *zram, u32 index, u16 gid, size = zram_get_obj_size(zram, index); /* no space, put back the obj as COLDEST */ if (size + offset > ext_size) { - pr_info("obj %u size is %u, but ext %u only %u space left.\n", + pr_debug("obj %u size is %u, but ext %u only %u space left.\n", index, size, eid, ext_size - offset); zgrp_obj_putback(zram->zgrp, index, gid); size = 0; @@ -138,7 +138,7 @@ static u32 move_obj_to_hpio(struct zram *zram, u32 index, u16 gid, wbgrp_obj_insert(zram->zgrp, index, eid); wbgrp_obj_stats_inc(zram->zgrp, gid, eid, size); zgrp_obj_stats_dec(zram->zgrp, gid, size); - pr_info("move obj %u of group %u to hpio %p of eid %u, size = %u, offset = %u\n", + pr_debug("move obj %u of group %u to hpio %p of eid %u, size = %u, offset = %u\n", index, gid, hpio, eid, size, offset); unlock: zram_slot_unlock(zram, index); @@ -187,7 +187,7 @@ static void move_obj_from_hpio(struct zram *zram, int index, struct hpio *hpio) zgrp_obj_insert(zram->zgrp, index, gid); wbgrp_obj_stats_dec(zram->zgrp, gid, eid, size); zgrp_obj_stats_inc(zram->zgrp, gid, size); - pr_info("move obj %u of group %u from hpio %p of eid %u, size = %u, offset = %u\n", + pr_debug("move obj %u of group %u from hpio %p of eid %u, size = %u, offset = %u\n", index, gid, hpio, eid, size, offset); unlock: zram_slot_unlock(zram, index); @@ -253,7 +253,7 @@ static u32 collect_objs(struct zram *zram, u16 gid, struct hpio *hpio, u32 ext_s nr = zgrp_isolate_objs(zram->zgrp, gid, idxs, NR_ISOLATE, NULL); for (i = 0; i < nr; i++) offset += move_obj_to_hpio(zram, idxs[i], gid, hpio, offset); - pr_info("%u data attached, offset = %u.\n", offset - last_offset, offset); + pr_debug("%u data attached, offset = %u.\n", offset - last_offset, offset); if (offset < ext_size && offset != last_offset) goto more; @@ -374,7 +374,7 @@ static int read_one_obj_sync(struct zram *zram, u32 index) if (!zram_test_flag(zram, index, ZRAM_GWB)) return 0; - pr_info("read obj %u.\n", index); + pr_debug("read obj %u.\n", index); gid = zram_get_memcg_id(zram, index); eid = hyperhold_addr_extent(zram_get_handle(zram, index)); @@ -433,12 +433,14 @@ u64 read_group_objs(struct zram *zram, u16 gid, u64 req_size) u64 read_size = 0; u32 nr; - if (!CHECK(zram->zgrp, "zram group is not enable!\n")) + if (!(zram->zgrp)) { + pr_debug("zram group is not enable!\n"); return 0; + } if (!CHECK_BOUND(gid, 1, zram->zgrp->nr_grp - 1)) return 0; - pr_info("read %llu data of group %u.\n", req_size, gid); + pr_debug("read %llu data of group %u.\n", req_size, gid); while (!req_size || req_size > read_size) { nr = zgrp_isolate_exts(zram->zgrp, gid, &eid, 1, NULL); @@ -455,14 +457,16 @@ u64 write_group_objs(struct zram *zram, u16 gid, u64 req_size) u64 write_size = 0; u64 size = 0; - if (!CHECK(zram->zgrp, "zram group is not enable!\n")) + if (!(zram->zgrp)) { + pr_debug("zram group is not enable!\n"); return 0; + } if (!CHECK(zram->zgrp->wbgrp.enable, "zram group writeback is not enable!\n")) return 0; if (!CHECK_BOUND(gid, 1, zram->zgrp->nr_grp - 1)) return 0; - pr_info("write %llu data of group %u.\n", req_size, gid); + pr_debug("write %llu data of group %u.\n", req_size, gid); while (!req_size || req_size > write_size) { size = write_one_extent(zram, gid); @@ -487,8 +491,10 @@ int zram_group_fault_obj(struct zram *zram, u32 index) u16 gid; u32 size; - if (!CHECK(zram->zgrp, "zram group is not enable!\n")) + if (!(zram->zgrp)) { + pr_debug("zram group is not enable!\n"); return 0; + } if (!CHECK_BOUND(index, 0, zram->zgrp->nr_obj - 1)) return 0; @@ -506,8 +512,10 @@ void zram_group_track_obj(struct zram *zram, u32 index, struct mem_cgroup *memcg { u16 gid; - if (!CHECK(zram->zgrp, "zram group is not enable!\n")) + if (!(zram->zgrp)) { + pr_debug("zram group is not enable!\n"); return; + } if (!CHECK_BOUND(index, 0, zram->zgrp->nr_obj - 1)) return; if (!CHECK(memcg || !memcg->id.id, "obj %u has no memcg!\n", index)) @@ -527,8 +535,10 @@ void zram_group_untrack_obj(struct zram *zram, u32 index) u16 gid; u32 size; - if (!CHECK(zram->zgrp, "zram group is not enable!\n")) + if (!(zram->zgrp)) { + pr_debug("zram group is not enable!\n"); return; + } if (!CHECK_BOUND(index, 0, zram->zgrp->nr_obj - 1)) return; @@ -589,8 +599,10 @@ void group_debug(struct zram *zram, u32 op, u32 index, u32 gid) static u64 group_obj_stats(struct zram *zram, u16 gid, int type) { - if (!CHECK(zram->zgrp, "zram group is not enable!\n")) + if (!(zram->zgrp)) { + pr_debug("zram group is not enable!\n"); return 0; + } if (!CHECK_BOUND(gid, 0, zram->zgrp->nr_grp - 1)) return 0; @@ -663,8 +675,10 @@ static int register_zram_group(struct zram *zram) { if (!CHECK(zram, "zram is NULL!\n")) return -EINVAL; - if (!CHECK(zram->zgrp, "zram group is not enable!\n")) + if (!(zram->zgrp)) { + pr_debug("zram group is not enable!\n"); return -EINVAL; + } zram->zgrp->gsdev = register_group_swap(&zram_group_ops, zram); if (!zram->zgrp->gsdev) { @@ -679,8 +693,10 @@ static void unregister_zram_group(struct zram *zram) { if (!CHECK(zram, "zram is NULL!\n")) return; - if (!CHECK(zram->zgrp, "zram group is not enable!\n")) + if (!(zram->zgrp)) { + pr_debug("zram group is not enable!\n"); return; + } unregister_group_swap(zram->zgrp->gsdev); zram->zgrp->gsdev = NULL; diff --git a/drivers/block/zram/zram_group/zram_group.c b/drivers/block/zram/zram_group/zram_group.c index ea0cdcfadc7b1d6954d1567f8a9897c033600003..85c7f00b4b7e40d7d5a78d65092d9aba5c316f01 100644 --- a/drivers/block/zram/zram_group/zram_group.c +++ b/drivers/block/zram/zram_group/zram_group.c @@ -112,15 +112,17 @@ void zgrp_obj_insert(struct zram_group *zgrp, u32 index, u16 gid) { u32 hid; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } if (!CHECK_BOUND(index, 0, zgrp->nr_obj - 1)) return; if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) return; hid = gid + zgrp->nr_obj; zlist_add(hid, index, zgrp->obj_tab); - pr_info("insert obj %u to group %u\n", index, gid); + pr_debug("insert obj %u to group %u\n", index, gid); } /* @@ -130,13 +132,15 @@ bool zgrp_obj_delete(struct zram_group *zgrp, u32 index, u16 gid) { u32 hid; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return false; + } if (!CHECK_BOUND(index, 0, zgrp->nr_obj - 1)) return false; if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) return false; - pr_info("delete obj %u from group %u\n", index, gid); + pr_debug("delete obj %u from group %u\n", index, gid); hid = gid + zgrp->nr_obj; return zlist_del(hid, index, zgrp->obj_tab); @@ -154,8 +158,10 @@ u32 zgrp_isolate_objs(struct zram_group *zgrp, u16 gid, u32 *idxs, u32 nr, bool if (last) *last = false; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return 0; + } if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) return 0; if (!CHECK(idxs, "return array idxs is null!\n")) @@ -173,7 +179,7 @@ u32 zgrp_isolate_objs(struct zram_group *zgrp, u16 gid, u32 *idxs, u32 nr, bool *last = cnt && zlist_is_isolated_nolock(hid, zgrp->obj_tab); zlist_unlock(hid, zgrp->obj_tab); - pr_info("isolated %u objs from group %u.\n", cnt, gid); + pr_debug("isolated %u objs from group %u.\n", cnt, gid); return cnt; } @@ -185,8 +191,10 @@ bool zgrp_obj_is_isolated(struct zram_group *zgrp, u32 index) { bool ret = false; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return false; + } if (!CHECK_BOUND(index, 0, zgrp->nr_obj - 1)) return false; @@ -203,21 +211,25 @@ void zgrp_obj_putback(struct zram_group *zgrp, u32 index, u16 gid) { u32 hid; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } if (!CHECK_BOUND(index, 0, zgrp->nr_obj - 1)) return; if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) return; hid = gid + zgrp->nr_obj; zlist_add_tail(hid, index, zgrp->obj_tab); - pr_info("putback obj %u to group %u\n", index, gid); + pr_debug("putback obj %u to group %u\n", index, gid); } void zgrp_obj_stats_inc(struct zram_group *zgrp, u16 gid, u32 size) { - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) return; @@ -229,8 +241,10 @@ void zgrp_obj_stats_inc(struct zram_group *zgrp, u16 gid, u32 size) void zgrp_obj_stats_dec(struct zram_group *zgrp, u16 gid, u32 size) { - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) return; @@ -242,8 +256,10 @@ void zgrp_obj_stats_dec(struct zram_group *zgrp, u16 gid, u32 size) void zgrp_fault_stats_inc(struct zram_group *zgrp, u16 gid, u32 size) { - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) return; @@ -256,8 +272,10 @@ void zram_group_dump(struct zram_group *zgrp, u16 gid, u32 index) { u32 hid, idx; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } hid = gid + zgrp->nr_obj; if (gid == 0) { struct zlist_node *node = NULL; @@ -384,8 +402,10 @@ void zgrp_ext_insert(struct zram_group *zgrp, u32 eid, u16 gid) { u32 hid; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } if (!CHECK(zgrp->wbgrp.enable, "zram group writeback is not enable!\n")) return; if (!CHECK_BOUND(eid, 0, zgrp->wbgrp.nr_ext - 1)) @@ -394,7 +414,7 @@ void zgrp_ext_insert(struct zram_group *zgrp, u32 eid, u16 gid) return; hid = gid + zgrp->wbgrp.nr_ext; zlist_add(hid, eid, zgrp->wbgrp.ext_tab); - pr_info("insert extent %u to group %u\n", eid, gid); + pr_debug("insert extent %u to group %u\n", eid, gid); } /* @@ -405,8 +425,10 @@ bool zgrp_ext_delete(struct zram_group *zgrp, u32 eid, u16 gid) u32 hid; bool isolated = false; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return false; + } if (!CHECK(zgrp->wbgrp.enable, "zram group writeback is not enable!\n")) return false; if (!CHECK_BOUND(eid, 0, zgrp->wbgrp.nr_ext - 1)) @@ -418,11 +440,11 @@ bool zgrp_ext_delete(struct zram_group *zgrp, u32 eid, u16 gid) isolated = zlist_is_isolated_nolock(eid, zgrp->wbgrp.ext_tab); zlist_unlock(eid, zgrp->wbgrp.ext_tab); if (isolated) { - pr_info("extent %u is already isolated, skip delete.\n", eid); + pr_debug("extent %u is already isolated, skip delete.\n", eid); return false; } - pr_info("delete extent %u from group %u\n", eid, gid); + pr_debug("delete extent %u from group %u\n", eid, gid); hid = gid + zgrp->wbgrp.nr_ext; return zlist_del(hid, eid, zgrp->wbgrp.ext_tab); } @@ -439,8 +461,10 @@ u32 zgrp_isolate_exts(struct zram_group *zgrp, u16 gid, u32 *eids, u32 nr, bool if (last) *last = false; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return 0; + } if (!CHECK(zgrp->wbgrp.enable, "zram group writeback is not enable!\n")) return 0; if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) @@ -460,7 +484,7 @@ u32 zgrp_isolate_exts(struct zram_group *zgrp, u16 gid, u32 *eids, u32 nr, bool *last = cnt && zlist_is_isolated_nolock(hid, zgrp->wbgrp.ext_tab); zlist_unlock(hid, zgrp->wbgrp.ext_tab); - pr_info("isolated %u exts from group %u.\n", cnt, gid); + pr_debug("isolated %u exts from group %u.\n", cnt, gid); return cnt; } @@ -472,8 +496,10 @@ void wbgrp_obj_insert(struct zram_group *zgrp, u32 index, u32 eid) { u32 hid; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } if (!CHECK(zgrp->wbgrp.enable, "zram group writeback is not enable!\n")) return; if (!CHECK_BOUND(index, 0, zgrp->nr_obj - 1)) @@ -482,7 +508,7 @@ void wbgrp_obj_insert(struct zram_group *zgrp, u32 index, u32 eid) return; hid = eid + zgrp->nr_obj + zgrp->nr_grp; zlist_add_tail(hid, index, zgrp->obj_tab); - pr_info("insert obj %u to extent %u\n", index, eid); + pr_debug("insert obj %u to extent %u\n", index, eid); } /* @@ -492,15 +518,17 @@ bool wbgrp_obj_delete(struct zram_group *zgrp, u32 index, u32 eid) { u32 hid; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return false; + } if (!CHECK(zgrp->wbgrp.enable, "zram group writeback is not enable!\n")) return false; if (!CHECK_BOUND(index, 0, zgrp->nr_obj - 1)) return false; if (!CHECK_BOUND(eid, 0, zgrp->wbgrp.nr_ext - 1)) return false; - pr_info("delete obj %u from extent %u\n", index, eid); + pr_debug("delete obj %u from extent %u\n", index, eid); hid = eid + zgrp->nr_obj + zgrp->nr_grp; return zlist_del(hid, index, zgrp->obj_tab); @@ -519,8 +547,10 @@ u32 wbgrp_isolate_objs(struct zram_group *zgrp, u32 eid, u32 *idxs, u32 nr, bool if (last) *last = false; - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return 0; + } if (!CHECK(zgrp->wbgrp.enable, "zram group writeback is not enable!\n")) return 0; if (!CHECK_BOUND(eid, 0, zgrp->wbgrp.nr_ext - 1)) @@ -540,15 +570,17 @@ u32 wbgrp_isolate_objs(struct zram_group *zgrp, u32 eid, u32 *idxs, u32 nr, bool *last = cnt && zlist_is_isolated_nolock(hid, zgrp->obj_tab); zlist_unlock(hid, zgrp->obj_tab); - pr_info("isolated %u objs from extent %u.\n", cnt, eid); + pr_debug("isolated %u objs from extent %u.\n", cnt, eid); return cnt; } void wbgrp_obj_stats_inc(struct zram_group *zgrp, u16 gid, u32 eid, u32 size) { - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) return; if (!CHECK_BOUND(eid, 0, zgrp->wbgrp.nr_ext - 1)) @@ -562,8 +594,10 @@ void wbgrp_obj_stats_inc(struct zram_group *zgrp, u16 gid, u32 eid, u32 size) void wbgrp_obj_stats_dec(struct zram_group *zgrp, u16 gid, u32 eid, u32 size) { - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) return; if (!CHECK_BOUND(eid, 0, zgrp->wbgrp.nr_ext - 1)) @@ -577,8 +611,10 @@ void wbgrp_obj_stats_dec(struct zram_group *zgrp, u16 gid, u32 eid, u32 size) void wbgrp_fault_stats_inc(struct zram_group *zgrp, u16 gid, u32 eid, u32 size) { - if (!CHECK(zgrp, "zram group is not enable!\n")) + if (!zgrp) { + pr_debug("zram group is not enable!"); return; + } if (!CHECK_BOUND(gid, 1, zgrp->nr_grp - 1)) return; if (!CHECK_BOUND(eid, 0, zgrp->wbgrp.nr_ext - 1))