dm-rq.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. blk_status_t error;
  23. union map_info info;
  24. struct dm_stats_aux stats_aux;
  25. unsigned long duration_jiffies;
  26. unsigned n_sectors;
  27. unsigned completed;
  28. };
  29. /*
  30. * For request-based dm - the bio clones we allocate are embedded in these
  31. * structs.
  32. *
  33. * We allocate these with bio_alloc_bioset, using the front_pad parameter when
  34. * the bioset is created - this means the bio has to come at the end of the
  35. * struct.
  36. */
  37. struct dm_rq_clone_bio_info {
  38. struct bio *orig;
  39. struct dm_rq_target_io *tio;
  40. struct bio clone;
  41. };
  42. bool dm_use_blk_mq_default(void);
  43. bool dm_use_blk_mq(struct mapped_device *md);
  44. int dm_old_init_request_queue(struct mapped_device *md, struct dm_table *t);
  45. int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t);
  46. void dm_mq_cleanup_mapped_device(struct mapped_device *md);
  47. void dm_start_queue(struct request_queue *q);
  48. void dm_stop_queue(struct request_queue *q);
  49. void dm_mq_kick_requeue_list(struct mapped_device *md);
  50. unsigned dm_get_reserved_rq_based_ios(void);
  51. ssize_t dm_attr_rq_based_seq_io_merge_deadline_show(struct mapped_device *md, char *buf);
  52. ssize_t dm_attr_rq_based_seq_io_merge_deadline_store(struct mapped_device *md,
  53. const char *buf, size_t count);
  54. #endif