diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-07-21 13:30:34 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-07-21 13:30:34 +0200 |
commit | 321290241e84a3a2cfc30b65fc6e79ecd266e420 (patch) | |
tree | 1a12686dd3ea7afe0d6e6d93fac3440d2c70bd8d /include/str_table.h | |
parent | 1bb19e4e6980019d0e4ac348f99d9d2cf0074d6b (diff) |
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/str_table.h')
-rw-r--r-- | include/str_table.h | 7 |
1 files changed, 7 insertions, 0 deletions
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 */ |