target_core_file.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /*******************************************************************************
  2. * Filename: target_core_file.c
  3. *
  4. * This file contains the Storage Engine <-> FILEIO transport specific functions
  5. *
  6. * Copyright (c) 2005 PyX Technologies, Inc.
  7. * Copyright (c) 2005-2006 SBE, Inc. All Rights Reserved.
  8. * Copyright (c) 2007-2010 Rising Tide Systems
  9. * Copyright (c) 2008-2010 Linux-iSCSI.org
  10. *
  11. * Nicholas A. Bellinger <nab@kernel.org>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  26. *
  27. ******************************************************************************/
  28. #include <linux/string.h>
  29. #include <linux/parser.h>
  30. #include <linux/timer.h>
  31. #include <linux/blkdev.h>
  32. #include <linux/slab.h>
  33. #include <linux/spinlock.h>
  34. #include <linux/module.h>
  35. #include <scsi/scsi.h>
  36. #include <scsi/scsi_host.h>
  37. #include <target/target_core_base.h>
  38. #include <target/target_core_backend.h>
  39. #include "target_core_file.h"
  40. static struct se_subsystem_api fileio_template;
  41. /* fd_attach_hba(): (Part of se_subsystem_api_t template)
  42. *
  43. *
  44. */
  45. static int fd_attach_hba(struct se_hba *hba, u32 host_id)
  46. {
  47. struct fd_host *fd_host;
  48. fd_host = kzalloc(sizeof(struct fd_host), GFP_KERNEL);
  49. if (!fd_host) {
  50. pr_err("Unable to allocate memory for struct fd_host\n");
  51. return -ENOMEM;
  52. }
  53. fd_host->fd_host_id = host_id;
  54. hba->hba_ptr = fd_host;
  55. pr_debug("CORE_HBA[%d] - TCM FILEIO HBA Driver %s on Generic"
  56. " Target Core Stack %s\n", hba->hba_id, FD_VERSION,
  57. TARGET_CORE_MOD_VERSION);
  58. pr_debug("CORE_HBA[%d] - Attached FILEIO HBA: %u to Generic"
  59. " MaxSectors: %u\n",
  60. hba->hba_id, fd_host->fd_host_id, FD_MAX_SECTORS);
  61. return 0;
  62. }
  63. static void fd_detach_hba(struct se_hba *hba)
  64. {
  65. struct fd_host *fd_host = hba->hba_ptr;
  66. pr_debug("CORE_HBA[%d] - Detached FILEIO HBA: %u from Generic"
  67. " Target Core\n", hba->hba_id, fd_host->fd_host_id);
  68. kfree(fd_host);
  69. hba->hba_ptr = NULL;
  70. }
  71. static void *fd_allocate_virtdevice(struct se_hba *hba, const char *name)
  72. {
  73. struct fd_dev *fd_dev;
  74. struct fd_host *fd_host = hba->hba_ptr;
  75. fd_dev = kzalloc(sizeof(struct fd_dev), GFP_KERNEL);
  76. if (!fd_dev) {
  77. pr_err("Unable to allocate memory for struct fd_dev\n");
  78. return NULL;
  79. }
  80. fd_dev->fd_host = fd_host;
  81. pr_debug("FILEIO: Allocated fd_dev for %p\n", name);
  82. return fd_dev;
  83. }
  84. /* fd_create_virtdevice(): (Part of se_subsystem_api_t template)
  85. *
  86. *
  87. */
  88. static struct se_device *fd_create_virtdevice(
  89. struct se_hba *hba,
  90. struct se_subsystem_dev *se_dev,
  91. void *p)
  92. {
  93. char *dev_p = NULL;
  94. struct se_device *dev;
  95. struct se_dev_limits dev_limits;
  96. struct queue_limits *limits;
  97. struct fd_dev *fd_dev = p;
  98. struct fd_host *fd_host = hba->hba_ptr;
  99. mm_segment_t old_fs;
  100. struct file *file;
  101. struct inode *inode = NULL;
  102. int dev_flags = 0, flags, ret = -EINVAL;
  103. memset(&dev_limits, 0, sizeof(struct se_dev_limits));
  104. old_fs = get_fs();
  105. set_fs(get_ds());
  106. dev_p = getname(fd_dev->fd_dev_name);
  107. set_fs(old_fs);
  108. if (IS_ERR(dev_p)) {
  109. pr_err("getname(%s) failed: %lu\n",
  110. fd_dev->fd_dev_name, IS_ERR(dev_p));
  111. ret = PTR_ERR(dev_p);
  112. goto fail;
  113. }
  114. /* O_DIRECT too? */
  115. flags = O_RDWR | O_CREAT | O_LARGEFILE;
  116. /*
  117. * If fd_buffered_io=1 has not been set explicitly (the default),
  118. * use O_SYNC to force FILEIO writes to disk.
  119. */
  120. if (!(fd_dev->fbd_flags & FDBD_USE_BUFFERED_IO))
  121. flags |= O_SYNC;
  122. file = filp_open(dev_p, flags, 0600);
  123. if (IS_ERR(file)) {
  124. pr_err("filp_open(%s) failed\n", dev_p);
  125. ret = PTR_ERR(file);
  126. goto fail;
  127. }
  128. if (!file || !file->f_dentry) {
  129. pr_err("filp_open(%s) failed\n", dev_p);
  130. goto fail;
  131. }
  132. fd_dev->fd_file = file;
  133. /*
  134. * If using a block backend with this struct file, we extract
  135. * fd_dev->fd_[block,dev]_size from struct block_device.
  136. *
  137. * Otherwise, we use the passed fd_size= from configfs
  138. */
  139. inode = file->f_mapping->host;
  140. if (S_ISBLK(inode->i_mode)) {
  141. struct request_queue *q;
  142. unsigned long long dev_size;
  143. /*
  144. * Setup the local scope queue_limits from struct request_queue->limits
  145. * to pass into transport_add_device_to_core_hba() as struct se_dev_limits.
  146. */
  147. q = bdev_get_queue(inode->i_bdev);
  148. limits = &dev_limits.limits;
  149. limits->logical_block_size = bdev_logical_block_size(inode->i_bdev);
  150. limits->max_hw_sectors = queue_max_hw_sectors(q);
  151. limits->max_sectors = queue_max_sectors(q);
  152. /*
  153. * Determine the number of bytes from i_size_read() minus
  154. * one (1) logical sector from underlying struct block_device
  155. */
  156. fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev);
  157. dev_size = (i_size_read(file->f_mapping->host) -
  158. fd_dev->fd_block_size);
  159. pr_debug("FILEIO: Using size: %llu bytes from struct"
  160. " block_device blocks: %llu logical_block_size: %d\n",
  161. dev_size, div_u64(dev_size, fd_dev->fd_block_size),
  162. fd_dev->fd_block_size);
  163. } else {
  164. if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) {
  165. pr_err("FILEIO: Missing fd_dev_size="
  166. " parameter, and no backing struct"
  167. " block_device\n");
  168. goto fail;
  169. }
  170. limits = &dev_limits.limits;
  171. limits->logical_block_size = FD_BLOCKSIZE;
  172. limits->max_hw_sectors = FD_MAX_SECTORS;
  173. limits->max_sectors = FD_MAX_SECTORS;
  174. fd_dev->fd_block_size = FD_BLOCKSIZE;
  175. }
  176. dev_limits.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH;
  177. dev_limits.queue_depth = FD_DEVICE_QUEUE_DEPTH;
  178. dev = transport_add_device_to_core_hba(hba, &fileio_template,
  179. se_dev, dev_flags, fd_dev,
  180. &dev_limits, "FILEIO", FD_VERSION);
  181. if (!dev)
  182. goto fail;
  183. fd_dev->fd_dev_id = fd_host->fd_host_dev_id_count++;
  184. fd_dev->fd_queue_depth = dev->queue_depth;
  185. pr_debug("CORE_FILE[%u] - Added TCM FILEIO Device ID: %u at %s,"
  186. " %llu total bytes\n", fd_host->fd_host_id, fd_dev->fd_dev_id,
  187. fd_dev->fd_dev_name, fd_dev->fd_dev_size);
  188. putname(dev_p);
  189. return dev;
  190. fail:
  191. if (fd_dev->fd_file) {
  192. filp_close(fd_dev->fd_file, NULL);
  193. fd_dev->fd_file = NULL;
  194. }
  195. putname(dev_p);
  196. return ERR_PTR(ret);
  197. }
  198. /* fd_free_device(): (Part of se_subsystem_api_t template)
  199. *
  200. *
  201. */
  202. static void fd_free_device(void *p)
  203. {
  204. struct fd_dev *fd_dev = p;
  205. if (fd_dev->fd_file) {
  206. filp_close(fd_dev->fd_file, NULL);
  207. fd_dev->fd_file = NULL;
  208. }
  209. kfree(fd_dev);
  210. }
  211. static int fd_do_readv(struct se_cmd *cmd, struct scatterlist *sgl,
  212. u32 sgl_nents)
  213. {
  214. struct se_device *se_dev = cmd->se_dev;
  215. struct fd_dev *dev = se_dev->dev_ptr;
  216. struct file *fd = dev->fd_file;
  217. struct scatterlist *sg;
  218. struct iovec *iov;
  219. mm_segment_t old_fs;
  220. loff_t pos = (cmd->t_task_lba *
  221. se_dev->se_sub_dev->se_dev_attrib.block_size);
  222. int ret = 0, i;
  223. iov = kzalloc(sizeof(struct iovec) * sgl_nents, GFP_KERNEL);
  224. if (!iov) {
  225. pr_err("Unable to allocate fd_do_readv iov[]\n");
  226. return -ENOMEM;
  227. }
  228. for_each_sg(sgl, sg, sgl_nents, i) {
  229. iov[i].iov_len = sg->length;
  230. iov[i].iov_base = sg_virt(sg);
  231. }
  232. old_fs = get_fs();
  233. set_fs(get_ds());
  234. ret = vfs_readv(fd, &iov[0], sgl_nents, &pos);
  235. set_fs(old_fs);
  236. kfree(iov);
  237. /*
  238. * Return zeros and GOOD status even if the READ did not return
  239. * the expected virt_size for struct file w/o a backing struct
  240. * block_device.
  241. */
  242. if (S_ISBLK(fd->f_dentry->d_inode->i_mode)) {
  243. if (ret < 0 || ret != cmd->data_length) {
  244. pr_err("vfs_readv() returned %d,"
  245. " expecting %d for S_ISBLK\n", ret,
  246. (int)cmd->data_length);
  247. return (ret < 0 ? ret : -EINVAL);
  248. }
  249. } else {
  250. if (ret < 0) {
  251. pr_err("vfs_readv() returned %d for non"
  252. " S_ISBLK\n", ret);
  253. return ret;
  254. }
  255. }
  256. return 1;
  257. }
  258. static int fd_do_writev(struct se_cmd *cmd, struct scatterlist *sgl,
  259. u32 sgl_nents)
  260. {
  261. struct se_device *se_dev = cmd->se_dev;
  262. struct fd_dev *dev = se_dev->dev_ptr;
  263. struct file *fd = dev->fd_file;
  264. struct scatterlist *sg;
  265. struct iovec *iov;
  266. mm_segment_t old_fs;
  267. loff_t pos = (cmd->t_task_lba *
  268. se_dev->se_sub_dev->se_dev_attrib.block_size);
  269. int ret, i = 0;
  270. iov = kzalloc(sizeof(struct iovec) * sgl_nents, GFP_KERNEL);
  271. if (!iov) {
  272. pr_err("Unable to allocate fd_do_writev iov[]\n");
  273. return -ENOMEM;
  274. }
  275. for_each_sg(sgl, sg, sgl_nents, i) {
  276. iov[i].iov_len = sg->length;
  277. iov[i].iov_base = sg_virt(sg);
  278. }
  279. old_fs = get_fs();
  280. set_fs(get_ds());
  281. ret = vfs_writev(fd, &iov[0], sgl_nents, &pos);
  282. set_fs(old_fs);
  283. kfree(iov);
  284. if (ret < 0 || ret != cmd->data_length) {
  285. pr_err("vfs_writev() returned %d\n", ret);
  286. return (ret < 0 ? ret : -EINVAL);
  287. }
  288. return 1;
  289. }
  290. static void fd_emulate_sync_cache(struct se_cmd *cmd)
  291. {
  292. struct se_device *dev = cmd->se_dev;
  293. struct fd_dev *fd_dev = dev->dev_ptr;
  294. int immed = (cmd->t_task_cdb[1] & 0x2);
  295. loff_t start, end;
  296. int ret;
  297. /*
  298. * If the Immediate bit is set, queue up the GOOD response
  299. * for this SYNCHRONIZE_CACHE op
  300. */
  301. if (immed)
  302. target_complete_cmd(cmd, SAM_STAT_GOOD);
  303. /*
  304. * Determine if we will be flushing the entire device.
  305. */
  306. if (cmd->t_task_lba == 0 && cmd->data_length == 0) {
  307. start = 0;
  308. end = LLONG_MAX;
  309. } else {
  310. start = cmd->t_task_lba * dev->se_sub_dev->se_dev_attrib.block_size;
  311. if (cmd->data_length)
  312. end = start + cmd->data_length;
  313. else
  314. end = LLONG_MAX;
  315. }
  316. ret = vfs_fsync_range(fd_dev->fd_file, start, end, 1);
  317. if (ret != 0)
  318. pr_err("FILEIO: vfs_fsync_range() failed: %d\n", ret);
  319. if (immed)
  320. return;
  321. if (ret) {
  322. cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
  323. target_complete_cmd(cmd, SAM_STAT_CHECK_CONDITION);
  324. } else {
  325. target_complete_cmd(cmd, SAM_STAT_GOOD);
  326. }
  327. }
  328. static void fd_emulate_write_fua(struct se_cmd *cmd)
  329. {
  330. struct se_device *dev = cmd->se_dev;
  331. struct fd_dev *fd_dev = dev->dev_ptr;
  332. loff_t start = cmd->t_task_lba *
  333. dev->se_sub_dev->se_dev_attrib.block_size;
  334. loff_t end = start + cmd->data_length;
  335. int ret;
  336. pr_debug("FILEIO: FUA WRITE LBA: %llu, bytes: %u\n",
  337. cmd->t_task_lba, cmd->data_length);
  338. ret = vfs_fsync_range(fd_dev->fd_file, start, end, 1);
  339. if (ret != 0)
  340. pr_err("FILEIO: vfs_fsync_range() failed: %d\n", ret);
  341. }
  342. static int fd_execute_cmd(struct se_cmd *cmd, struct scatterlist *sgl,
  343. u32 sgl_nents, enum dma_data_direction data_direction)
  344. {
  345. struct se_device *dev = cmd->se_dev;
  346. int ret = 0;
  347. /*
  348. * Call vectorized fileio functions to map struct scatterlist
  349. * physical memory addresses to struct iovec virtual memory.
  350. */
  351. if (data_direction == DMA_FROM_DEVICE) {
  352. ret = fd_do_readv(cmd, sgl, sgl_nents);
  353. } else {
  354. ret = fd_do_writev(cmd, sgl, sgl_nents);
  355. if (ret > 0 &&
  356. dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0 &&
  357. dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 &&
  358. (cmd->se_cmd_flags & SCF_FUA)) {
  359. /*
  360. * We might need to be a bit smarter here
  361. * and return some sense data to let the initiator
  362. * know the FUA WRITE cache sync failed..?
  363. */
  364. fd_emulate_write_fua(cmd);
  365. }
  366. }
  367. if (ret < 0) {
  368. cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
  369. return ret;
  370. }
  371. if (ret)
  372. target_complete_cmd(cmd, SAM_STAT_GOOD);
  373. return 0;
  374. }
  375. enum {
  376. Opt_fd_dev_name, Opt_fd_dev_size, Opt_fd_buffered_io, Opt_err
  377. };
  378. static match_table_t tokens = {
  379. {Opt_fd_dev_name, "fd_dev_name=%s"},
  380. {Opt_fd_dev_size, "fd_dev_size=%s"},
  381. {Opt_fd_buffered_io, "fd_buffered_io=%d"},
  382. {Opt_err, NULL}
  383. };
  384. static ssize_t fd_set_configfs_dev_params(
  385. struct se_hba *hba,
  386. struct se_subsystem_dev *se_dev,
  387. const char *page, ssize_t count)
  388. {
  389. struct fd_dev *fd_dev = se_dev->se_dev_su_ptr;
  390. char *orig, *ptr, *arg_p, *opts;
  391. substring_t args[MAX_OPT_ARGS];
  392. int ret = 0, arg, token;
  393. opts = kstrdup(page, GFP_KERNEL);
  394. if (!opts)
  395. return -ENOMEM;
  396. orig = opts;
  397. while ((ptr = strsep(&opts, ",\n")) != NULL) {
  398. if (!*ptr)
  399. continue;
  400. token = match_token(ptr, tokens, args);
  401. switch (token) {
  402. case Opt_fd_dev_name:
  403. arg_p = match_strdup(&args[0]);
  404. if (!arg_p) {
  405. ret = -ENOMEM;
  406. break;
  407. }
  408. snprintf(fd_dev->fd_dev_name, FD_MAX_DEV_NAME,
  409. "%s", arg_p);
  410. kfree(arg_p);
  411. pr_debug("FILEIO: Referencing Path: %s\n",
  412. fd_dev->fd_dev_name);
  413. fd_dev->fbd_flags |= FBDF_HAS_PATH;
  414. break;
  415. case Opt_fd_dev_size:
  416. arg_p = match_strdup(&args[0]);
  417. if (!arg_p) {
  418. ret = -ENOMEM;
  419. break;
  420. }
  421. ret = strict_strtoull(arg_p, 0, &fd_dev->fd_dev_size);
  422. kfree(arg_p);
  423. if (ret < 0) {
  424. pr_err("strict_strtoull() failed for"
  425. " fd_dev_size=\n");
  426. goto out;
  427. }
  428. pr_debug("FILEIO: Referencing Size: %llu"
  429. " bytes\n", fd_dev->fd_dev_size);
  430. fd_dev->fbd_flags |= FBDF_HAS_SIZE;
  431. break;
  432. case Opt_fd_buffered_io:
  433. match_int(args, &arg);
  434. if (arg != 1) {
  435. pr_err("bogus fd_buffered_io=%d value\n", arg);
  436. ret = -EINVAL;
  437. goto out;
  438. }
  439. pr_debug("FILEIO: Using buffered I/O"
  440. " operations for struct fd_dev\n");
  441. fd_dev->fbd_flags |= FDBD_USE_BUFFERED_IO;
  442. break;
  443. default:
  444. break;
  445. }
  446. }
  447. out:
  448. kfree(orig);
  449. return (!ret) ? count : ret;
  450. }
  451. static ssize_t fd_check_configfs_dev_params(struct se_hba *hba, struct se_subsystem_dev *se_dev)
  452. {
  453. struct fd_dev *fd_dev = se_dev->se_dev_su_ptr;
  454. if (!(fd_dev->fbd_flags & FBDF_HAS_PATH)) {
  455. pr_err("Missing fd_dev_name=\n");
  456. return -EINVAL;
  457. }
  458. return 0;
  459. }
  460. static ssize_t fd_show_configfs_dev_params(
  461. struct se_hba *hba,
  462. struct se_subsystem_dev *se_dev,
  463. char *b)
  464. {
  465. struct fd_dev *fd_dev = se_dev->se_dev_su_ptr;
  466. ssize_t bl = 0;
  467. bl = sprintf(b + bl, "TCM FILEIO ID: %u", fd_dev->fd_dev_id);
  468. bl += sprintf(b + bl, " File: %s Size: %llu Mode: %s\n",
  469. fd_dev->fd_dev_name, fd_dev->fd_dev_size,
  470. (fd_dev->fbd_flags & FDBD_USE_BUFFERED_IO) ?
  471. "Buffered" : "Synchronous");
  472. return bl;
  473. }
  474. /* fd_get_device_rev(): (Part of se_subsystem_api_t template)
  475. *
  476. *
  477. */
  478. static u32 fd_get_device_rev(struct se_device *dev)
  479. {
  480. return SCSI_SPC_2; /* Returns SPC-3 in Initiator Data */
  481. }
  482. /* fd_get_device_type(): (Part of se_subsystem_api_t template)
  483. *
  484. *
  485. */
  486. static u32 fd_get_device_type(struct se_device *dev)
  487. {
  488. return TYPE_DISK;
  489. }
  490. static sector_t fd_get_blocks(struct se_device *dev)
  491. {
  492. struct fd_dev *fd_dev = dev->dev_ptr;
  493. struct file *f = fd_dev->fd_file;
  494. struct inode *i = f->f_mapping->host;
  495. unsigned long long dev_size;
  496. /*
  497. * When using a file that references an underlying struct block_device,
  498. * ensure dev_size is always based on the current inode size in order
  499. * to handle underlying block_device resize operations.
  500. */
  501. if (S_ISBLK(i->i_mode))
  502. dev_size = (i_size_read(i) - fd_dev->fd_block_size);
  503. else
  504. dev_size = fd_dev->fd_dev_size;
  505. return div_u64(dev_size, dev->se_sub_dev->se_dev_attrib.block_size);
  506. }
  507. static struct se_subsystem_api fileio_template = {
  508. .name = "fileio",
  509. .owner = THIS_MODULE,
  510. .transport_type = TRANSPORT_PLUGIN_VHBA_PDEV,
  511. .write_cache_emulated = 1,
  512. .fua_write_emulated = 1,
  513. .attach_hba = fd_attach_hba,
  514. .detach_hba = fd_detach_hba,
  515. .allocate_virtdevice = fd_allocate_virtdevice,
  516. .create_virtdevice = fd_create_virtdevice,
  517. .free_device = fd_free_device,
  518. .execute_cmd = fd_execute_cmd,
  519. .do_sync_cache = fd_emulate_sync_cache,
  520. .check_configfs_dev_params = fd_check_configfs_dev_params,
  521. .set_configfs_dev_params = fd_set_configfs_dev_params,
  522. .show_configfs_dev_params = fd_show_configfs_dev_params,
  523. .get_device_rev = fd_get_device_rev,
  524. .get_device_type = fd_get_device_type,
  525. .get_blocks = fd_get_blocks,
  526. };
  527. static int __init fileio_module_init(void)
  528. {
  529. return transport_subsystem_register(&fileio_template);
  530. }
  531. static void fileio_module_exit(void)
  532. {
  533. transport_subsystem_release(&fileio_template);
  534. }
  535. MODULE_DESCRIPTION("TCM FILEIO subsystem plugin");
  536. MODULE_AUTHOR("nab@Linux-iSCSI.org");
  537. MODULE_LICENSE("GPL");
  538. module_init(fileio_module_init);
  539. module_exit(fileio_module_exit);