The sa_spill_alloc()/sa_spill_free() interfaces have been retired.
Callers may either use the more memory efficient zio_buf_alloc()/
zio_buf_free() which are now exported, or they may use their own
allocator.
For the purposes of this patch an osd_zio_buf_alloc()/
osd_zio_buf_free() wrapper function was introduced which layers
on whichever interface is provided.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Change-Id: Id1d19d7b4c440808b8b3fd042f687b10c1b869f2
Reviewed-on: http://review.whamcloud.com/13097
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
AC_DEFINE(HAVE_DSL_SYNC_TASK_DO_NOWAIT, 1,
[Have dsl_sync_task_do_nowait in ZFS])
])
+ LB_CHECK_COMPILE([if zfs defines sa_spill_alloc],
+ sa_spill_alloc, [
+ #include <sys/kmem.h>
+ #include <sys/sa.h>
+ ],[
+ void *ptr;
+
+ ptr = sa_spill_alloc(KM_SLEEP);
+ sa_spill_free(ptr);
+ ],[
+ AC_DEFINE(HAVE_SA_SPILL_ALLOC, 1,
+ [Have sa_spill_alloc in ZFS])
+ ])
])
AM_CONDITIONAL(ZFS_ENABLED, [test "x$enable_zfs" = xyes])
#endif
+#ifdef HAVE_SA_SPILL_ALLOC
+static inline void *
+osd_zio_buf_alloc(size_t size)
+{
+ return sa_spill_alloc(KM_SLEEP);
+}
+
+static inline void
+osd_zio_buf_free(void *buf, size_t size)
+{
+ sa_spill_free(buf);
+}
+#else
+#define osd_zio_buf_alloc(size) zio_buf_alloc(size)
+#define osd_zio_buf_free(buf, size) zio_buf_free(buf, size)
+#endif
+
#endif /* _OSD_INTERNAL_H */
goto out_sa;
}
- buf = sa_spill_alloc(KM_SLEEP);
+ buf = osd_zio_buf_alloc(size);
if (buf == NULL) {
rc = -ENOMEM;
goto out_sa;
rc = -sa_lookup(sa_hdl, SA_ZPL_DXATTR(osd), buf, size);
if (rc == 0)
rc = -nvlist_unpack(buf, size, sa, KM_SLEEP);
- sa_spill_free(buf);
+ osd_zio_buf_free(buf, size);
out_sa:
sa_handle_destroy(sa_hdl);
if (rc)
return rc;
- dxattr = sa_spill_alloc(KM_SLEEP);
+ dxattr = osd_zio_buf_alloc(sa_size);
if (dxattr == NULL)
RETURN(-ENOMEM);
rc = osd_object_sa_update(obj, SA_ZPL_DXATTR(osd), dxattr, sa_size, oh);
out_free:
- sa_spill_free(dxattr);
+ osd_zio_buf_free(dxattr, sa_size);
RETURN(rc);
}