multipath.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef _MULTIPATH_H
  2. #define _MULTIPATH_H
  3. #include <linux/raid/md.h>
  4. struct multipath_info {
  5. int number;
  6. int raid_disk;
  7. kdev_t dev;
  8. /*
  9.  * State bits:
  10.  */
  11. int operational;
  12. int spare;
  13. int used_slot;
  14. };
  15. struct multipath_private_data {
  16. mddev_t *mddev;
  17. struct multipath_info multipaths[MD_SB_DISKS];
  18. int nr_disks;
  19. int raid_disks;
  20. int working_disks;
  21. mdk_thread_t *thread;
  22. struct multipath_info *spare;
  23. md_spinlock_t device_lock;
  24. /* buffer pool */
  25. /* buffer_heads that we have pre-allocated have b_pprev -> &freebh
  26.  * and are linked into a stack using b_next
  27.  * multipath_bh that are pre-allocated have MPBH_PreAlloc set.
  28.  * All these variable are protected by device_lock
  29.  */
  30. struct multipath_bh *freer1;
  31. int freer1_blocked;
  32. int freer1_cnt;
  33. md_wait_queue_head_t wait_buffer;
  34. };
  35. typedef struct multipath_private_data multipath_conf_t;
  36. /*
  37.  * this is the only point in the RAID code where we violate
  38.  * C type safety. mddev->private is an 'opaque' pointer.
  39.  */
  40. #define mddev_to_conf(mddev) ((multipath_conf_t *) mddev->private)
  41. /*
  42.  * this is our 'private' 'collective' MULTIPATH buffer head.
  43.  * it contains information about what kind of IO operations were started
  44.  * for this MULTIPATH operation, and about their status:
  45.  */
  46. struct multipath_bh {
  47. atomic_t remaining; /* 'have we finished' count,
  48.     * used from IRQ handlers
  49.     */
  50. int cmd;
  51. unsigned long state;
  52. mddev_t *mddev;
  53. struct buffer_head *master_bh;
  54. struct buffer_head bh_req;
  55. struct multipath_bh *next_mp; /* next for retry or in free list */
  56. };
  57. /* bits for multipath_bh.state */
  58. #define MPBH_Uptodate 1
  59. #define MPBH_SyncPhase 2
  60. #define MPBH_PreAlloc 3 /* this was pre-allocated, add to free list */
  61. #endif