#endif
#include <linux/lustre_log.h>
-#include <portals/list.h>
+#include <libcfs/list.h>
/* Create a new log handle and add it to the open list.
* This log handle will be closed when all of the records in it are removed.
ENTRY;
llh = cathandle->lgh_hdr;
- bitmap_size = sizeof(llh->llh_bitmap) * 8;
+ bitmap_size = LLOG_BITMAP_SIZE(llh);
index = (cathandle->lgh_last_idx + 1) % bitmap_size;
loghandle = cathandle->u.chd.chd_current_log;
if (loghandle) {
struct llog_log_hdr *llh = loghandle->lgh_hdr;
- if (loghandle->lgh_last_idx < (sizeof(llh->llh_bitmap)*8) - 1 &&
+ down_write(&loghandle->lgh_lock);
+ if (loghandle->lgh_last_idx < (LLOG_BITMAP_SIZE(llh) - 1) &&
(!logcookie ||
!(llog_cookie_get_flags(logcookie) & LLOG_COOKIE_REPLAY) ||
EQ_LOGID(loghandle->lgh_id, logcookie->lgc_lgl))) {
- down_write(&loghandle->lgh_lock);
up_read(&cathandle->lgh_lock);
RETURN(loghandle);
+ } else {
+ up_write(&loghandle->lgh_lock);
}
}
loghandle = cathandle->u.chd.chd_current_log;
if (loghandle) {
struct llog_log_hdr *llh = loghandle->lgh_hdr;
- if (loghandle->lgh_last_idx < (sizeof(llh->llh_bitmap)*8) - 1 &&
+ down_write(&loghandle->lgh_lock);
+ if (loghandle->lgh_last_idx < (LLOG_BITMAP_SIZE(llh) - 1) &&
(!logcookie ||
!(llog_cookie_get_flags(logcookie) & LLOG_COOKIE_REPLAY) ||
EQ_LOGID(loghandle->lgh_id, logcookie->lgc_lgl))) {
- down_write(&loghandle->lgh_lock);
up_write(&cathandle->lgh_lock);
RETURN(loghandle);
+ } else {
+ up_write(&loghandle->lgh_lock);
}
}
int i, bitmap_size, idx;
ENTRY;
- bitmap_size = sizeof(llh->llh_bitmap) * 8;
+ bitmap_size = LLOG_BITMAP_SIZE(llh);
if (llh->llh_cat_idx == cpu_to_le32(index - 1)) {
idx = le32_to_cpu(llh->llh_cat_idx) + 1;
llh->llh_cat_idx = cpu_to_le32(idx);
cathandle = ctxt->loc_handle;
if (cathandle)
llog_cat_put(ctxt->loc_handle);
-
-// OBD_FREE(ctxt, sizeof(*ctxt));
+
return 0;
}
EXPORT_SYMBOL(llog_catalog_cleanup);