AC_DEFINE(HAVE_SPA_MAXBLOCKSIZE, 1,
[Have spa_maxblocksize in ZFS])
])
+ dnl #
+ dnl # ZFS 0.7.x adds support for large dnodes. This
+ dnl # allows Lustre to optionally specify the size of a
+ dnl # dnode which ZFS will then use to store metadata such
+ dnl # as xattrs. The default dnode size specified by the
+ dnl # 'dnodesize' dataset property will be used unless a
+ dnl # specific value is provided.
+ dnl #
+ LB_CHECK_COMPILE([if zfs defines dmu_object_alloc_dnsize],
+ dmu_object_alloc_dnsize, [
+ #include <sys/dmu.h>
+ #include <sys/dnode.h>
+ ],[
+ objset_t *os = NULL;
+ dmu_object_type_t objtype = DMU_OT_NONE;
+ int blocksize = 0;
+ dmu_object_type_t bonustype = DMU_OT_SA;
+ int dnodesize = DNODE_MIN_SIZE;
+ dmu_tx_t *tx = NULL;
+ uint64_t id;
+
+ id = dmu_object_alloc_dnsize(os, objtype, blocksize,
+ bonustype,
+ DN_BONUS_SIZE(dnodesize),
+ dnodesize, tx);
+ ],[
+ AC_DEFINE(HAVE_DMU_OBJECT_ALLOC_DNSIZE, 1,
+ [Have dmu_object_alloc_dnsize in ZFS])
+ ])
])
AM_CONDITIONAL(ZFS_ENABLED, [test "x$enable_zfs" = xyes])
#define osd_zio_buf_free(buf, size) zio_buf_free(buf, size)
#endif
+#ifdef HAVE_DMU_OBJECT_ALLOC_DNSIZE
+static inline uint64_t
+osd_dmu_object_alloc(objset_t *os, dmu_object_type_t objtype, int blocksize,
+ int dnodesize, dmu_tx_t *tx)
+{
+ if (dnodesize == 0)
+ dnodesize = MAX(dmu_objset_dnodesize(os), DNODE_MIN_SIZE);
+
+ return dmu_object_alloc_dnsize(os, objtype, blocksize, DMU_OT_SA,
+ DN_BONUS_SIZE(dnodesize), dnodesize, tx);
+}
+
+static inline uint64_t
+osd_zap_create_flags(objset_t *os, int normflags, zap_flags_t flags,
+ dmu_object_type_t ot, int leaf_blockshift,
+ int indirect_blockshift, int dnodesize, dmu_tx_t *tx)
+{
+ if (dnodesize == 0)
+ dnodesize = MAX(dmu_objset_dnodesize(os), DNODE_MIN_SIZE);
+
+ return zap_create_flags_dnsize(os, normflags, flags, ot,
+ leaf_blockshift, indirect_blockshift,
+ DMU_OT_SA, DN_BONUS_SIZE(dnodesize),
+ dnodesize, tx);
+}
+#else
+static inline uint64_t
+osd_dmu_object_alloc(objset_t *os, dmu_object_type_t objtype, int blocksize,
+ int dnodesize, dmu_tx_t *tx)
+{
+ return dmu_object_alloc(os, objtype, blocksize, DMU_OT_SA,
+ DN_MAX_BONUSLEN, tx);
+}
+
+static inline uint64_t
+osd_zap_create_flags(objset_t *os, int normflags, zap_flags_t flags,
+ dmu_object_type_t ot, int leaf_blockshift,
+ int indirect_blockshift, int dnodesize, dmu_tx_t *tx)
+{
+ return zap_create_flags(os, normflags, flags, ot, leaf_blockshift,
+ indirect_blockshift, DMU_OT_SA,
+ DN_MAX_BONUSLEN, tx);
+}
+#endif /* HAVE_DMU_OBJECT_ALLOC_DNSIZE */
+
#endif /* _OSD_INTERNAL_H */
fid_seq_is_local_file(fid_seq(fid))))
type = DMU_OTN_UINT8_METADATA;
- /* Create a new DMU object. */
- oid = dmu_object_alloc(osd->od_os, type, 0,
- DMU_OT_SA, DN_MAX_BONUSLEN, tx);
+ /* Create a new DMU object using the default dnode size. */
+ oid = osd_dmu_object_alloc(osd->od_os, type, 0, 0, tx);
rc = -sa_buf_hold(osd->od_os, oid, osd_obj_tag, dbp);
LASSERTF(rc == 0, "sa_buf_hold "LPU64" failed: %d\n", oid, rc);
transaction group. */
LASSERT(tx->tx_txg != 0);
- oid = zap_create_flags(osd->od_os, 0, flags | ZAP_FLAG_HASH64,
- DMU_OT_DIRECTORY_CONTENTS,
- 14, /* == ZFS fzap_default_block_shift */
- DN_MAX_INDBLKSHIFT, /* indirect block shift */
- DMU_OT_SA, DN_MAX_BONUSLEN, tx);
+ oid = osd_zap_create_flags(osd->od_os, 0, flags | ZAP_FLAG_HASH64,
+ DMU_OT_DIRECTORY_CONTENTS,
+ 14, /* == ZFS fzap_default_blockshift */
+ DN_MAX_INDBLKSHIFT, /* indirect blockshift */
+ 0, tx);
rc = -sa_buf_hold(osd->od_os, oid, osd_obj_tag, zap_dbp);
if (rc)