Whamcloud - gitweb
LU-8753 osp: add rpc generation
[fs/lustre-release.git] / lustre / osp / osp_internal.h
index 999da87..481932d 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2015, Intel Corporation.
+ * Copyright (c) 2012, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -92,6 +88,7 @@ struct osp_precreate {
        int                              osp_pre_create_slow;
        /* cleaning up orphans or recreating missing objects */
        int                              osp_pre_recovering;
+       int                              osp_pre_delorphan_sent;
 };
 
 struct osp_update_request_sub {
@@ -118,6 +115,7 @@ struct osp_update_request {
        struct osp_thandle              *our_th;
 
        __u64                           our_version;
+       __u64                           our_generation;
        /* protect our_list and flag */
        spinlock_t                      our_list_lock;
        /* linked to the list(ou_list) in osp_updates */
@@ -131,9 +129,22 @@ struct osp_updates {
        struct list_head        ou_list;
        spinlock_t              ou_lock;
        wait_queue_head_t       ou_waitq;
-       /* wait for next updates */
+
+       /* The next rpc version which supposed to be sent in
+        * osp_send_update_thread().*/
        __u64                   ou_rpc_version;
+
+       /* The rpc version assigned to the osp thandle during (osp_md_write()),
+        * which will be sent by this order. Note: the osp_thandle has be sent
+        * by this order to make sure the remote update log will follow the
+        * llog format rule. XXX: these probably should be removed once we
+        * invent new llog format */
        __u64                   ou_version;
+
+       /* The generation of current osp update RPC, which is used to make sure
+        * those stale RPC(with older generation) will not be sent, otherwise it
+        * will cause update lllog corruption */
+       __u64                   ou_generation;
 };
 
 struct osp_device {
@@ -251,6 +262,12 @@ struct osp_device {
        struct list_head                 opd_async_updates;
        struct rw_semaphore              opd_async_updates_rwsem;
        atomic_t                         opd_async_updates_count;
+
+       /*
+        * Limit the object allocation using ENOSPC for opd_pre_status
+        */
+       int                             opd_reserved_mb_high;
+       int                             opd_reserved_mb_low;
 };
 
 #define opd_pre_lock                   opd_pre->osp_pre_lock
@@ -734,6 +751,7 @@ int osp_declare_xattr_del(const struct lu_env *env, struct dt_object *dt,
 int osp_xattr_del(const struct lu_env *env, struct dt_object *dt,
                  const char *name, struct thandle *th);
 int osp_invalidate(const struct lu_env *env, struct dt_object *dt);
+void osp_obj_invalidate_cache(struct osp_object *obj);
 
 int osp_trans_stop(const struct lu_env *env, struct dt_device *dt,
                   struct thandle *th);