+static inline int osd_zap_add(struct osd_device *osd, uint64_t zap,
+ dnode_t *dn, const char *key,
+ int int_size, int int_num,
+ const void *val, dmu_tx_t *tx)
+{
+ LASSERT(zap != 0);
+
+#ifdef HAVE_ZAP_ADD_BY_DNODE
+ if (dn)
+ return -zap_add_by_dnode(dn, key, int_size, int_num, val, tx);
+#endif
+ return -zap_add(osd->od_os, zap, key, int_size, int_num, val, tx);
+}
+
+static inline int osd_zap_remove(struct osd_device *osd, uint64_t zap,
+ dnode_t *dn, const char *key,
+ dmu_tx_t *tx)
+{
+ LASSERT(zap != 0);
+
+#ifdef HAVE_ZAP_ADD_BY_DNODE
+ if (dn)
+ return -zap_remove_by_dnode(dn, key, tx);
+#endif
+ return -zap_remove(osd->od_os, zap, key, tx);
+}
+
+
+static inline int osd_zap_lookup(struct osd_device *osd, uint64_t zap,
+ dnode_t *dn, const char *key,
+ int int_size, int int_num, void *v)
+{
+ LASSERT(zap != 0);
+
+#ifdef HAVE_ZAP_ADD_BY_DNODE
+ if (dn)
+ return -zap_lookup_by_dnode(dn, key, int_size, int_num, v);
+#endif
+ return -zap_lookup(osd->od_os, zap, key, int_size, int_num, v);
+}
+
+static inline void osd_tx_hold_zap(dmu_tx_t *tx, uint64_t zap,
+ dnode_t *dn, int add, const char *name)
+{
+#ifdef HAVE_DMU_TX_HOLD_ZAP_BY_DNODE
+ if (dn) {
+ dmu_tx_hold_zap_by_dnode(tx, dn, add, name);
+ return;
+ }
+#endif
+ dmu_tx_hold_zap(tx, zap, add, name);
+}
+
+static inline void osd_tx_hold_write(dmu_tx_t *tx, uint64_t oid,
+ dnode_t *dn, uint64_t off, int len)
+{
+#ifdef HAVE_DMU_TX_HOLD_ZAP_BY_DNODE
+ if (dn) {
+ dmu_tx_hold_write_by_dnode(tx, dn, off, len);
+ return;
+ }
+#endif
+ dmu_tx_hold_write(tx, oid, off, len);
+}
+
+static inline void osd_dmu_write(struct osd_device *osd, dnode_t *dn,
+ uint64_t offset, uint64_t size,
+ const char *buf, dmu_tx_t *tx)
+{
+ LASSERT(dn);
+#ifdef HAVE_DMU_WRITE_BY_DNODE
+ dmu_write_by_dnode(dn, offset, size, buf, tx);
+#else
+ dmu_write(osd->od_os, dn->dn_object, offset, size, buf, tx);
+#endif
+}
+
+static inline int osd_dmu_read(struct osd_device *osd, dnode_t *dn,
+ uint64_t offset, uint64_t size,
+ char *buf, int flags)
+{
+ LASSERT(dn);
+#ifdef HAVE_DMU_READ_BY_DNODE
+ return -dmu_read_by_dnode(dn, offset, size, buf, flags);
+#else
+ return -dmu_read(osd->od_os, dn->dn_object, offset, size, buf, flags);
+#endif
+}
+