From fb5ea68b652d5c0fb875557cc891c4db026c91e5 Mon Sep 17 00:00:00 2001 From: eeb Date: Sat, 21 Feb 2004 12:04:38 +0000 Subject: [PATCH] * Merged HEAD --- lustre/kernel_patches/series/vanilla-2.4.22 | 1 + lustre/ptlrpc/llog_server.c | 136 +++++++++++++++++++--------- lustre/utils/lfs.c | 6 +- 3 files changed, 98 insertions(+), 45 deletions(-) diff --git a/lustre/kernel_patches/series/vanilla-2.4.22 b/lustre/kernel_patches/series/vanilla-2.4.22 index 92f76eb..3d5bb6d 100644 --- a/lustre/kernel_patches/series/vanilla-2.4.22 +++ b/lustre/kernel_patches/series/vanilla-2.4.22 @@ -32,3 +32,4 @@ gfp_memalloc-2.4.22.patch ext3-xattr-ptr-arith-fix.patch 3.5G-address-space-2.4.22-vanilla.patch procfs-ndynamic-2.4.patch +ext3-truncate-buffer-head.patch diff --git a/lustre/ptlrpc/llog_server.c b/lustre/ptlrpc/llog_server.c index 645a32e..a15f67c 100644 --- a/lustre/ptlrpc/llog_server.c +++ b/lustre/ptlrpc/llog_server.c @@ -29,11 +29,19 @@ #define EXPORT_SYMTAB #endif +#ifndef __KERNEL__ +#include +#else #include +#endif + #include #include #include #include +#include + +#ifdef __KERNEL__ int llog_origin_handle_create(struct ptlrpc_request *req) { @@ -238,16 +246,17 @@ int llog_origin_handle_close(struct ptlrpc_request *req) RETURN(rc); } -#ifdef ENABLE_ORPHANS int llog_origin_handle_cancel(struct ptlrpc_request *req) { struct obd_device *obd = req->rq_export->exp_obd; struct obd_device *disk_obd; struct llog_cookie *logcookies; struct llog_ctxt *ctxt; - int num_cookies, rc = 0; + int num_cookies, rc = 0, err, i; struct obd_run_ctxt saved; struct llog_handle *cathandle; + struct inode *inode; + void *handle; ENTRY; logcookies = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*logcookies)); @@ -262,27 +271,43 @@ int llog_origin_handle_cancel(struct ptlrpc_request *req) CWARN("llog subsys not setup or already cleanup\n"); RETURN(-ENOENT); } - down(&ctxt->loc_sem); - disk_obd = ctxt->loc_exp->exp_obd; - cathandle = ctxt->loc_handle; - LASSERT(cathandle); + disk_obd = ctxt->loc_exp->exp_obd; push_ctxt(&saved, &disk_obd->obd_ctxt, NULL); - rc = llog_cat_cancel_records(cathandle, num_cookies, logcookies); + for (i = 0; i < num_cookies; i++, logcookies++) { + cathandle = ctxt->loc_handle; + LASSERT(cathandle != NULL); + inode = cathandle->lgh_file->f_dentry->d_inode; + + handle = fsfilt_start(disk_obd, inode, + FSFILT_OP_CANCEL_UNLINK_LOG, NULL); + if (IS_ERR(handle)) { + CERROR("fsfilt_start failed: %ld\n", PTR_ERR(handle)); + GOTO(pop_ctxt, rc = PTR_ERR(handle)); + } + + rc = llog_cat_cancel_records(cathandle, 1, logcookies); + + err = fsfilt_commit(disk_obd, inode, handle, 0); + if (err) { + CERROR("error committing transaction: %d\n", err); + if (!rc) + rc = err; + GOTO(pop_ctxt, rc); + } + } +pop_ctxt: + pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL); if (rc) CERROR("cancel %d llog-records failed: %d\n", num_cookies, rc); else - CWARN("cancel %d llog-records\n", num_cookies); - - pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL); - up(&ctxt->loc_sem); + CDEBUG(D_HA, "cancel %d llog-records\n", num_cookies); RETURN(rc); } EXPORT_SYMBOL(llog_origin_handle_cancel); -#endif -static int llog_catinfo_config(struct obd_device *obd, char *buf, int buf_len, +static int llog_catinfo_config(struct obd_device *obd, char *buf, int buf_len, char *client) { struct mds_obd *mds = &obd->u.mds; @@ -292,17 +317,17 @@ static int llog_catinfo_config(struct obd_device *obd, char *buf, int buf_len, char name[4][64]; int rc, i, l, remains = buf_len; char *out = buf; - + if (ctxt == NULL || mds == NULL) RETURN(-EOPNOTSUPP); push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL); - + sprintf(name[0], "%s", mds->mds_profile); sprintf(name[1], "%s-clean", mds->mds_profile); sprintf(name[2], "%s", client); sprintf(name[3], "%s-clean", client); - + for (i = 0; i < 4; i++) { int index, uncanceled = 0; rc = llog_create(ctxt, &handle, NULL, name[i]); @@ -313,18 +338,17 @@ static int llog_catinfo_config(struct obd_device *obd, char *buf, int buf_len, llog_close(handle); GOTO(out_pop, rc = -ENOENT); } - + for (index = 1; index < (LLOG_BITMAP_BYTES * 8); index ++) { if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap)) uncanceled++; } - - l = snprintf(out, remains, "[Log Name]: %s\nLog Size: "LPD64"\n" + + l = snprintf(out, remains, "[Log Name]: %s\nLog Size: %llu\n" "Last Index: %d\nUncanceled Records: %d\n\n", - name[i], + name[i], handle->lgh_file->f_dentry->d_inode->i_size, - handle->lgh_last_idx, - uncanceled); + handle->lgh_last_idx, uncanceled); out += l; remains -= l; @@ -344,7 +368,7 @@ struct cb_data { int init; }; -static int llog_catinfo_cb(struct llog_handle *cat, +static int llog_catinfo_cb(struct llog_handle *cat, struct llog_rec_hdr *rec, void *data) { static char *out = NULL; @@ -365,7 +389,7 @@ static int llog_catinfo_cb(struct llog_handle *cat, if (!(cat->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT))) RETURN(-EINVAL); - + lir = (struct llog_logid_rec *)rec; logid = &lir->lid_id; rc = llog_create(ctxt, &handle, logid, NULL); @@ -374,14 +398,14 @@ static int llog_catinfo_cb(struct llog_handle *cat, rc = llog_init_handle(handle, 0, NULL); if (rc) GOTO(out_close, rc); - + for (index = 1; index < (LLOG_BITMAP_BYTES * 8); index++) { if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap)) count++; } l = snprintf(out, remains, "\t[Log ID]: #"LPX64"#"LPX64"#%08x\n" - "\tLog Size: "LPD64"\n\tLast Index: %d\n" + "\tLog Size: %llu\n\tLast Index: %d\n" "\tUncanceled Records: %d\n", logid->lgl_oid, logid->lgl_ogr, logid->lgl_ogen, handle->lgh_file->f_dentry->d_inode->i_size, @@ -394,13 +418,13 @@ static int llog_catinfo_cb(struct llog_handle *cat, CWARN("Not enough memory\n"); rc = -ENOMEM; } - + out_close: llog_close(handle); RETURN(rc); } - -static int llog_catinfo_deletions(struct obd_device *obd, char *buf, + +static int llog_catinfo_deletions(struct obd_device *obd, char *buf, int buf_len) { struct mds_obd *mds = &obd->u.mds; @@ -412,24 +436,24 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf, int rc; struct cb_data data; struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); - + if (ctxt == NULL || mds == NULL) RETURN(-EOPNOTSUPP); - + count = mds->mds_lov_desc.ld_tgt_count; size = sizeof(*idarray) * count; - + OBD_ALLOC(idarray, size); if (!idarray) RETURN(-ENOMEM); memset(idarray, 0, size); - + rc = llog_get_cat_list(obd, obd, name, count, idarray); - if (rc) + if (rc) GOTO(out_free, rc); push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL); - + id = idarray; data.ctxt = ctxt; data.out = buf; @@ -448,19 +472,19 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf, if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap)) uncanceled++; } - l = snprintf(data.out, data.remains, + l = snprintf(data.out, data.remains, "\n[Catlog ID]: #"LPX64"#"LPX64"#%08x " "[Log Count]: %d\n", id->lgl_oid, id->lgl_ogr, id->lgl_ogen, uncanceled); - + data.out += l; data.remains -= l; data.init = 1; - - llog_process(handle, llog_catinfo_cb, &data); + + llog_process(handle, llog_catinfo_cb, &data, NULL); llog_close(handle); - + if (data.remains <= 0) break; } @@ -470,7 +494,7 @@ out_free: OBD_FREE(idarray, size); RETURN(rc); } - + int llog_catinfo(struct ptlrpc_request *req) { struct obd_export *exp = req->rq_export; @@ -503,8 +527,36 @@ int llog_catinfo(struct ptlrpc_request *req) if (strlen(buf) == 0) sprintf(buf, "%s", "No log informations\n"); memcpy(reply, buf, buf_len); - + out_free: OBD_FREE(buf, buf_len); return rc; } + +#else /* !__KERNEL__ */ +int llog_origin_handle_create(struct ptlrpc_request *req) +{ + LBUG(); + return 0; +} +int llog_origin_handle_next_block(struct ptlrpc_request *req) +{ + LBUG(); + return 0; +} +int llog_origin_handle_read_header(struct ptlrpc_request *req) +{ + LBUG(); + return 0; +} +int llog_origin_handle_close(struct ptlrpc_request *req) +{ + LBUG(); + return 0; +} +int llog_origin_handle_cancel(struct ptlrpc_request *req) +{ + LBUG(); + return 0; +} +#endif diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 7125bdd..a41f7a7 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -68,7 +68,7 @@ command_t cmdlist[] = { {"getstripe", lfs_getstripe, 0, "To list the striping pattern for given filename.\n" "usage:getstripe "}, - {"check", lfs_check, 0, + {"check", lfs_check, 0, "Display the status of MDS or OSTs (as specified in the command) " "or all the servers (MDS and OSTs).\n" "usage: check "}, @@ -213,7 +213,7 @@ static int lfs_osts(int argc, char **argv) struct mntent *mnt = NULL; struct obd_uuid *obduuid = NULL; int rc=0; - + if (argc != 1) return CMD_HELP; @@ -235,7 +235,7 @@ static int lfs_osts(int argc, char **argv) } endmntent(fp); } - + return rc; } -- 1.8.3.1