Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (C) 2017 Red Hat. All rights reserved.
0003  *
0004  * This file is released under the GPL.
0005  */
0006 
0007 #ifndef DM_CACHE_BACKGROUND_WORK_H
0008 #define DM_CACHE_BACKGROUND_WORK_H
0009 
0010 #include <linux/vmalloc.h>
0011 #include "dm-cache-policy.h"
0012 
0013 /*----------------------------------------------------------------*/
0014 
0015 struct background_work;
0016 struct background_tracker;
0017 
0018 /*
0019  * FIXME: discuss lack of locking in all methods.
0020  */
0021 struct background_tracker *btracker_create(unsigned max_work);
0022 void btracker_destroy(struct background_tracker *b);
0023 
0024 unsigned btracker_nr_writebacks_queued(struct background_tracker *b);
0025 unsigned btracker_nr_demotions_queued(struct background_tracker *b);
0026 
0027 /*
0028  * returns -EINVAL iff the work is already queued.  -ENOMEM if the work
0029  * couldn't be queued for another reason.
0030  */
0031 int btracker_queue(struct background_tracker *b,
0032            struct policy_work *work,
0033            struct policy_work **pwork);
0034 
0035 /*
0036  * Returns -ENODATA if there's no work.
0037  */
0038 int btracker_issue(struct background_tracker *b, struct policy_work **work);
0039 void btracker_complete(struct background_tracker *b,
0040                struct policy_work *op);
0041 bool btracker_promotion_already_present(struct background_tracker *b,
0042                     dm_oblock_t oblock);
0043 
0044 /*----------------------------------------------------------------*/
0045 
0046 #endif