From 321290241e84a3a2cfc30b65fc6e79ecd266e420 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 21 Jul 2019 13:30:34 +0200 Subject: Keep track of xattr key & value references AFTER deduplication This commit adds a reference count functionality to the string table implementation and uses this functionality in the fstree code to count how often each key and value is referenced by the deduplicated Xattr blocks. This is needed to support deduplication through out-of-band storage of xattrs. Signed-off-by: David Oberhollenzer --- include/str_table.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/str_table.h b/include/str_table.h index db36c5b..56b601a 100644 --- a/include/str_table.h +++ b/include/str_table.h @@ -6,6 +6,7 @@ typedef struct str_bucket_t { struct str_bucket_t *next; char *str; size_t index; + size_t refcount; } str_bucket_t; /* Stores strings in a hash table and assigns an incremental, unique ID to @@ -34,4 +35,10 @@ int str_table_get_index(str_table_t *table, const char *str, size_t *idx); Returns NULL if the ID is unknown, i.e. out of bounds. */ const char *str_table_get_string(str_table_t *table, size_t index); +void str_table_reset_ref_count(str_table_t *table); + +void str_table_add_ref(str_table_t *table, size_t index); + +size_t str_table_get_ref_count(str_table_t *table, size_t index); + #endif /* STR_TABLE_H */ -- cgit v1.2.3