Whamcloud - gitweb
LU-6401 headers: Create a header for obdo related functions 17/16917/8
authorBen Evans <bevans@cray.com>
Thu, 22 Oct 2015 17:01:30 +0000 (12:01 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 23 Mar 2016 06:03:10 +0000 (06:03 +0000)
Remove all obdo related functions from lustre_idl.h
Create lustre_odbo.h
Include where appropriate, reorganize #include blocks

Signed-off-by: Ben Evans <bevans@cray.com>
Change-Id: I35646ba27a0903bbb64281ad49fd650b10f71d7b
Reviewed-on: http://review.whamcloud.com/16917
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
12 files changed:
lustre/include/Makefile.am
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_obdo.h [new file with mode: 0644]
lustre/osc/osc_io.c
lustre/osc/osc_request.c
lustre/osp/osp_dev.c
lustre/osp/osp_object.c
lustre/osp/osp_precreate.c
lustre/target/out_handler.c
lustre/target/out_lib.c
lustre/target/update_records.c
lustre/target/update_recovery.c

index 8ff5a9f..410b55c 100644 (file)
@@ -80,6 +80,7 @@ EXTRA_DIST = \
        lustre_nrs_fifo.h \
        lustre_nrs_orr.h \
        lustre_nrs_tbf.h \
+       lustre_obdo.h \
        lustre_param.h \
        lustre_patchless_compat.h \
        lustre_quota.h \
index 3cf729f..e51aae3 100644 (file)
@@ -3481,54 +3481,9 @@ enum lfsck_event_flags {
        LEF_QUERY_ALL           = 0x00000020,
 };
 
-static inline void lustre_set_wire_obdo(const struct obd_connect_data *ocd,
-                                       struct obdo *wobdo,
-                                       const struct obdo *lobdo)
-{
-       *wobdo = *lobdo;
-       wobdo->o_flags &= ~OBD_FL_LOCAL_MASK;
-       if (ocd == NULL)
-               return;
-
-       if (unlikely(!(ocd->ocd_connect_flags & OBD_CONNECT_FID)) &&
-           fid_seq_is_echo(ostid_seq(&lobdo->o_oi))) {
-               /* Currently OBD_FL_OSTID will only be used when 2.4 echo
-                * client communicate with pre-2.4 server */
-               wobdo->o_oi.oi.oi_id = fid_oid(&lobdo->o_oi.oi_fid);
-               wobdo->o_oi.oi.oi_seq = fid_seq(&lobdo->o_oi.oi_fid);
-       }
-}
-
-static inline void lustre_get_wire_obdo(const struct obd_connect_data *ocd,
-                                       struct obdo *lobdo,
-                                       const struct obdo *wobdo)
-{
-       __u32 local_flags = 0;
-
-        if (lobdo->o_valid & OBD_MD_FLFLAGS)
-                 local_flags = lobdo->o_flags & OBD_FL_LOCAL_MASK;
-
-       *lobdo = *wobdo;
-       if (local_flags != 0) {
-               lobdo->o_valid |= OBD_MD_FLFLAGS;
-               lobdo->o_flags &= ~OBD_FL_LOCAL_MASK;
-               lobdo->o_flags |= local_flags;
-       }
-       if (ocd == NULL)
-               return;
-
-       if (unlikely(!(ocd->ocd_connect_flags & OBD_CONNECT_FID)) &&
-           fid_seq_is_echo(wobdo->o_oi.oi.oi_seq)) {
-               /* see above */
-               lobdo->o_oi.oi_fid.f_seq = wobdo->o_oi.oi.oi_seq;
-               lobdo->o_oi.oi_fid.f_oid = wobdo->o_oi.oi.oi_id;
-               lobdo->o_oi.oi_fid.f_ver = 0;
-       }
-}
-
 /* request structure for OST's */
 struct ost_body {
-        struct  obdo oa;
+       struct obdo oa;
 };
 
 /* Key for FIEMAP to be used in get_info calls */
@@ -3544,7 +3499,6 @@ void lustre_print_user_md(unsigned int level, struct lov_user_md *lum,
 /* Functions for dumping PTLRPC fields */
 void dump_rniobuf(struct niobuf_remote *rnb);
 void dump_ioo(struct obd_ioobj *nb);
-void dump_obdo(struct obdo *oa);
 void dump_ost_body(struct ost_body *ob);
 void dump_rcs(__u32 *rc);
 
diff --git a/lustre/include/lustre_obdo.h b/lustre/include/lustre_obdo.h
new file mode 100644 (file)
index 0000000..8455b0d
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2014, Intel Corporation.
+ *
+ * Copyright 2015 Cray Inc, all rights reserved.
+ * Author: Ben Evans.
+ *
+ * Define obdo associated functions
+ *   obdo:  OBject Device o...
+ */
+
+#ifndef _LUSTRE_OBDO_H_
+#define _LUSTRE_OBDO_H_
+
+#include <lustre/lustre_idl.h>
+
+/**
+ * Dumper for struct obdo
+ */
+void dump_obdo(struct obdo *oa);
+
+/**
+ * Create an obdo to send over the wire
+ */
+static inline void lustre_set_wire_obdo(const struct obd_connect_data *ocd,
+                                       struct obdo *wobdo,
+                                       const struct obdo *lobdo)
+{
+       *wobdo = *lobdo;
+       wobdo->o_flags &= ~OBD_FL_LOCAL_MASK;
+       if (ocd == NULL)
+               return;
+
+       if (unlikely(!(ocd->ocd_connect_flags & OBD_CONNECT_FID)) &&
+           fid_seq_is_echo(ostid_seq(&lobdo->o_oi))) {
+               /* Currently OBD_FL_OSTID will only be used when 2.4 echo
+                * client communicate with pre-2.4 server */
+               wobdo->o_oi.oi.oi_id = fid_oid(&lobdo->o_oi.oi_fid);
+               wobdo->o_oi.oi.oi_seq = fid_seq(&lobdo->o_oi.oi_fid);
+       }
+}
+
+/**
+ * Create a local obdo from a wire based odbo
+ */
+static inline void lustre_get_wire_obdo(const struct obd_connect_data *ocd,
+                                       struct obdo *lobdo,
+                                       const struct obdo *wobdo)
+{
+       __u32 local_flags = 0;
+
+       if (lobdo->o_valid & OBD_MD_FLFLAGS)
+               local_flags = lobdo->o_flags & OBD_FL_LOCAL_MASK;
+
+       *lobdo = *wobdo;
+       if (local_flags != 0) {
+               lobdo->o_valid |= OBD_MD_FLFLAGS;
+               lobdo->o_flags &= ~OBD_FL_LOCAL_MASK;
+               lobdo->o_flags |= local_flags;
+       }
+       if (ocd == NULL)
+               return;
+
+       if (unlikely(!(ocd->ocd_connect_flags & OBD_CONNECT_FID)) &&
+           fid_seq_is_echo(wobdo->o_oi.oi.oi_seq)) {
+               /* see above */
+               lobdo->o_oi.oi_fid.f_seq = wobdo->o_oi.oi.oi_seq;
+               lobdo->o_oi.oi_fid.f_oid = wobdo->o_oi.oi.oi_id;
+               lobdo->o_oi.oi_fid.f_ver = 0;
+       }
+}
+
+#endif
index a22ecbd..69d4e06 100644 (file)
@@ -41,6 +41,8 @@
 
 #define DEBUG_SUBSYSTEM S_OSC
 
+#include <lustre_obdo.h>
+
 #include "osc_cl_internal.h"
 
 /** \addtogroup osc 
index 2ef9e45..f636360 100644 (file)
 
 #include <libcfs/libcfs.h>
 
-#include <lustre_dlm.h>
-#include <lustre_net.h>
 #include <lustre/lustre_user.h>
-#include <obd_cksum.h>
-#include <lustre_ha.h>
+
 #include <lprocfs_status.h>
-#include <lustre_ioctl.h>
 #include <lustre_debug.h>
-#include <lustre_param.h>
+#include <lustre_dlm.h>
 #include <lustre_fid.h>
-#include <obd_class.h>
-#include <obd.h>
+#include <lustre_ha.h>
+#include <lustre_ioctl.h>
 #include <lustre_net.h>
-#include "osc_internal.h"
+#include <lustre_obdo.h>
+#include <lustre_param.h>
+#include <obd.h>
+#include <obd_cksum.h>
+#include <obd_class.h>
+
 #include "osc_cl_internal.h"
+#include "osc_internal.h"
 
 atomic_t osc_pool_req_count;
 unsigned int osc_reqpool_maxreqcount;
index 0cd88ec..2bb469e 100644 (file)
 #define DEBUG_SUBSYSTEM S_MDS
 
 #include <linux/kthread.h>
-#include <obd_class.h>
+
 #include <lustre_ioctl.h>
-#include <lustre_param.h>
 #include <lustre_log.h>
+#include <lustre_obdo.h>
+#include <lustre_param.h>
+#include <obd_class.h>
 
 #include "osp_internal.h"
 
index 294aff1..96e3135 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_MDS
 
+#include <lustre_obdo.h>
 #include <lustre_swab.h>
+
 #include "osp_internal.h"
 
 static inline __u32 osp_dev2node(struct osp_device *osp)
index 3578236..b9f6760 100644 (file)
@@ -45,6 +45,9 @@
 #define DEBUG_SUBSYSTEM S_MDS
 
 #include <linux/kthread.h>
+
+#include <lustre_obdo.h>
+
 #include "osp_internal.h"
 
 /*
index bd9809d..ab902aa 100644 (file)
@@ -32,6 +32,7 @@
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <llog_swab.h>
+#include <lustre_obdo.h>
 #include <lustre_swab.h>
 #include <lustre_update.h>
 #include <md_object.h>
index cdddbbc..1b89ff6 100644 (file)
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <lu_target.h>
-#include <md_object.h>
+#include <lustre_obdo.h>
 #include <lustre_update.h>
+#include <md_object.h>
 #include <obd.h>
 #include <obd_class.h>
+
 #include "tgt_internal.h"
 
 const char *update_op_str(__u16 opc)
index ab09e4f..87bd7e7 100644 (file)
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <lu_target.h>
+#include <lustre_obdo.h>
 #include <lustre_update.h>
 #include <obd.h>
 #include <obd_class.h>
+
 #include "tgt_internal.h"
 
 #define UPDATE_RECORDS_BUFFER_SIZE     8192
index 40db87c..3ffecba 100644 (file)
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <lu_target.h>
+#include <lustre_obdo.h>
 #include <lustre_update.h>
 #include <lustre_swab.h>
 #include <md_object.h>
 #include <obd.h>
 #include <obd_class.h>
+
 #include "tgt_internal.h"
 
 /**