Whamcloud - gitweb
LU-9934 build: address issues raised by gcc7
[fs/lustre-release.git] / lustre / ofd / ofd_obd.c
index 5e35d8a..dba54a4 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2016, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 
 #define DEBUG_SUBSYSTEM S_FILTER
 
-#include <lustre/lustre_idl.h>
 #include "ofd_internal.h"
 #include <obd_cksum.h>
-#include <uapi/linux/lustre_ioctl.h>
+#include <uapi/linux/lustre/lustre_ioctl.h>
 #include <lustre_quota.h>
 #include <lustre_lfsck.h>
 #include <lustre_nodemap.h>
@@ -715,7 +714,7 @@ static int ofd_get_info(const struct lu_env *env, struct obd_export *exp,
  * \retval             negative value on error
  */
 int ofd_statfs(const struct lu_env *env,  struct obd_export *exp,
-              struct obd_statfs *osfs, __u64 max_age, __u32 flags)
+              struct obd_statfs *osfs, time64_t max_age, __u32 flags)
 {
         struct obd_device      *obd = class_exp2obd(exp);
        struct ofd_device       *ofd = ofd_exp(exp);
@@ -818,7 +817,6 @@ static int ofd_echo_setattr(const struct lu_env *env, struct obd_export *exp,
        struct ldlm_resource    *res;
        struct ofd_object       *fo;
        struct lu_fid           *fid = &oa->o_oi.oi_fid;
-       struct filter_fid       *ff = NULL;
        int                      rc = 0;
 
        ENTRY;
@@ -855,13 +853,8 @@ static int ofd_echo_setattr(const struct lu_env *env, struct obd_export *exp,
        la_from_obdo(&info->fti_attr, oa, oa->o_valid);
        info->fti_attr.la_valid &= ~LA_TYPE;
 
-       if (oa->o_valid & OBD_MD_FLFID) {
-               ff = &info->fti_mds_fid;
-               ofd_prepare_fidea(ff, oa);
-       }
-
        /* setting objects attributes (including owner/group) */
-       rc = ofd_attr_set(env, fo, &info->fti_attr, ff);
+       rc = ofd_attr_set(env, fo, &info->fti_attr, oa);
        if (rc)
                GOTO(out_unlock, rc);
 
@@ -891,7 +884,7 @@ out:
  *
  * Supplemental function to destroy object by FID, it is used by request
  * handler and by ofd_echo_destroy() below to find object by FID, lock it
- * and call ofd_object_destroy() finally.
+ * and call ofd_destroy() finally.
  *
  * \param[in] env      execution environment
  * \param[in] ofd      OFD device
@@ -931,7 +924,7 @@ int ofd_destroy_by_fid(const struct lu_env *env, struct ofd_device *ofd,
 
        LASSERT(fo != NULL);
 
-       rc = ofd_object_destroy(env, fo, orphan);
+       rc = ofd_destroy(env, fo, orphan);
        EXIT;
 
        ofd_object_put(env, fo);
@@ -1011,9 +1004,10 @@ static int ofd_echo_create(const struct lu_env *env, struct obd_export *exp,
        struct ofd_device       *ofd = ofd_exp(exp);
        u64                      seq = ostid_seq(&oa->o_oi);
        struct ofd_seq          *oseq;
-       int                      rc = 0, diff = 1;
        long                     granted;
        u64                      next_id;
+       s64 diff = 1;
+       int rc = 0;
        int                      count;
 
        ENTRY;
@@ -1049,22 +1043,27 @@ static int ofd_echo_create(const struct lu_env *env, struct obd_export *exp,
                rc = granted;
                granted = 0;
                CDEBUG(D_HA, "%s: failed to acquire grant space for "
-                      "precreate (%d): rc = %d\n", ofd_name(ofd), diff, rc);
+                      "precreate (%lld): rc = %d\n", ofd_name(ofd), diff, rc);
                diff = 0;
                GOTO(out, rc);
        }
 
        next_id = ofd_seq_last_oid(oseq) + 1;
-       count = ofd_precreate_batch(ofd, diff);
+       count = ofd_precreate_batch(ofd, (int)diff);
 
        rc = ofd_precreate_objects(env, ofd, next_id, oseq, count, 0);
        if (rc < 0) {
                CERROR("%s: unable to precreate: rc = %d\n",
                       ofd_name(ofd), rc);
        } else {
-               ostid_set_id(&oa->o_oi, ofd_seq_last_oid(oseq));
+               rc = ostid_set_id(&oa->o_oi, ofd_seq_last_oid(oseq));
+               if (rc) {
+                       CERROR("%s: Bad %llu to set " DOSTID " : rc %d\n",
+                              ofd_name(ofd),
+                              (unsigned long long)ofd_seq_last_oid(oseq),
+                              POSTID(&oa->o_oi), rc);
+               }
                oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP;
-               rc = 0;
        }
 
        tgt_grant_commit(ofd_obd(ofd)->obd_self_export, granted, rc);
@@ -1164,10 +1163,12 @@ static int ofd_ioc_get_obj_version(const struct lu_env *env,
                   data->ioc_inllen3 == sizeof(__u64) &&
                   data->ioc_inlbuf4 != NULL &&
                   data->ioc_inllen4 == sizeof(__u64)) {
-               struct ost_id ostid;
+               struct ost_id ostid = { };
 
                ostid_set_seq(&ostid, *(__u64 *)data->ioc_inlbuf4);
-               ostid_set_id(&ostid, *(__u64 *)data->ioc_inlbuf3);
+               rc = ostid_set_id(&ostid, *(__u64 *)data->ioc_inlbuf3);
+               if (rc)
+                       GOTO(out, rc);
                rc = ostid_to_fid(&fid, &ostid,
                                  ofd->ofd_lut.lut_lsd.lsd_osd_index);
                if (rc != 0)