X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fllog_reader.c;h=bad92714e0e360ef0448332366232fb481aae5d1;hb=470339f456d8e5d27fa7a10103432ae264bf88f4;hp=117bf647ff755bcf9c8d3fa1c024418089f44aa7;hpb=113303973ec9f8484eb2355a1a6ef3c4c7fd6a56;p=fs%2Flustre-release.git diff --git a/lustre/utils/llog_reader.c b/lustre/utils/llog_reader.c index 117bf64..bad9271 100644 --- a/lustre/utils/llog_reader.c +++ b/lustre/utils/llog_reader.c @@ -1,23 +1,37 @@ /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * - * Copyright (C) 2006 Cluster File Systems, Inc. + * GPL HEADER START * - * This file is part of Lustre, http://www.lustre.org. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * Lustre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + * GPL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Use is subject to license terms. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. */ /* Interpret configuration llogs */ @@ -153,7 +167,7 @@ int llog_pack_buffer(int fd, struct llog_log_hdr **llog, recs_pr[i] = cur_rec; if (ext2_test_bit(idx, (*llog)->llh_bitmap)) { - if (le32_to_cpu(cur_rec->lrh_type) != OBD_CFG_REC) + if (le32_to_cpu(cur_rec->lrh_type) != OBD_CFG_REC) printf("rec #%d type=%x len=%u\n", idx, cur_rec->lrh_type, cur_rec->lrh_len); } else { @@ -162,7 +176,7 @@ int llog_pack_buffer(int fd, struct llog_log_hdr **llog, /* The header counts only set records */ i--; } - + ptr += le32_to_cpu(cur_rec->lrh_len); if ((ptr - file_buf) > file_size) { printf("The log is corrupt (too big at %d)\n", i); @@ -201,7 +215,7 @@ void print_llog_header(struct llog_log_hdr *llog_buf) time_t t; printf("Header size : %u\n", - le32_to_cpu(llog_buf->llh_hdr.lrh_len)); + le32_to_cpu(llog_buf->llh_hdr.lrh_len)); t = le64_to_cpu(llog_buf->llh_timestamp); printf("Time : %s", ctime(&t)); @@ -253,6 +267,7 @@ static void print_setup_cfg(struct lustre_cfg *lcfg) printf("setup "); print_1_cfg(lcfg); } + return; } @@ -313,6 +328,16 @@ void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip) print_1_cfg(lcfg); break; } + case(LCFG_ADD_MDC):{ + printf("modify_mdc_tgts add "); + print_1_cfg(lcfg); + break; + } + case(LCFG_DEL_MDC):{ + printf("modify_mdc_tgts del "); + print_1_cfg(lcfg); + break; + } case(LCFG_MOUNTOPT):{ printf("mount_option "); print_1_cfg(lcfg); @@ -325,7 +350,10 @@ void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip) } case(LCFG_SET_TIMEOUT):{ printf("set_timeout=%d ", lcfg->lcfg_num); - print_1_cfg(lcfg); + break; + } + case(LCFG_SET_LDLM_TIMEOUT):{ + printf("set_ldlm_timeout=%d ", lcfg->lcfg_num); break; } case(LCFG_SET_UPCALL):{ @@ -338,9 +366,16 @@ void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip) print_1_cfg(lcfg); break; } + case(LCFG_SPTLRPC_CONF):{ + printf("sptlrpc_conf "); + print_1_cfg(lcfg); + break; + } case(LCFG_MARKER):{ struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1); char createtime[26], canceltime[26] = ""; + time_t time_tmp; + if (marker->cm_flags & CM_SKIP) { if (marker->cm_flags & CM_START) { printf("SKIP START "); @@ -350,18 +385,39 @@ void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip) *skip = 0; } } + if (marker->cm_flags & CM_EXCLUDE) { - if (marker->cm_flags & CM_START) + if (marker->cm_flags & CM_START) printf("EXCLUDE START "); else printf("EXCLUDE END "); } - ctime_r(&marker->cm_createtime, createtime); - createtime[strlen(createtime) - 1] = 0; + + /* Handle overflow of 32-bit time_t gracefully. + * The copy to time_tmp is needed in any case to + * keep the pointer happy, even on 64-bit systems. */ + time_tmp = marker->cm_createtime; + if (time_tmp == marker->cm_createtime) { + ctime_r(&time_tmp, createtime); + createtime[strlen(createtime) - 1] = 0; + } else { + strcpy(createtime, "in the distant future"); + } + if (marker->cm_canceltime) { - ctime_r(&marker->cm_canceltime, canceltime); - canceltime[strlen(canceltime) - 1] = 0; + /* Like cm_createtime, we try to handle overflow of + * 32-bit time_t gracefully. The copy to time_tmp + * is also needed on 64-bit systems to keep the + * pointer happy, see bug 16771 */ + time_tmp = marker->cm_canceltime; + if (time_tmp == marker->cm_canceltime) { + ctime_r(&time_tmp, canceltime); + canceltime[strlen(canceltime) - 1] = 0; + } else { + strcpy(canceltime, "in the distant future"); + } } + printf("marker %3d (flags=%#04x, v%d.%d.%d.%d) %-15s '%s' %s-%s", marker->cm_step, marker->cm_flags, OBD_OCD_VERSION_MAJOR(marker->cm_vers), @@ -372,6 +428,26 @@ void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip) createtime, canceltime); break; } + case(LCFG_POOL_NEW):{ + printf("pool new "); + print_1_cfg(lcfg); + break; + } + case(LCFG_POOL_ADD):{ + printf("pool add "); + print_1_cfg(lcfg); + break; + } + case(LCFG_POOL_REM):{ + printf("pool remove "); + print_1_cfg(lcfg); + break; + } + case(LCFG_POOL_DEL):{ + printf("pool destroy "); + print_1_cfg(lcfg); + break; + } default: printf("unsupported cmd_code = %x\n",cmd); } @@ -383,16 +459,16 @@ void print_records(struct llog_rec_hdr **recs, int rec_number) { __u32 lopt; int i, skip = 0; - + for(i = 0; i < rec_number; i++) { printf("#%.2d (%.3d)", le32_to_cpu(recs[i]->lrh_index), le32_to_cpu(recs[i]->lrh_len)); lopt = le32_to_cpu(recs[i]->lrh_type); - if (recs[i]->padding == CANCELLED) + if (recs[i]->padding == CANCELLED) printf("NOT SET "); - + if (lopt == OBD_CFG_REC) { struct lustre_cfg *lcfg; lcfg = (struct lustre_cfg *)((char*)(recs[i]) + @@ -402,6 +478,5 @@ void print_records(struct llog_rec_hdr **recs, int rec_number) printf("padding\n"); } else printf("unknown type %x\n", lopt); - } }