Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / include / lustre_log.h
index b81e34d..1ec4384 100644 (file)
@@ -286,6 +286,10 @@ struct llog_commit_master {
          */
         struct ptlrpcd_ctl         lcm_pc;
         /**
+         * Busy resources waitq
+         */
+        cfs_waitq_t                lcm_waitq;
+        /**
          * Commit thread name buffer. Only used for thread start.
          */
         char                       lcm_name[LCM_NAME_SIZE];
@@ -329,14 +333,6 @@ extern int llog_recov_thread_start(struct llog_commit_master *lcm);
 extern void llog_recov_thread_stop(struct llog_commit_master *lcm, 
                                     int force);
 
-#ifndef __KERNEL__
-
-#define cap_raise(c, flag) do {} while(0)
-
-#define CAP_SYS_RESOURCE 24
-
-#endif   /* !__KERNEL__ */
-
 static inline void llog_gen_init(struct llog_ctxt *ctxt)
 {
         struct obd_device *obd = ctxt->loc_exp->exp_obd;
@@ -484,8 +480,7 @@ static inline int llog_write_rec(struct llog_handle *handle,
                                  int numcookies, void *buf, int idx)
 {
         struct llog_operations *lop;
-        __u32 cap;
-        int rc, buflen;
+        int raised, rc, buflen;
         ENTRY;
 
         rc = llog_handle2ops(handle, &lop);
@@ -502,10 +497,12 @@ static inline int llog_write_rec(struct llog_handle *handle,
                 buflen = rec->lrh_len;
         LASSERT(size_round(buflen) == buflen);
 
-        cap = current->cap_effective;             
-        cap_raise(current->cap_effective, CAP_SYS_RESOURCE); 
+        raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
+        if (!raised)
+                cfs_cap_raise(CFS_CAP_SYS_RESOURCE); 
         rc = lop->lop_write_rec(handle, rec, logcookies, numcookies, buf, idx);
-        current->cap_effective = cap; 
+        if (!raised)
+                cfs_cap_lower(CFS_CAP_SYS_RESOURCE); 
         RETURN(rc);
 }
 
@@ -601,8 +598,7 @@ static inline int llog_create(struct llog_ctxt *ctxt, struct llog_handle **res,
                               struct llog_logid *logid, char *name)
 {
         struct llog_operations *lop;
-        __u32 cap;
-        int rc;
+        int raised, rc;
         ENTRY;
 
         rc = llog_obd2ops(ctxt, &lop);
@@ -611,10 +607,12 @@ static inline int llog_create(struct llog_ctxt *ctxt, struct llog_handle **res,
         if (lop->lop_create == NULL)
                 RETURN(-EOPNOTSUPP);
 
-        cap = current->cap_effective;             
-        cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+        raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
+        if (!raised)
+                cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
         rc = lop->lop_create(ctxt, res, logid, name);
-        current->cap_effective = cap; 
+        if (!raised)
+                cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
         RETURN(rc);
 }