Whamcloud - gitweb
LU-3903 osd-zfs: Remove dead property handling code 85/7685/3
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 25 Sep 2013 16:12:53 +0000 (09:12 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 2 Oct 2013 03:03:01 +0000 (03:03 +0000)
The udmu_userprop_get_str(), udmu_userprop_set_str(), and
udmu_objset_name_get() functions are all currently unused.
Therefore this code is removed from the zfs osd.

If manipulation of zfs dataset properties is needed in the
future it can be done through the existing dsl_prop_get(),
dsl_prop_set_int(), and dsl_prop_set_string() interfaces.

This patch allows Lustre to cleanly build with versions
of zfs newer than 0.6.2.

Change-Id: I15b1ef8825dcdbed1572990d230776485d627457
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-on: http://review.whamcloud.com/7685
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
lustre/osd-zfs/udmu.c
lustre/osd-zfs/udmu.h

index f36f026..ce3df6a 100644 (file)
@@ -341,122 +341,6 @@ uint64_t udmu_objset_user_iused(udmu_objset_t *uos, uint64_t uidbytes)
        return uidobjs;
 }
 
        return uidobjs;
 }
 
-/* Get the objset name.
-   buf must have at least MAXNAMELEN bytes */
-void udmu_objset_name_get(udmu_objset_t *uos, char *buf)
-{
-       dmu_objset_name(uos->os, buf);
-}
-
-static int udmu_userprop_setup(udmu_objset_t *uos, const char *prop_name,
-               char **os_name, char **real_prop)
-{
-       if (os_name != NULL) {
-               *os_name = kmem_alloc(MAXNAMELEN, KM_SLEEP);
-               udmu_objset_name_get(uos, *os_name);
-       }
-
-       *real_prop = kmem_alloc(MAXNAMELEN, KM_SLEEP);
-
-       if (snprintf(*real_prop, MAXNAMELEN, "lustre:%s", prop_name) >=
-                       MAXNAMELEN) {
-               if (os_name != NULL)
-                       kmem_free(*os_name, MAXNAMELEN);
-               kmem_free(*real_prop, MAXNAMELEN);
-
-               CERROR("property name too long: %s\n", prop_name);
-               return ENAMETOOLONG;
-       }
-
-       return 0;
-}
-
-static void udmu_userprop_cleanup(char **os_name, char **real_prop)
-{
-       if (os_name != NULL)
-               kmem_free(*os_name, MAXNAMELEN);
-       kmem_free(*real_prop, MAXNAMELEN);
-}
-
-/* Set ZFS user property 'prop_name' of objset 'uos' to string 'val' */
-int udmu_userprop_set_str(udmu_objset_t *uos, const char *prop_name,
-               const char *val)
-{
-       char *os_name;
-       char *real_prop;
-       int rc;
-
-       rc = udmu_userprop_setup(uos, prop_name, &os_name, &real_prop);
-       if (rc != 0)
-               return rc;
-
-       rc = dsl_prop_set(os_name, real_prop, ZPROP_SRC_LOCAL, 1,
-                       strlen(val) + 1, val);
-       udmu_userprop_cleanup(&os_name, &real_prop);
-
-       return rc;
-}
-
-/* Get ZFS user property 'prop_name' of objset 'uos' into buffer 'buf' of size
-   'buf_size' */
-int udmu_userprop_get_str(udmu_objset_t *uos, const char *prop_name, char *buf,
-                               size_t buf_size)
-{
-       char *real_prop;
-       char *nvp_val;
-       size_t nvp_len;
-       nvlist_t *nvl = NULL;
-       nvlist_t *nvl_val;
-       nvpair_t *elem = NULL;
-       int rc;
-
-       rc = udmu_userprop_setup(uos, prop_name, NULL, &real_prop);
-       if (rc != 0)
-               return rc;
-
-       /* We can't just pass buf_size to dsl_prop_get() because it expects the
-          exact value size (zap_lookup() requirement), so we must get all props
-          and extract the one we want. */
-       rc = dsl_prop_get_all(uos->os, &nvl);
-       if (rc != 0) {
-               nvl = NULL;
-               goto out;
-       }
-
-       while ((elem = nvlist_next_nvpair(nvl, elem)) != NULL) {
-               const char *name = nvpair_name(elem);
-               if (strcmp(name, real_prop) != 0)
-                       continue;
-
-               /* Got the property we were looking for, but the val is not the
-                  string yet, it's an nvlist */
-
-               rc = nvpair_value_nvlist(elem, &nvl_val);
-               if (rc != 0)
-                       goto out;
-
-               rc = nvlist_lookup_string(nvl_val, ZPROP_VALUE, &nvp_val);
-               if (rc != 0)
-                       goto out;
-
-               nvp_len = strlen(nvp_val);
-               if (buf_size < nvp_len + 1) {
-                       rc = EOVERFLOW;
-                       goto out;
-               }
-               strcpy(buf, nvp_val);
-               goto out;
-       }
-       /* Not found */
-       rc = ENOENT;
-out:
-       if (nvl != NULL)
-               nvlist_free(nvl);
-       udmu_userprop_cleanup(NULL, &real_prop);
-
-       return rc;
-}
-
 /* We don't actually have direct access to the zap_hashbits() function
  * so just pretend like we do for now.  If this ever breaks we can look at
  * it at that time. */
 /* We don't actually have direct access to the zap_hashbits() function
  * so just pretend like we do for now.  If this ever breaks we can look at
  * it at that time. */
index 1939147..9fec38f 100644 (file)
@@ -91,15 +91,6 @@ int udmu_objset_root(udmu_objset_t *uos, dmu_buf_t **dbp, void *tag);
 uint64_t udmu_get_txg(udmu_objset_t *uos, dmu_tx_t *tx);
 int udmu_blk_insert_cost(void);
 
 uint64_t udmu_get_txg(udmu_objset_t *uos, dmu_tx_t *tx);
 int udmu_blk_insert_cost(void);
 
-/* buf must have at least MAXNAMELEN bytes */
-void udmu_objset_name_get(udmu_objset_t *uos, char *buf);
-
-/* get/set ZFS user properties */
-int udmu_userprop_set_str(udmu_objset_t *uos, const char *prop_name,
-                         const char *val);
-int udmu_userprop_get_str(udmu_objset_t *uos, const char *prop_name, char *buf,
-                         size_t buf_size);
-
 /* zap cursor apis */
 int udmu_zap_cursor_init(zap_cursor_t **zc, udmu_objset_t *uos,
                uint64_t zapobj, uint64_t hash);
 /* zap cursor apis */
 int udmu_zap_cursor_init(zap_cursor_t **zc, udmu_objset_t *uos,
                uint64_t zapobj, uint64_t hash);