osd.txt 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. The OSD Standard
  2. ================
  3. OSD (Object-Based Storage Device) is a T10 SCSI command set that is designed
  4. to provide efficient operation of input/output logical units that manage the
  5. allocation, placement, and accessing of variable-size data-storage containers,
  6. called objects. Objects are intended to contain operating system and application
  7. constructs. Each object has associated attributes attached to it, which are
  8. integral part of the object and provide metadata about the object. The standard
  9. defines some common obligatory attributes, but user attributes can be added as
  10. needed.
  11. See: http://www.t10.org/ftp/t10/drafts/osd2/ for the latest draft for OSD 2
  12. or search the web for "OSD SCSI"
  13. OSD in the Linux Kernel
  14. =======================
  15. osd-initiator:
  16. The main component of OSD in Kernel is the osd-initiator library. Its main
  17. user is intended to be the pNFS-over-objects layout driver, which uses objects
  18. as its back-end data storage. Other clients are the other osd parts listed below.
  19. osd-uld:
  20. This is a SCSI ULD that registers for OSD type devices and provides a testing
  21. platform, both for the in-kernel initiator as well as connected targets. It
  22. currently has no useful user-mode API, though it could have if need be.
  23. exofs:
  24. Is an OSD based Linux file system. It uses the osd-initiator and osd-uld,
  25. to export a usable file system for users.
  26. See Documentation/filesystems/exofs.txt for more details
  27. osd target:
  28. There are no current plans for an OSD target implementation in kernel. For all
  29. needs, a user-mode target that is based on the scsi tgt target framework is
  30. available from Ohio Supercomputer Center (OSC) at:
  31. http://www.open-osd.org/bin/view/Main/OscOsdProject
  32. There are several other target implementations. See http://open-osd.org for more
  33. links.
  34. Files and Folders
  35. =================
  36. This is the complete list of files included in this work:
  37. include/scsi/
  38. osd_initiator.h Main API for the initiator library
  39. osd_types.h Common OSD types
  40. osd_sec.h Security Manager API
  41. osd_protocol.h Wire definitions of the OSD standard protocol
  42. osd_attributes.h Wire definitions of OSD attributes
  43. drivers/scsi/osd/
  44. osd_initiator.c OSD-Initiator library implementation
  45. osd_uld.c The OSD scsi ULD
  46. osd_ktest.{h,c} In-kernel test suite (called by osd_uld)
  47. osd_debug.h Some printk macros
  48. Makefile For both in-tree and out-of-tree compilation
  49. Kconfig Enables inclusion of the different pieces
  50. osd_test.c User-mode application to call the kernel tests
  51. The OSD-Initiator Library
  52. =========================
  53. osd_initiator is a low level implementation of an osd initiator encoder.
  54. But even though, it should be intuitive and easy to use. Perhaps over time an
  55. higher lever will form that automates some of the more common recipes.
  56. init/fini:
  57. - osd_dev_init() associates a scsi_device with an osd_dev structure
  58. and initializes some global pools. This should be done once per scsi_device
  59. (OSD LUN). The osd_dev structure is needed for calling osd_start_request().
  60. - osd_dev_fini() cleans up before a osd_dev/scsi_device destruction.
  61. OSD commands encoding, execution, and decoding of results:
  62. struct osd_request's is used to iteratively encode an OSD command and carry
  63. its state throughout execution. Each request goes through these stages:
  64. a. osd_start_request() allocates the request.
  65. b. Any of the osd_req_* methods is used to encode a request of the specified
  66. type.
  67. c. osd_req_add_{get,set}_attr_* may be called to add get/set attributes to the
  68. CDB. "List" or "Page" mode can be used exclusively. The attribute-list API
  69. can be called multiple times on the same request. However, only one
  70. attribute-page can be read, as mandated by the OSD standard.
  71. d. osd_finalize_request() computes offsets into the data-in and data-out buffers
  72. and signs the request using the provided capability key and integrity-
  73. check parameters.
  74. e. osd_execute_request() may be called to execute the request via the block
  75. layer and wait for its completion. The request can be executed
  76. asynchronously by calling the block layer API directly.
  77. f. After execution, osd_req_decode_sense() can be called to decode the request's
  78. sense information.
  79. g. osd_req_decode_get_attr() may be called to retrieve osd_add_get_attr_list()
  80. values.
  81. h. osd_end_request() must be called to deallocate the request and any resource
  82. associated with it. Note that osd_end_request cleans up the request at any
  83. stage and it must always be called after a successful osd_start_request().
  84. osd_request's structure:
  85. The OSD standard defines a complex structure of IO segments pointed to by
  86. members in the CDB. Up to 3 segments can be deployed in the IN-Buffer and up to
  87. 4 in the OUT-Buffer. The ASCII illustration below depicts a secure-read with
  88. associated get+set of attributes-lists. Other combinations very on the same
  89. basic theme. From no-segments-used up to all-segments-used.
  90. |________OSD-CDB__________|
  91. | |
  92. |read_len (offset=0) -|---------\
  93. | | |
  94. |get_attrs_list_length | |
  95. |get_attrs_list_offset -|----\ |
  96. | | | |
  97. |retrieved_attrs_alloc_len| | |
  98. |retrieved_attrs_offset -|----|----|-\
  99. | | | | |
  100. |set_attrs_list_length | | | |
  101. |set_attrs_list_offset -|-\ | | |
  102. | | | | | |
  103. |in_data_integ_offset -|-|--|----|-|-\
  104. |out_data_integ_offset -|-|--|--\ | | |
  105. \_________________________/ | | | | | |
  106. | | | | | |
  107. |_______OUT-BUFFER________| | | | | | |
  108. | Set attr list |</ | | | | |
  109. | | | | | | |
  110. |-------------------------| | | | | |
  111. | Get attr descriptors |<---/ | | | |
  112. | | | | | |
  113. |-------------------------| | | | |
  114. | Out-data integrity |<------/ | | |
  115. | | | | |
  116. \_________________________/ | | |
  117. | | |
  118. |________IN-BUFFER________| | | |
  119. | In-Data read |<--------/ | |
  120. | | | |
  121. |-------------------------| | |
  122. | Get attr list |<----------/ |
  123. | | |
  124. |-------------------------| |
  125. | In-data integrity |<------------/
  126. | |
  127. \_________________________/
  128. A block device request can carry bidirectional payload by means of associating
  129. a bidi_read request with a main write-request. Each in/out request is described
  130. by a chain of BIOs associated with each request.
  131. The CDB is of a SCSI VARLEN CDB format, as described by OSD standard.
  132. The OSD standard also mandates alignment restrictions at start of each segment.
  133. In the code, in struct osd_request, there are two _osd_io_info structures to
  134. describe the IN/OUT buffers above, two BIOs for the data payload and up to five
  135. _osd_req_data_segment structures to hold the different segments allocation and
  136. information.
  137. Important: We have chosen to disregard the assumption that a BIO-chain (and
  138. the resulting sg-list) describes a linear memory buffer. Meaning only first and
  139. last scatter chain can be incomplete and all the middle chains are of PAGE_SIZE.
  140. For us, a scatter-gather-list, as its name implies and as used by the Networking
  141. layer, is to describe a vector of buffers that will be transferred to/from the
  142. wire. It works very well with current iSCSI transport. iSCSI is currently the
  143. only deployed OSD transport. In the future we anticipate SAS and FC attached OSD
  144. devices as well.
  145. The OSD Testing ULD
  146. ===================
  147. TODO: More user-mode control on tests.
  148. Authors, Mailing list
  149. =====================
  150. Please communicate with us on any deployment of osd, whether using this code
  151. or not.
  152. Any problems, questions, bug reports, lonely OSD nights, please email:
  153. OSD Dev List <[email protected]>
  154. More up-to-date information can be found on:
  155. http://open-osd.org
  156. Boaz Harrosh <[email protected]>
  157. References
  158. ==========
  159. Weber, R., "SCSI Object-Based Storage Device Commands",
  160. T10/1355-D ANSI/INCITS 400-2004,
  161. http://www.t10.org/ftp/t10/drafts/osd/osd-r10.pdf
  162. Weber, R., "SCSI Object-Based Storage Device Commands -2 (OSD-2)"
  163. T10/1729-D, Working Draft, rev. 3
  164. http://www.t10.org/ftp/t10/drafts/osd2/osd2r03.pdf