Whamcloud - gitweb
LU-5319 mdt: support multiple modify RCPs in parallel
[fs/lustre-release.git] / lustre / osd-zfs / osd_oi.c
index 1e3e990..22f6ff0 100644 (file)
 /*
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
- */
-/*
- * Copyright (c) 2012, 2013, Intel Corporation.
- * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -69,8 +67,6 @@
 #include <sys/sa_impl.h>
 #include <sys/txg.h>
 
-static char *oi_tag = "osd_mount, oi";
-
 #define OSD_OI_FID_NR         (1UL << 7)
 #define OSD_OI_FID_NR_MAX     (1UL << OSD_OI_FID_OID_BITS_MAX)
 unsigned int osd_oi_count = OSD_OI_FID_NR;
@@ -98,6 +94,7 @@ static const struct named_oid oids[] = {
        { OFD_HEALTH_CHECK_OID,         HEALTH_CHECK },
        { ACCT_USER_OID,                "acct_usr_inode" },
        { ACCT_GROUP_OID,               "acct_grp_inode" },
+       { REPLY_DATA_OID,               REPLY_DATA },
        { 0,                            NULL }
 };
 
@@ -123,7 +120,7 @@ osd_oi_lookup(const struct lu_env *env, struct osd_device *o,
        struct zpl_direntry     *zde = &osd_oti_get(env)->oti_zde.lzd_reg;
        int                      rc;
 
-       rc = -zap_lookup(o->od_objset.os, parent, name, 8, 1, (void *)zde);
+       rc = -zap_lookup(o->od_os, parent, name, 8, 1, (void *)zde);
        if (rc)
                return rc;
 
@@ -151,12 +148,12 @@ osd_oi_create(const struct lu_env *env, struct osd_device *o,
        int                      rc;
 
        /* verify it doesn't already exist */
-       rc = -zap_lookup(o->od_objset.os, parent, name, 8, 1, (void *)zde);
+       rc = -zap_lookup(o->od_os, parent, name, 8, 1, (void *)zde);
        if (rc == 0)
                return -EEXIST;
 
        /* create fid-to-dnode index */
-       tx = dmu_tx_create(o->od_objset.os);
+       tx = dmu_tx_create(o->od_os);
        if (tx == NULL)
                return -ENOMEM;
 
@@ -175,18 +172,18 @@ osd_oi_create(const struct lu_env *env, struct osd_device *o,
        la->la_valid = LA_MODE | LA_UID | LA_GID;
        la->la_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO;
        la->la_uid = la->la_gid = 0;
-       __osd_zap_create(env, &o->od_objset, &db, tx, la, parent, oi_tag, 0);
+       __osd_zap_create(env, o, &db, tx, la, parent, 0);
 
        zde->zde_dnode = db->db_object;
        zde->zde_pad = 0;
        zde->zde_type = IFTODT(S_IFDIR);
 
-       rc = -zap_add(o->od_objset.os, parent, name, 8, 1, (void *)zde, tx);
+       rc = -zap_add(o->od_os, parent, name, 8, 1, (void *)zde, tx);
 
        dmu_tx_commit(tx);
 
        *child = db->db_object;
-       sa_buf_rele(db, oi_tag);
+       sa_buf_rele(db, osd_obj_tag);
 
        return rc;
 }
@@ -212,7 +209,7 @@ osd_oi_find_or_create(const struct lu_env *env, struct osd_device *o,
  * the object is located (tgt index) and it is MDT or OST object.
  */
 int osd_fld_lookup(const struct lu_env *env, struct osd_device *osd,
-                  obd_seq seq, struct lu_seq_range *range)
+                  u64 seq, struct lu_seq_range *range)
 {
        struct seq_server_site  *ss = osd_seq_site(osd);
 
@@ -266,7 +263,7 @@ int fid_is_on_ost(const struct lu_env *env, struct osd_device *osd,
 }
 
 static struct osd_seq *osd_seq_find_locked(struct osd_seq_list *seq_list,
-                                          obd_seq seq)
+                                          u64 seq)
 {
        struct osd_seq *osd_seq;
 
@@ -277,8 +274,7 @@ static struct osd_seq *osd_seq_find_locked(struct osd_seq_list *seq_list,
        return NULL;
 }
 
-static struct osd_seq *osd_seq_find(struct osd_seq_list *seq_list,
-                                   obd_seq seq)
+static struct osd_seq *osd_seq_find(struct osd_seq_list *seq_list, u64 seq)
 {
        struct osd_seq *osd_seq;
 
@@ -290,7 +286,7 @@ static struct osd_seq *osd_seq_find(struct osd_seq_list *seq_list,
 }
 
 static struct osd_seq *osd_find_or_add_seq(const struct lu_env *env,
-                                          struct osd_device *osd, obd_seq seq)
+                                          struct osd_device *osd, u64 seq)
 {
        struct osd_seq_list     *seq_list = &osd->od_seq_list;
        struct osd_seq          *osd_seq;
@@ -375,7 +371,7 @@ osd_get_idx_for_ost_obj(const struct lu_env *env, struct osd_device *osd,
 {
        struct osd_seq  *osd_seq;
        unsigned long   b;
-       obd_id          id;
+       u64             id;
        int             rc;
 
        osd_seq = osd_find_or_add_seq(env, osd, fid_seq(fid));
@@ -484,7 +480,7 @@ int osd_fid_lookup(const struct lu_env *env, struct osd_device *dev,
        } else {
                zapid = osd_get_name_n_idx(env, dev, fid, buf);
 
-               rc = -zap_lookup(dev->od_objset.os, zapid, buf,
+               rc = -zap_lookup(dev->od_os, zapid, buf,
                                8, 1, &info->oti_zde);
                if (rc)
                        RETURN(rc);
@@ -492,7 +488,7 @@ int osd_fid_lookup(const struct lu_env *env, struct osd_device *dev,
        }
 
        if (rc == 0)
-               dmu_prefetch(dev->od_objset.os, *oid, 0, 0);
+               dmu_prefetch(dev->od_os, *oid, 0, 0);
 
        RETURN(rc);
 }
@@ -694,8 +690,7 @@ static char *root2convert = "ROOT";
  * This is only needed for pre-production 2.4 ZFS filesystems, and
  * can be removed in the future.
  */
-int osd_convert_root_to_new_seq(const struct lu_env *env,
-                                       struct osd_device *o)
+int osd_convert_root_to_new_seq(const struct lu_env *env, struct osd_device *o)
 {
        struct luz_direntry *lze = &osd_oti_get(env)->oti_zde;
        char                *buf = osd_oti_get(env)->oti_str;
@@ -710,7 +705,7 @@ int osd_convert_root_to_new_seq(const struct lu_env *env,
                RETURN(0);
 
        /* lookup /ROOT */
-       rc = -zap_lookup(o->od_objset.os, o->od_root, root2convert, 8,
+       rc = -zap_lookup(o->od_os, o->od_root, root2convert, 8,
                         sizeof(*lze) / 8, (void *)lze);
        /* doesn't exist or let actual user to handle the error */
        if (rc)
@@ -723,7 +718,7 @@ int osd_convert_root_to_new_seq(const struct lu_env *env,
        if (fid_seq(&lze->lzd_fid) == FID_SEQ_ROOT)
                return 0;
 
-       tx = dmu_tx_create(o->od_objset.os);
+       tx = dmu_tx_create(o->od_os);
        if (tx == NULL)
                return -ENOMEM;
 
@@ -740,7 +735,7 @@ int osd_convert_root_to_new_seq(const struct lu_env *env,
 
        /* declare that we'll add object to fid-dnode mapping */
        newfid.f_seq = FID_SEQ_ROOT;
-       newfid.f_oid = 1;
+       newfid.f_oid = FID_OID_ROOT;
        newfid.f_ver = 0;
        zapid = osd_get_name_n_idx(env, o, &newfid, buf);
        dmu_tx_hold_bonus(tx, zapid);
@@ -750,25 +745,25 @@ int osd_convert_root_to_new_seq(const struct lu_env *env,
        if (rc)
                GOTO(err, rc);
 
-       rc = -zap_remove(o->od_objset.os, o->od_root, root2convert, tx);
+       rc = -zap_remove(o->od_os, o->od_root, root2convert, tx);
        if (rc)
                GOTO(err, rc);
 
        /* remove from OI */
        zapid = osd_get_name_n_idx(env, o, &lze->lzd_fid, buf);
-       rc = -zap_remove(o->od_objset.os, zapid, buf, tx);
+       rc = -zap_remove(o->od_os, zapid, buf, tx);
        if (rc)
                GOTO(err, rc);
 
        lze->lzd_fid = newfid;
-       rc = -zap_add(o->od_objset.os, o->od_root, root2convert,
+       rc = -zap_add(o->od_os, o->od_root, root2convert,
                      8, sizeof(*lze) / 8, (void *)lze, tx);
        if (rc)
                GOTO(err, rc);
 
        /* add to OI with the new fid */
        zapid = osd_get_name_n_idx(env, o, &newfid, buf);
-       rc = -zap_add(o->od_objset.os, zapid, buf, 8, 1, &lze->lzd_reg, tx);
+       rc = -zap_add(o->od_os, zapid, buf, 8, 1, &lze->lzd_reg, tx);
        if (rc)
                GOTO(err, rc);
 
@@ -862,5 +857,3 @@ int osd_options_init(void)
 
        return 0;
 }
-
-