Whamcloud - gitweb
LU-6767 osd-zfs: Track readonly status of ZFS
[fs/lustre-release.git] / lustre / osd-zfs / osd_internal.h
index c698db1..62543f8 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -203,6 +203,8 @@ static inline struct osd_thread_info *osd_oti_get(const struct lu_env *env)
 struct osd_thandle {
        struct thandle           ot_super;
        struct list_head         ot_dcb_list;
+       struct list_head         ot_stop_dcb_list;
+       struct list_head         ot_unlinked_list;
        struct list_head         ot_sa_list;
        struct semaphore         ot_sa_lock;
        dmu_tx_t                *ot_tx;
@@ -245,6 +247,7 @@ struct osd_device {
        /* 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 */
        /* SA attr mapping->id,
         * name is the same as in ZFS to use defines SA_ZPL_...*/
        sa_attr_type_t           *z_attr_table;
@@ -259,7 +262,8 @@ struct osd_device {
        unsigned int             od_oi_count;
        struct osd_seq_list     od_seq_list;
 
-       unsigned int             od_rdonly:1,
+       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,
@@ -295,6 +299,12 @@ struct osd_device {
        struct lu_client_seq    *od_cl_seq;
 };
 
+enum osd_destroy_type {
+       OSD_DESTROY_NONE = 0,
+       OSD_DESTROY_SYNC = 1,
+       OSD_DESTROY_ASYNC = 2,
+};
+
 struct osd_object {
        struct dt_object         oo_dt;
        /*
@@ -308,6 +318,7 @@ struct osd_object {
        sa_handle_t             *oo_sa_hdl;
        nvlist_t                *oo_sa_xattr;
        struct list_head         oo_sa_linkage;
+       struct list_head         oo_unlinked_linkage;
 
        struct rw_semaphore      oo_sem;
 
@@ -315,10 +326,12 @@ struct osd_object {
        rwlock_t                 oo_attr_lock;
        struct lu_attr           oo_attr;
 
-       /* protects extended attributes */
+       /* protects extended attributes and oo_unlinked_linkage */
        struct semaphore         oo_guard;
        uint64_t                 oo_xattr;
+       enum osd_destroy_type    oo_destroy;
 
+       __u32                    oo_destroyed:1;
        /* record size for index file */
        unsigned char            oo_keysize;
        unsigned char            oo_recsize;
@@ -450,8 +463,6 @@ int osd_fid_lookup(const struct lu_env *env,
 uint64_t osd_get_name_n_idx(const struct lu_env *env, struct osd_device *osd,
                            const struct lu_fid *fid, char *buf);
 int osd_options_init(void);
-int osd_convert_root_to_new_seq(const struct lu_env *env,
-                               struct osd_device *o);
 int osd_ost_seq_exists(const struct lu_env *env, struct osd_device *osd,
                       __u64 seq);
 /* osd_index.c */
@@ -484,6 +495,11 @@ int osd_declare_xattr_del(const struct lu_env *env, struct dt_object *dt,
                          const char *name, struct thandle *handle);
 int osd_xattr_del(const struct lu_env *env, struct dt_object *dt,
                  const char *name, struct thandle *handle);
+void osd_declare_xattrs_destroy(const struct lu_env *env,
+                               struct osd_object *obj,
+                               struct osd_thandle *oh);
+int osd_xattrs_destroy(const struct lu_env *env,
+                      struct osd_object *obj, struct osd_thandle *oh);
 int osd_xattr_list(const struct lu_env *env, struct dt_object *dt,
                   const struct lu_buf *lb);
 void __osd_xattr_declare_set(const struct lu_env *env, struct osd_object *obj,