mirror of
https://github.com/versity/scoutfs.git
synced 2026-04-24 15:30:29 +00:00
This adds some minor functionality to the per_task API for use by the upcoming offline waiting work. Add scoutfs_per_task_add_excl() so that a caller can tell if their task was already put on a per-task list by their caller. Make scoutfs_per_task_del() return a bool to indicate if the entry was found on a list and was in fact deleted, or not. Add scoutfs_per_task_init_entry() for initializing entries that aren't declared on the stack. Signed-off-by: Zach Brown <zab@versity.com>
32 lines
889 B
C
32 lines
889 B
C
#ifndef _SCOUTFS_PER_TASK_H_
|
|
#define _SCOUTFS_PER_TASK_H_
|
|
|
|
struct scoutfs_per_task {
|
|
spinlock_t lock;
|
|
struct list_head list;
|
|
};
|
|
|
|
struct scoutfs_per_task_entry {
|
|
struct list_head head;
|
|
struct task_struct *task;
|
|
void *ptr;
|
|
};
|
|
|
|
#define SCOUTFS_DECLARE_PER_TASK_ENTRY(name) \
|
|
struct scoutfs_per_task_entry name = { \
|
|
.head = LIST_HEAD_INIT((name).head), \
|
|
}
|
|
|
|
|
|
void *scoutfs_per_task_get(struct scoutfs_per_task *pt);
|
|
void scoutfs_per_task_add(struct scoutfs_per_task *pt,
|
|
struct scoutfs_per_task_entry *ent, void *ptr);
|
|
bool scoutfs_per_task_add_excl(struct scoutfs_per_task *pt,
|
|
struct scoutfs_per_task_entry *ent, void *ptr);
|
|
bool scoutfs_per_task_del(struct scoutfs_per_task *pt,
|
|
struct scoutfs_per_task_entry *ent);
|
|
void scoutfs_per_task_init(struct scoutfs_per_task *pt);
|
|
void scoutfs_per_task_init_entry(struct scoutfs_per_task_entry *ent);
|
|
|
|
#endif
|