#include <sys/zfs_znode.h>
#include <sys/zap.h>
#include <sys/dbuf.h>
+#include <sys/dmu_objset.h>
/**
* By design including kmem.h overrides the Linux slab interfaces to provide
unsigned int od_dev_set_rdonly:1, /**< osd_ro() called */
od_prop_rdonly:1, /**< ZFS property readonly */
od_xattr_in_sa:1,
- od_quota_iused_est:1,
od_is_ost:1,
od_posix_acl:1;
unsigned char oo_recusize; /* unit size */
};
};
-
-
};
int osd_statfs(const struct lu_env *, struct dt_device *, struct obd_statfs *);
extern const struct dt_index_operations osd_acct_index_ops;
-uint64_t osd_quota_fid2dmu(const struct lu_fid *fid);
+int osd_quota_fid2dmu(const struct lu_fid *fid, uint64_t *oid);
extern struct lu_device_operations osd_lu_ops;
extern struct dt_index_operations osd_dir_ops;
int osd_declare_quota(const struct lu_env *env, struct osd_device *osd,
return 1;
}
+/**
+ * Put the osd object once done with it.
+ *
+ * \param obj osd object that needs to be put
+ */
+static inline void osd_object_put(const struct lu_env *env,
+ struct osd_object *obj)
+{
+ dt_object_put(env, &obj->oo_dt);
+}
+
static inline int osd_object_invariant(const struct lu_object *l)
{
return osd_invariant(osd_obj(l));
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;
DB_DNODE_EXIT(db);
dmu_buf_rele(&db->db, osd_obj_tag);
}
+
+#ifdef HAVE_DMU_USEROBJ_ACCOUNTING
+
+#define OSD_DMU_USEROBJ_PREFIX DMU_OBJACCT_PREFIX
+
+static inline bool osd_dmu_userobj_accounting_available(struct osd_device *osd)
+{
+ if (unlikely(dmu_objset_userobjspace_upgradable(osd->od_os)))
+ dmu_objset_userobjspace_upgrade(osd->od_os);
+
+ return dmu_objset_userobjspace_present(osd->od_os);
+}
+#else
+
+#define OSD_DMU_USEROBJ_PREFIX "obj-"
+
+static inline bool osd_dmu_userobj_accounting_available(struct osd_device *osd)
+{
+ return false;
+}
+#endif /* #ifdef HAVE_DMU_USEROBJ_ACCOUNTING */
+
#endif /* _OSD_INTERNAL_H */