nfs-ganesha 1.4

fsal_mds.c

Go to the documentation of this file.
00001 /*
00002  * vim:expandtab:shiftwidth=8:tabstop=8:
00003  *
00004  * Copyright (C) 2010 The Linux Box Corporation
00005  * All Rights Reserved
00006  * Contributor: Adam C. Emerson
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 3 of the License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021  *
00022  * ---------------------------------------
00023  */
00024 
00035 #ifdef HAVE_CONFIG_H
00036 #include "config.h"
00037 #endif
00038 
00039 #include "fsal.h"
00040 #include "fsal_internal.h"
00041 #include "fsal_convert.h"
00042 #include "nfsv41.h"
00043 #include <fcntl.h>
00044 #include "HashTable.h"
00045 #include <pthread.h>
00046 #include <stdint.h>
00047 #include "fsal_types.h"
00048 #include "fsal_pnfs.h"
00049 #include "pnfs_common.h"
00050 #include "fsal_pnfs_files.h"
00051 
00052 const size_t BIGGEST_PATTERN = 1024; /* Linux supports a stripe
00053                                         pattern with no more than 4096
00054                                         stripes, but for now we stick
00055                                         to 1024 to keep them da_addrs
00056                                         from being too gigantic. */
00057 
00058 
00059 nfsstat4 LUSTREFSAL_layoutget( fsal_handle_t                   * exthandle,
00060                                fsal_op_context_t               * extcontext,
00061                                XDR                             * loc_body,
00062                                const struct fsal_layoutget_arg * arg,
00063                                struct fsal_layoutget_res       * res)
00064 {
00065      /* We support only LAYOUT4_NFSV4_1_FILES layouts */
00066      if (arg->type != LAYOUT4_NFSV4_1_FILES) {
00067           LogCrit(COMPONENT_PNFS,
00068                   "Unsupported layout type: %x",
00069                   arg->type);
00070           return NFS4ERR_UNKNOWN_LAYOUTTYPE;
00071      }
00072 
00073      return NFS4_OK;
00074 } /* LUSTREFSAL_layoutget */
00075 
00076 nfsstat4 LUSTREFSAL_layoutreturn( fsal_handle_t                      * handle,
00077                                   fsal_op_context_t                  * context,
00078                                   XDR                                * lrf_body,
00079                                   const struct fsal_layoutreturn_arg * arg)
00080 
00081 {
00082      /* Sanity check on type */
00083      if (arg->lo_type != LAYOUT4_NFSV4_1_FILES) {
00084           LogCrit(COMPONENT_PNFS,
00085                   "Unsupported layout type: %x",
00086                   arg->lo_type);
00087           return NFS4ERR_UNKNOWN_LAYOUTTYPE;
00088      }
00089 
00090      /* Since we no longer store DS addresses, we no longer have
00091         anything to free.  Later on we should unravel the Ceph client
00092         a bit more and coordinate with the Ceph MDS's notion of read
00093         and write pins, but that isn't germane until we have
00094         LAYOUTRECALL. */
00095 
00096      return NFS4_OK;
00097 } /* LUSTREFSAL_layoutreturn */
00098 
00099 nfsstat4 LUSTREFSAL_layoutcommit( fsal_handle_t                      * exthandle,
00100                                   fsal_op_context_t                  * extcontext,
00101                                   XDR                                * lou_body,
00102                                   const struct fsal_layoutcommit_arg * arg,
00103                                   struct fsal_layoutcommit_res       * res)
00104 {
00105      /* Sanity check on type */
00106      if (arg->type != LAYOUT4_NFSV4_1_FILES) {
00107           LogCrit(COMPONENT_PNFS,
00108                   "Unsupported layout type: %x",
00109                   arg->type);
00110           return NFS4ERR_UNKNOWN_LAYOUTTYPE;
00111      }
00112 
00113      return NFS4_OK;
00114 }
00115 
00116 nfsstat4 LUSTREFSAL_getdeviceinfo( fsal_op_context_t          * extcontext,
00117                                    XDR                        * da_addr_body,
00118                                    layouttype4                  type,
00119                                    const struct pnfs_deviceid * deviceid)
00120 {
00121      /* Sanity check on type */
00122      if (type != LAYOUT4_NFSV4_1_FILES) {
00123           LogCrit(COMPONENT_PNFS,
00124                   "Unsupported layout type: %x",
00125                   type);
00126           return NFS4ERR_UNKNOWN_LAYOUTTYPE;
00127      }
00128 
00129      return NFS4_OK;
00130 } /* LUSTREFSAL_getdeviceinfo */
00131 
00132 nfsstat4 LUSTREFSAL_getdevicelist( fsal_handle_t                        * handle,
00133                                    fsal_op_context_t                    * context,
00134                                    const struct fsal_getdevicelist_arg  * arg,
00135                                    struct fsal_getdevicelist_res        * res)
00136 {
00137      /* Sanity check on type */
00138      if (arg->type != LAYOUT4_NFSV4_1_FILES) {
00139           LogCrit(COMPONENT_PNFS,
00140                   "Unsupported layout type: %x",
00141                   arg->type);
00142           return NFS4ERR_UNKNOWN_LAYOUTTYPE;
00143      }
00144 
00145      /* We have neither the ability nor the desire to return all valid
00146         deviceids, so we do nothing successfully. */
00147 
00148      res->count = 0;
00149      res->eof = TRUE;
00150 
00151      return NFS4_OK;
00152 } /* LUSTREFSAL_getdevicelist */