Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / obdclass / llog_cat.c
index 9fe257a..8e39f4b 100644 (file)
@@ -65,30 +65,33 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle)
         if (llh->llh_cat_idx == index) {
                 CERROR("no free catalog slots for log...\n");
                 RETURN(ERR_PTR(-ENOSPC));
-        } else {
-                if (index == 0)
-                        index = 1;
-                if (ext2_set_bit(index, llh->llh_bitmap)) {
-                        CERROR("argh, index %u already set in log bitmap?\n",
-                               index);
-                        LBUG(); /* should never happen */
-                }
-                cathandle->lgh_last_idx = index;
-                llh->llh_count++;
-                llh->llh_tail.lrt_index = index;
         }
 
+        if (OBD_FAIL_CHECK(OBD_FAIL_MDS_LLOG_CREATE_FAILED))
+                RETURN(ERR_PTR(-ENOSPC));
         rc = llog_create(cathandle->lgh_ctxt, &loghandle, NULL, NULL);
-        if (rc)
+        if (rc) 
                 RETURN(ERR_PTR(rc));
-
+        
         rc = llog_init_handle(loghandle,
                               LLOG_F_IS_PLAIN | LLOG_F_ZAP_WHEN_EMPTY,
                               &cathandle->lgh_hdr->llh_tgtuuid);
         if (rc)
                 GOTO(out_destroy, rc);
 
-        CDEBUG(D_HA, "new recovery log "LPX64":%x for index %u of catalog "
+        if (index == 0)
+                index = 1;
+        if (ext2_set_bit(index, llh->llh_bitmap)) {
+                CERROR("argh, index %u already set in log bitmap?\n",
+                       index);
+                LBUG(); /* should never happen */
+        }
+        cathandle->lgh_last_idx = index;
+        llh->llh_count++;
+        llh->llh_tail.lrt_index = index;
+
+        CDEBUG(D_RPCTRACE,"new recovery log "LPX64":%x for index %u of catalog "
                LPX64"\n", loghandle->lgh_id.lgl_oid, loghandle->lgh_id.lgl_ogen,
                index, cathandle->lgh_id.lgl_oid);
         /* build the record for this log in the catalog */
@@ -322,8 +325,8 @@ int llog_cat_cancel_records(struct llog_handle *cathandle, int count,
                         llog_cat_set_first_idx(cathandle, index);
                         rc = llog_cancel_rec(cathandle, index);
                         if (rc == 0)
-                                CDEBUG(D_HA, "cancel plain log at index %u "
-                                       "of catalog "LPX64"\n",
+                                CDEBUG(D_RPCTRACE,"cancel plain log at index %u"
+                                       " of catalog "LPX64"\n",
                                        index, cathandle->lgh_id.lgl_oid);
                 }
         }
@@ -483,7 +486,7 @@ int llog_cat_set_first_idx(struct llog_handle *cathandle, int index)
                         }
                 }
 out:
-                CDEBUG(D_HA, "set catlog "LPX64" first idx %u\n",
+                CDEBUG(D_RPCTRACE, "set catlog "LPX64" first idx %u\n",
                        cathandle->lgh_id.lgl_oid, llh->llh_cat_idx);
         }
 
@@ -504,7 +507,7 @@ int llog_cat_init(struct llog_handle *cathandle, struct obd_uuid *tgtuuid)
         down(&cathandle->lgh_lock);
         llh = cathandle->lgh_hdr;
 
-        if (cathandle->lgh_file->f_dentry->d_inode->i_size == 0) {
+        if (i_size_read(cathandle->lgh_file->f_dentry->d_inode) == 0) {
                 llog_write_rec(cathandle, &llh->llh_hdr, NULL, 0, NULL, 0);
 
 write_hdr: