The ZFS macro DN_MAX_BONUSLEN was deprecated as of ZFS 0.7.0. Lustre
should instead use the compatibility wrappers such as
osd_dmu_object_alloc() and osd_zap_create_flags(). The reason for the
API change is that ZFS 0.7.0 adds support for variable length dnodes,
so the maximum bonus length should not be treated as a fixed
constant. The maximum bonus length may vary by dnode and by dataset,
and it should be derived accordingly.
This change:
- Adds an additional compatibility function osd_obj_bonuslen(obj) to
obtain a maximum bonus length given an osd_object.
- Updates code that uses the deprecated macro to instead use
appropriate compatibility interfaces.
- Removes the definition of DN_MAX_BONUSLEN that was added in commit
49fc02fb738e9420ab10c5a7d41534c7a55b8ea0 to ensure that future
builds using the deprecated macro will fail.
- Adds DN_MAX_BONUSLEN and DN_OLD_MAX_BONUSLEN to the list of
deprecated interfaces in checkpatch.pl.
Signed-off-by: Ned Bass <bass6@llnl.gov>
Change-Id: I1fcc84e55b39ca49a88acb909b5e3294f3b46723
Reviewed-on: https://review.whamcloud.com/26078
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
'f_dentry', 'f_path.dentry',
'= seq_printf', 'seq_printf',
'return seq_printf', 'seq_printf',
+
+ 'DN_MAX_BONUSLEN', 'DN_BONUS_SIZE(dnodesize)',
+ 'DN_OLD_MAX_BONUSLEN', 'DN_BONUS_SIZE(DNODE_MIN_SIZE)',
);
my @rawlines = ();
unsigned char oo_recusize; /* unit size */
};
};
-
-
};
int osd_statfs(const struct lu_env *, struct dt_device *, struct obd_statfs *);
DMU_OT_SA, DN_BONUS_SIZE(dnodesize),
dnodesize, tx);
}
+
+static inline int
+osd_obj_bonuslen(struct osd_object *obj)
+{
+ int bonuslen = DN_BONUS_SIZE(DNODE_MIN_SIZE);
+
+ if (obj->oo_dn != NULL && obj->oo_dn->dn_num_slots != 0) {
+ bonuslen = DN_SLOTS_TO_BONUSLEN(obj->oo_dn->dn_num_slots);
+ } else {
+ objset_t *os = osd_dtobj2objset(&obj->oo_dt);
+ int dnodesize;
+
+ if (os != NULL) {
+ dnodesize = dmu_objset_dnodesize(os);
+ if (dnodesize != 0)
+ bonuslen = DN_BONUS_SIZE(dnodesize);
+ }
+ }
+
+ return bonuslen;
+}
#else
static inline uint64_t
osd_dmu_object_alloc(objset_t *os, dmu_object_type_t objtype, int blocksize,
indirect_blockshift, DMU_OT_SA,
DN_MAX_BONUSLEN, tx);
}
+
+static inline int
+osd_obj_bonuslen(struct osd_object *obj)
+{
+ return DN_MAX_BONUSLEN;
+}
#endif /* HAVE_DMU_OBJECT_ALLOC_DNSIZE */
#ifdef HAVE_DMU_PREFETCH_6ARG
dmu_prefetch((os), (obj), (lvl), (off))
#endif
-#ifndef DN_MAX_BONUSLEN
-#define DN_MAX_BONUSLEN DN_OLD_MAX_BONUSLEN
-#endif
-
static inline void osd_dnode_rele(dnode_t *dn)
{
dmu_buf_impl_t *db;
return rc;
}
- oid = zap_create_flags(o->od_os, 0, 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(o->od_os, 0, ZAP_FLAG_HASH64,
+ DMU_OT_DIRECTORY_CONTENTS,
+ 14, /* == ZFS fzap_default_block_shift */
+ DN_MAX_INDBLKSHIFT,
+ 0, tx);
rc = -sa_handle_get(o->od_os, oid, NULL, SA_HDL_PRIVATE, &sa_hdl);
if (rc)
struct osd_thandle *oh)
{
dmu_tx_t *tx = oh->ot_tx;
+ int bonuslen;
if (unlikely(obj->oo_destroyed))
return;
return;
}
+ bonuslen = osd_obj_bonuslen(obj);
+
/* the object doesn't exist, but we've declared bonus
* in osd_declare_object_create() yet */
- if (obj->oo_ea_in_bonus > DN_MAX_BONUSLEN) {
+ if (obj->oo_ea_in_bonus > bonuslen) {
/* spill has been declared already */
- } else if (obj->oo_ea_in_bonus + vallen > DN_MAX_BONUSLEN) {
+ } else if (obj->oo_ea_in_bonus + vallen > bonuslen) {
/* we're about to exceed bonus, let's declare spill */
dmu_tx_hold_spill(tx, DMU_NEW_OBJECT);
}