/* information about underlying file system */
struct objset *od_os;
uint64_t od_rootid; /* id of root znode */
- uint64_t od_unlinkedid; /* id of unlinked zapobj */
+ dnode_t *od_unlinked; /* dnode of unlinked zapobj */
/* SA attr mapping->id,
* name is the same as in ZFS to use defines SA_ZPL_...*/
sa_attr_type_t *z_attr_table;
struct lu_site od_site;
/* object IDs of the inode accounting indexes */
- uint64_t od_iusr_oid;
- uint64_t od_igrp_oid;
+ uint64_t od_iusr_oid;
+ uint64_t od_igrp_oid;
+ dnode_t *od_groupused_dn;
+ dnode_t *od_userused_dn;
/* quota slave instance */
struct qsd_instance *od_quota_slave;
int osd_statfs(const struct lu_env *, struct dt_device *, struct obd_statfs *);
extern const struct dt_index_operations osd_acct_index_ops;
-int osd_quota_fid2dmu(const struct lu_fid *fid, uint64_t *oid);
+dnode_t *osd_quota_fid2dmu(const struct osd_device *, const struct lu_fid *fid);
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,
bool force);
uint64_t osd_objs_count_estimate(uint64_t refdbytes, uint64_t usedobjs,
uint64_t nrblocks, uint64_t est_maxblockshift);
+int osd_unlinked_object_free(const struct lu_env *env, struct osd_device *osd,
+ uint64_t oid);
/*
* Helpers.
/* osd_object.c */
extern char *osd_obj_tag;
void osd_object_sa_dirty_rele(struct osd_thandle *oh);
-int __osd_obj2dnode(const struct lu_env *env, objset_t *os,
- uint64_t oid, dnode_t **dnp);
+int __osd_obj2dnode(objset_t *os, uint64_t oid, dnode_t **dnp);
struct lu_object *osd_object_alloc(const struct lu_env *env,
const struct lu_object_header *hdr,
struct lu_device *d);
int osd_fid_lookup(const struct lu_env *env,
struct osd_device *, const struct lu_fid *, uint64_t *);
uint64_t osd_get_name_n_idx(const struct lu_env *env, struct osd_device *osd,
- const struct lu_fid *fid, char *buf, int bufsize);
+ const struct lu_fid *fid, char *buf, int bufsize,
+ dnode_t **zdn);
int osd_options_init(void);
int osd_ost_seq_exists(const struct lu_env *env, struct osd_device *osd,
__u64 seq);
}
#endif /* #ifdef HAVE_DMU_USEROBJ_ACCOUNTING */
+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
+}
+
#endif /* _OSD_INTERNAL_H */