Add a scoutfs_seg_get

Compaction is going to want to get additional references on a segment.
It could just "read" it again while holding a reference but this is more
clear.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-04-18 13:44:54 -07:00
parent 3407576ced
commit 930f541c7b
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -87,6 +87,11 @@ static struct scoutfs_segment *alloc_seg(u64 segno)
return seg;
}
void scoutfs_seg_get(struct scoutfs_segment *seg)
{
atomic_inc(&seg->refcount);
}
void scoutfs_seg_put(struct scoutfs_segment *seg)
{
int i;
+1
View File
@@ -13,6 +13,7 @@ int scoutfs_seg_find_pos(struct scoutfs_segment *seg, struct kvec *key);
int scoutfs_seg_item_kvecs(struct scoutfs_segment *seg, int pos,
struct kvec *key, struct kvec *val);
void scoutfs_seg_get(struct scoutfs_segment *seg);
void scoutfs_seg_put(struct scoutfs_segment *seg);
int scoutfs_seg_alloc(struct super_block *sb, struct scoutfs_segment **seg_ret);