objlayout.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Data types and function declerations for interfacing with the
  3. * pNFS standard object layout driver.
  4. *
  5. * Copyright (C) 2007 Panasas Inc. [year of first publication]
  6. * All rights reserved.
  7. *
  8. * Benny Halevy <bhalevy@panasas.com>
  9. * Boaz Harrosh <bharrosh@panasas.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2
  13. * See the file COPYING included with this distribution for more details.
  14. *
  15. * Redistribution and use in source and binary forms, with or without
  16. * modification, are permitted provided that the following conditions
  17. * are met:
  18. *
  19. * 1. Redistributions of source code must retain the above copyright
  20. * notice, this list of conditions and the following disclaimer.
  21. * 2. Redistributions in binary form must reproduce the above copyright
  22. * notice, this list of conditions and the following disclaimer in the
  23. * documentation and/or other materials provided with the distribution.
  24. * 3. Neither the name of the Panasas company nor the names of its
  25. * contributors may be used to endorse or promote products derived
  26. * from this software without specific prior written permission.
  27. *
  28. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  29. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  30. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  32. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  34. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  35. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  36. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  37. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  38. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. */
  40. #ifndef _OBJLAYOUT_H
  41. #define _OBJLAYOUT_H
  42. #include <linux/nfs_fs.h>
  43. #include <linux/pnfs_osd_xdr.h>
  44. #include "../pnfs.h"
  45. /*
  46. * per-inode layout
  47. */
  48. struct objlayout {
  49. struct pnfs_layout_hdr pnfs_layout;
  50. };
  51. static inline struct objlayout *
  52. OBJLAYOUT(struct pnfs_layout_hdr *lo)
  53. {
  54. return container_of(lo, struct objlayout, pnfs_layout);
  55. }
  56. /*
  57. * Raid engine I/O API
  58. */
  59. extern int objio_alloc_lseg(struct pnfs_layout_segment **outp,
  60. struct pnfs_layout_hdr *pnfslay,
  61. struct pnfs_layout_range *range,
  62. struct xdr_stream *xdr,
  63. gfp_t gfp_flags);
  64. extern void objio_free_lseg(struct pnfs_layout_segment *lseg);
  65. /*
  66. * callback API
  67. */
  68. extern int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay,
  69. struct nfs4_deviceid *d_id, struct pnfs_osd_deviceaddr **deviceaddr,
  70. gfp_t gfp_flags);
  71. extern void objlayout_put_deviceinfo(struct pnfs_osd_deviceaddr *deviceaddr);
  72. /*
  73. * exported generic objects function vectors
  74. */
  75. extern struct pnfs_layout_hdr *objlayout_alloc_layout_hdr(struct inode *, gfp_t gfp_flags);
  76. extern void objlayout_free_layout_hdr(struct pnfs_layout_hdr *);
  77. extern struct pnfs_layout_segment *objlayout_alloc_lseg(
  78. struct pnfs_layout_hdr *,
  79. struct nfs4_layoutget_res *,
  80. gfp_t gfp_flags);
  81. extern void objlayout_free_lseg(struct pnfs_layout_segment *);
  82. #endif /* _OBJLAYOUT_H */