dm-cache-background-tracker.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2017 Red Hat. All rights reserved.
  3. *
  4. * This file is released under the GPL.
  5. */
  6. #ifndef DM_CACHE_BACKGROUND_WORK_H
  7. #define DM_CACHE_BACKGROUND_WORK_H
  8. #include <linux/vmalloc.h>
  9. #include "dm-cache-policy.h"
  10. /*----------------------------------------------------------------*/
  11. struct background_work;
  12. struct background_tracker;
  13. /*
  14. * FIXME: discuss lack of locking in all methods.
  15. */
  16. struct background_tracker *btracker_create(unsigned max_work);
  17. void btracker_destroy(struct background_tracker *b);
  18. unsigned btracker_nr_writebacks_queued(struct background_tracker *b);
  19. unsigned btracker_nr_demotions_queued(struct background_tracker *b);
  20. /*
  21. * returns -EINVAL iff the work is already queued. -ENOMEM if the work
  22. * couldn't be queued for another reason.
  23. */
  24. int btracker_queue(struct background_tracker *b,
  25. struct policy_work *work,
  26. struct policy_work **pwork);
  27. /*
  28. * Returns -ENODATA if there's no work.
  29. */
  30. int btracker_issue(struct background_tracker *b, struct policy_work **work);
  31. void btracker_complete(struct background_tracker *b,
  32. struct policy_work *op);
  33. bool btracker_promotion_already_present(struct background_tracker *b,
  34. dm_oblock_t oblock);
  35. /*----------------------------------------------------------------*/
  36. #endif