Whamcloud - gitweb
LU-2078 ofd: drop locking in ofd_sync
authorPrakash Surya <surya1@llnl.gov>
Thu, 27 Sep 2012 22:37:10 +0000 (15:37 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 3 Oct 2012 18:24:50 +0000 (14:24 -0400)
Improve concurrency by dropping the write lock around
dt_object_sync(). This is safe because all consistency
related to a single object is supposed to be maintained
by the osd internally.  In this case:

  1) osd_object_sync() doesn't rely on the object at all:
     global sync is called
  2) even if object is being destroyed at the same time -
     we're holding a reference, so we're safe
  3) dt_version_get() -> osd_xattr_get() has own internal
     locking, protecting xattr consistency to improve
     concurrency

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Change-Id: I60c5b6a1d10afc717a24e7471071f1e2fdb89c29
Reviewed-on: http://review.whamcloud.com/4117
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/ofd/ofd_obd.c

index 1f8e917..556eb4b 100644 (file)
@@ -1307,15 +1307,14 @@ static int ofd_sync(const struct lu_env *env, struct obd_export *exp,
                GOTO(out, rc = PTR_ERR(fo));
        }
 
-       ofd_write_lock(env, fo);
        if (!ofd_object_exists(fo))
-               GOTO(unlock, rc = -ENOENT);
+               GOTO(put, rc = -ENOENT);
 
        if (dt_version_get(env, ofd_object_child(fo)) >
            ofd_obd(ofd)->obd_last_committed) {
                rc = dt_object_sync(env, ofd_object_child(fo));
                if (rc)
-                       GOTO(unlock, rc);
+                       GOTO(put, rc);
        }
 
        oinfo->oi_oa->o_valid = OBD_MD_FLID;
@@ -1324,8 +1323,7 @@ static int ofd_sync(const struct lu_env *env, struct obd_export *exp,
 
        ofd_counter_incr(exp, LPROC_OFD_STATS_SYNC, oinfo->oi_jobid, 1);
        EXIT;
-unlock:
-       ofd_write_unlock(env, fo);
+put:
        ofd_object_put(env, fo);
 out:
        return rc;