X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fllog_lvfs.c;h=4f0e45be2ce6195036198ad1563b52e7db8833d1;hb=15252614d7de8013874be0a0deb73a421530867f;hp=f2a5cd8fbdcee1ea7a23f5d2a88eb1cbf96af4f1;hpb=f36d9a3f365f9548b1c07dc36c0d9cee4a13ff01;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/llog_lvfs.c b/lustre/obdclass/llog_lvfs.c index f2a5cd8..4f0e45b 100644 --- a/lustre/obdclass/llog_lvfs.c +++ b/lustre/obdclass/llog_lvfs.c @@ -108,7 +108,7 @@ static int llog_lvfs_write_blob(struct obd_device *obd, struct l_file *file, file->f_pos = off; - if (buflen == 0) + if (buflen == 0) CWARN("0-length record\n"); if (!buf) { @@ -244,8 +244,8 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, RETURN(rc); if (buf) - /* write_blob adds header and tail to lrh_len. */ - reclen = sizeof(*rec) + rec->lrh_len + + /* write_blob adds header and tail to lrh_len. */ + reclen = sizeof(*rec) + rec->lrh_len + sizeof(struct llog_rec_tail); if (idx != -1) { @@ -260,7 +260,7 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, if (idx && llh->llh_size && llh->llh_size != rec->lrh_len) RETURN(-EINVAL); - if (!ext2_test_bit(idx, llh->llh_bitmap)) + if (!ext2_test_bit(idx, llh->llh_bitmap)) CERROR("Modify unset record %u\n", idx); if (idx != rec->lrh_index) CERROR("Index mismatch %d %u\n", idx, rec->lrh_index); @@ -290,13 +290,13 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, RETURN(-EFAULT); } #if 1 /* FIXME remove this safety check at some point */ - /* Verify that the record we're modifying is the + /* Verify that the record we're modifying is the right one. */ rc = llog_lvfs_read_blob(obd, file, &check, sizeof(check), saved_offset); if (check.lrh_index != idx || check.lrh_len != reclen) { CERROR("Bad modify idx %u/%u size %u/%u (%d)\n", - idx, check.lrh_index, reclen, + idx, check.lrh_index, reclen, check.lrh_len, rc); RETURN(-EFAULT); } @@ -366,7 +366,7 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, if (rc == 0 && reccookie) { reccookie->lgc_lgl = loghandle->lgh_id; reccookie->lgc_index = index; - if ((rec->lrh_type == MDS_UNLINK_REC) || + if ((rec->lrh_type == MDS_UNLINK_REC) || (rec->lrh_type == MDS_SETATTR_REC)) reccookie->lgc_subsys = LLOG_MDS_OST_ORIG_CTXT; else if (rec->lrh_type == OST_SZ_REC) @@ -637,16 +637,8 @@ static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res, handle->lgh_id = *logid; } else if (name) { - /* COMPAT_146 */ - if (strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME) == 0) { - handle->lgh_file = llog_filp_open(MDT_LOGS_DIR, name, - open_flags, 0644); - } else { - /* end COMPAT_146 */ - handle->lgh_file = llog_filp_open(MOUNT_CONFIGS_DIR, - name, open_flags, - 0644); - } + handle->lgh_file = llog_filp_open(MOUNT_CONFIGS_DIR, + name, open_flags, 0644); if (IS_ERR(handle->lgh_file)) GOTO(cleanup, rc = PTR_ERR(handle->lgh_file)); @@ -718,12 +710,7 @@ static int llog_lvfs_destroy(struct llog_handle *handle) int rc; ENTRY; - /* COMPAT_146 */ - if (strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME) == 0) - dir = MDT_LOGS_DIR; - else - /* end COMPAT_146 */ - dir = MOUNT_CONFIGS_DIR; + dir = MOUNT_CONFIGS_DIR; fdentry = handle->lgh_file->f_dentry; if (strcmp(fdentry->d_parent->d_name.name, dir) == 0) { @@ -736,7 +723,7 @@ static int llog_lvfs_destroy(struct llog_handle *handle) rc = llog_lvfs_close(handle); if (rc == 0) { - LOCK_INODE_MUTEX(inode); + LOCK_INODE_MUTEX_PARENT(inode); rc = ll_vfs_unlink(inode, fdentry, mnt); UNLOCK_INODE_MUTEX(inode); } @@ -760,7 +747,7 @@ static int llog_lvfs_destroy(struct llog_handle *handle) if (rc) GOTO(out, rc); - rc = obd_destroy(handle->lgh_ctxt->loc_exp, oa, NULL, NULL, NULL); + rc = obd_destroy(handle->lgh_ctxt->loc_exp, oa, NULL, NULL, NULL, NULL); out: OBDO_FREE(oa); RETURN(rc); @@ -777,7 +764,7 @@ int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd, loff_t off = idx * sizeof(*idarray); ENTRY; - if (!count) + if (!count) RETURN(0); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); @@ -831,7 +818,7 @@ int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd, loff_t off = idx * sizeof(*idarray); if (!count) - return (0); + GOTO(out1, rc = 0); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); file = filp_open(name, O_RDWR | O_CREAT | O_LARGEFILE, 0700); @@ -855,15 +842,17 @@ int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd, GOTO(out, rc); } - out: +out: pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); if (file && !IS_ERR(file)) rc1 = filp_close(file, 0); if (rc == 0) rc = rc1; +out1: RETURN(rc); } +EXPORT_SYMBOL(llog_put_cat_list); struct llog_operations llog_lvfs_ops = { lop_write_rec: llog_lvfs_write_rec,