• Home
  • Raw
  • Download

Lines Matching refs:ws

782 static void heuristic_put_workspace(struct list_head *ws)  in heuristic_put_workspace()  argument
784 btrfs_put_workspace(&heuristic_wsm, ws); in heuristic_put_workspace()
787 static void free_heuristic_ws(struct list_head *ws) in free_heuristic_ws() argument
791 workspace = list_entry(ws, struct heuristic_ws, list); in free_heuristic_ws()
801 struct heuristic_ws *ws; in alloc_heuristic_ws() local
803 ws = kzalloc(sizeof(*ws), GFP_KERNEL); in alloc_heuristic_ws()
804 if (!ws) in alloc_heuristic_ws()
807 ws->sample = kvmalloc(MAX_SAMPLE_SIZE, GFP_KERNEL); in alloc_heuristic_ws()
808 if (!ws->sample) in alloc_heuristic_ws()
811 ws->bucket = kcalloc(BUCKET_SIZE, sizeof(*ws->bucket), GFP_KERNEL); in alloc_heuristic_ws()
812 if (!ws->bucket) in alloc_heuristic_ws()
815 ws->bucket_b = kcalloc(BUCKET_SIZE, sizeof(*ws->bucket_b), GFP_KERNEL); in alloc_heuristic_ws()
816 if (!ws->bucket_b) in alloc_heuristic_ws()
819 INIT_LIST_HEAD(&ws->list); in alloc_heuristic_ws()
820 return &ws->list; in alloc_heuristic_ws()
822 free_heuristic_ws(&ws->list); in alloc_heuristic_ws()
872 struct list_head *ws; in btrfs_cleanup_workspace_manager() local
875 ws = wsman->idle_ws.next; in btrfs_cleanup_workspace_manager()
876 list_del(ws); in btrfs_cleanup_workspace_manager()
877 wsman->ops->free_workspace(ws); in btrfs_cleanup_workspace_manager()
975 void btrfs_put_workspace(struct workspace_manager *wsm, struct list_head *ws) in btrfs_put_workspace() argument
991 list_add(ws, idle_ws); in btrfs_put_workspace()
998 wsm->ops->free_workspace(ws); in btrfs_put_workspace()
1004 static void put_workspace(int type, struct list_head *ws) in put_workspace() argument
1006 return btrfs_compress_op[type]->put_workspace(ws); in put_workspace()
1247 static u32 shannon_entropy(struct heuristic_ws *ws) in shannon_entropy() argument
1254 sz_base = ilog2_w(ws->sample_size); in shannon_entropy()
1255 for (i = 0; i < BUCKET_SIZE && ws->bucket[i].count > 0; i++) { in shannon_entropy()
1256 p = ws->bucket[i].count; in shannon_entropy()
1261 entropy_sum /= ws->sample_size; in shannon_entropy()
1383 static int byte_core_set_size(struct heuristic_ws *ws) in byte_core_set_size() argument
1387 const u32 core_set_threshold = ws->sample_size * 90 / 100; in byte_core_set_size()
1388 struct bucket_item *bucket = ws->bucket; in byte_core_set_size()
1391 radix_sort(ws->bucket, ws->bucket_b, BUCKET_SIZE); in byte_core_set_size()
1421 static u32 byte_set_size(const struct heuristic_ws *ws) in byte_set_size() argument
1427 if (ws->bucket[i].count > 0) in byte_set_size()
1437 if (ws->bucket[i].count > 0) { in byte_set_size()
1447 static bool sample_repeated_patterns(struct heuristic_ws *ws) in sample_repeated_patterns() argument
1449 const u32 half_of_sample = ws->sample_size / 2; in sample_repeated_patterns()
1450 const u8 *data = ws->sample; in sample_repeated_patterns()
1456 struct heuristic_ws *ws) in heuristic_collect_sample() argument
1492 memcpy(&ws->sample[curr_sample_pos], &in_data[i], in heuristic_collect_sample()
1504 ws->sample_size = curr_sample_pos; in heuristic_collect_sample()
1525 struct heuristic_ws *ws; in btrfs_compress_heuristic() local
1530 ws = list_entry(ws_list, struct heuristic_ws, list); in btrfs_compress_heuristic()
1532 heuristic_collect_sample(inode, start, end, ws); in btrfs_compress_heuristic()
1534 if (sample_repeated_patterns(ws)) { in btrfs_compress_heuristic()
1539 memset(ws->bucket, 0, sizeof(*ws->bucket)*BUCKET_SIZE); in btrfs_compress_heuristic()
1541 for (i = 0; i < ws->sample_size; i++) { in btrfs_compress_heuristic()
1542 byte = ws->sample[i]; in btrfs_compress_heuristic()
1543 ws->bucket[byte].count++; in btrfs_compress_heuristic()
1546 i = byte_set_size(ws); in btrfs_compress_heuristic()
1552 i = byte_core_set_size(ws); in btrfs_compress_heuristic()
1563 i = shannon_entropy(ws); in btrfs_compress_heuristic()