dm-rq.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Internal header file for device mapper
  3. *
  4. * Copyright (C) 2016 Red Hat, Inc. All rights reserved.
  5. *
  6. * This file is released under the LGPL.
  7. */
  8. #ifndef DM_RQ_INTERNAL_H
  9. #define DM_RQ_INTERNAL_H
  10. #include <linux/bio.h>
  11. #include <linux/kthread.h>
  12. #include "dm-stats.h"
  13. struct mapped_device;
  14. /*
  15. * One of these is allocated per request.
  16. */
  17. struct dm_rq_target_io {
  18. struct mapped_device *md;
  19. struct dm_target *ti;
  20. struct request *orig, *clone;
  21. struct kthread_work work;
  22. int error;
  23. union map_info info;
  24. struct dm_stats_aux stats_aux;
  25. unsigned long duration_jiffies;
  26. unsigned n_sectors;
  27. };
  28. /*
  29. * For request-based dm - the bio clones we allocate are embedded in these
  30. * structs.
  31. *
  32. * We allocate these with bio_alloc_bioset, using the front_pad parameter when
  33. * the bioset is created - this means the bio has to come at the end of the
  34. * struct.
  35. */
  36. struct dm_rq_clone_bio_info {
  37. struct bio *orig;
  38. struct dm_rq_target_io *tio;
  39. struct bio clone;
  40. };
  41. bool dm_use_blk_mq_default(void);
  42. bool dm_use_blk_mq(struct mapped_device *md);
  43. int dm_old_init_request_queue(struct mapped_device *md);
  44. int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t);
  45. void dm_mq_cleanup_mapped_device(struct mapped_device *md);
  46. void dm_start_queue(struct request_queue *q);
  47. void dm_stop_queue(struct request_queue *q);
  48. void dm_mq_kick_requeue_list(struct mapped_device *md);
  49. unsigned dm_get_reserved_rq_based_ios(void);
  50. ssize_t dm_attr_rq_based_seq_io_merge_deadline_show(struct mapped_device *md, char *buf);
  51. ssize_t dm_attr_rq_based_seq_io_merge_deadline_store(struct mapped_device *md,
  52. const char *buf, size_t count);
  53. #endif