exofs.txt 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. ===============================================================================
  2. WHAT IS EXOFS?
  3. ===============================================================================
  4. exofs is a file system that uses an OSD and exports the API of a normal Linux
  5. file system. Users access exofs like any other local file system, and exofs
  6. will in turn issue commands to the local OSD initiator.
  7. OSD is a new T10 command set that views storage devices not as a large/flat
  8. array of sectors but as a container of objects, each having a length, quota,
  9. time attributes and more. Each object is addressed by a 64bit ID, and is
  10. contained in a 64bit ID partition. Each object has associated attributes
  11. attached to it, which are integral part of the object and provide metadata about
  12. the object. The standard defines some common obligatory attributes, but user
  13. attributes can be added as needed.
  14. ===============================================================================
  15. ENVIRONMENT
  16. ===============================================================================
  17. To use this file system, you need to have an object store to run it on. You
  18. may download a target from:
  19. http://open-osd.org
  20. See Documentation/scsi/osd.txt for how to setup a working osd environment.
  21. ===============================================================================
  22. USAGE
  23. ===============================================================================
  24. 1. Download and compile exofs and open-osd initiator:
  25. You need an external Kernel source tree or kernel headers from your
  26. distribution. (anything based on 2.6.26 or later).
  27. a. download open-osd including exofs source using:
  28. [parent-directory]$ git clone git://git.open-osd.org/open-osd.git
  29. b. Build the library module like this:
  30. [parent-directory]$ make -C KSRC=$(KER_DIR) open-osd
  31. This will build both the open-osd initiator as well as the exofs kernel
  32. module. Use whatever parameters you compiled your Kernel with and
  33. $(KER_DIR) above pointing to the Kernel you compile against. See the file
  34. open-osd/top-level-Makefile for an example.
  35. 2. Get the OSD initiator and target set up properly, and login to the target.
  36. See Documentation/scsi/osd.txt for farther instructions. Also see ./do-osd
  37. for example script that does all these steps.
  38. 3. Insmod the exofs.ko module:
  39. [exofs]$ insmod exofs.ko
  40. 4. Make sure the directory where you want to mount exists. If not, create it.
  41. (For example, mkdir /mnt/exofs)
  42. 5. At first run you will need to invoke the mkfs.exofs application
  43. As an example, this will create the file system on:
  44. /dev/osd0 partition ID 65536
  45. mkfs.exofs --pid=65536 --format /dev/osd0
  46. The --format is optional. If not specified, no OSD_FORMAT will be
  47. performed and a clean file system will be created in the specified pid,
  48. in the available space of the target. (Use --format=size_in_meg to limit
  49. the total LUN space available)
  50. If pid already exists, it will be deleted and a new one will be created in
  51. its place. Be careful.
  52. An exofs lives inside a single OSD partition. You can create multiple exofs
  53. filesystems on the same device using multiple pids.
  54. (run mkfs.exofs without any parameters for usage help message)
  55. 6. Mount the file system.
  56. For example, to mount /dev/osd0, partition ID 0x10000 on /mnt/exofs:
  57. mount -t exofs -o pid=65536 /dev/osd0 /mnt/exofs/
  58. 7. For reference (See do-exofs example script):
  59. do-exofs start - an example of how to perform the above steps.
  60. do-exofs stop - an example of how to unmount the file system.
  61. do-exofs format - an example of how to format and mkfs a new exofs.
  62. 8. Extra compilation flags (uncomment in fs/exofs/Kbuild):
  63. CONFIG_EXOFS_DEBUG - for debug messages and extra checks.
  64. ===============================================================================
  65. exofs mount options
  66. ===============================================================================
  67. Similar to any mount command:
  68. mount -t exofs -o exofs_options /dev/osdX mount_exofs_directory
  69. Where:
  70. -t exofs: specifies the exofs file system
  71. /dev/osdX: X is a decimal number. /dev/osdX was created after a successful
  72. login into an OSD target.
  73. mount_exofs_directory: The directory to mount the file system on
  74. exofs specific options: Options are separated by commas (,)
  75. pid=<integer> - The partition number to mount/create as
  76. container of the filesystem.
  77. This option is mandatory. integer can be
  78. Hex by pre-pending an 0x to the number.
  79. osdname=<id> - Mount by a device's osdname.
  80. osdname is usually a 36 character uuid of the
  81. form "d2683732-c906-4ee1-9dbd-c10c27bb40df".
  82. It is one of the device's uuid specified in the
  83. mkfs.exofs format command.
  84. If this option is specified then the /dev/osdX
  85. above can be empty and is ignored.
  86. to=<integer> - Timeout in ticks for a single command.
  87. default is (60 * HZ) [for debugging only]
  88. ===============================================================================
  89. DESIGN
  90. ===============================================================================
  91. * The file system control block (AKA on-disk superblock) resides in an object
  92. with a special ID (defined in common.h).
  93. Information included in the file system control block is used to fill the
  94. in-memory superblock structure at mount time. This object is created before
  95. the file system is used by mkexofs.c. It contains information such as:
  96. - The file system's magic number
  97. - The next inode number to be allocated
  98. * Each file resides in its own object and contains the data (and it will be
  99. possible to extend the file over multiple objects, though this has not been
  100. implemented yet).
  101. * A directory is treated as a file, and essentially contains a list of <file
  102. name, inode #> pairs for files that are found in that directory. The object
  103. IDs correspond to the files' inode numbers and will be allocated according to
  104. a bitmap (stored in a separate object). Now they are allocated using a
  105. counter.
  106. * Each file's control block (AKA on-disk inode) is stored in its object's
  107. attributes. This applies to both regular files and other types (directories,
  108. device files, symlinks, etc.).
  109. * Credentials are generated per object (inode and superblock) when they are
  110. created in memory (read from disk or created). The credential works for all
  111. operations and is used as long as the object remains in memory.
  112. * Async OSD operations are used whenever possible, but the target may execute
  113. them out of order. The operations that concern us are create, delete,
  114. readpage, writepage, update_inode, and truncate. The following pairs of
  115. operations should execute in the order written, and we need to prevent them
  116. from executing in reverse order:
  117. - The following are handled with the OBJ_CREATED and OBJ_2BCREATED
  118. flags. OBJ_CREATED is set when we know the object exists on the OSD -
  119. in create's callback function, and when we successfully do a
  120. read_inode.
  121. OBJ_2BCREATED is set in the beginning of the create function, so we
  122. know that we should wait.
  123. - create/delete: delete should wait until the object is created
  124. on the OSD.
  125. - create/readpage: readpage should be able to return a page
  126. full of zeroes in this case. If there was a write already
  127. en-route (i.e. create, writepage, readpage) then the page
  128. would be locked, and so it would really be the same as
  129. create/writepage.
  130. - create/writepage: if writepage is called for a sync write, it
  131. should wait until the object is created on the OSD.
  132. Otherwise, it should just return.
  133. - create/truncate: truncate should wait until the object is
  134. created on the OSD.
  135. - create/update_inode: update_inode should wait until the
  136. object is created on the OSD.
  137. - Handled by VFS locks:
  138. - readpage/delete: shouldn't happen because of page lock.
  139. - writepage/delete: shouldn't happen because of page lock.
  140. - readpage/writepage: shouldn't happen because of page lock.
  141. ===============================================================================
  142. LICENSE/COPYRIGHT
  143. ===============================================================================
  144. The exofs file system is based on ext2 v0.5b (distributed with the Linux kernel
  145. version 2.6.10). All files include the original copyrights, and the license
  146. is GPL version 2 (only version 2, as is true for the Linux kernel). The
  147. Linux kernel can be downloaded from www.kernel.org.