From 930f541c7be70443079c1cae393061cc5184e50f Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 16 Jan 2017 10:38:39 -0800 Subject: [PATCH] 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 --- kmod/src/seg.c | 5 +++++ kmod/src/seg.h | 1 + 2 files changed, 6 insertions(+) diff --git a/kmod/src/seg.c b/kmod/src/seg.c index b3e2a1bd..f2034b8e 100644 --- a/kmod/src/seg.c +++ b/kmod/src/seg.c @@ -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; diff --git a/kmod/src/seg.h b/kmod/src/seg.h index 106215bc..597e9955 100644 --- a/kmod/src/seg.h +++ b/kmod/src/seg.h @@ -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);