X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fosd-ldiskfs%2Fosd_iam.c;h=5f690e01e02f016c286d0d27d457378599dcdf55;hb=HEAD;hp=373a1a75b4acfeee33f2833b3ecea0229560a532;hpb=c28682dfe3ca088e12a2d8d250c68d4644e5f17c;p=fs%2Flustre-release.git diff --git a/lustre/osd-ldiskfs/osd_iam.c b/lustre/osd-ldiskfs/osd_iam.c index 373a1a7..b9ad3e5 100644 --- a/lustre/osd-ldiskfs/osd_iam.c +++ b/lustre/osd-ldiskfs/osd_iam.c @@ -1,34 +1,15 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * 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. - * - * 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 - * version 2 along with this program; If not, see - * http://www.gnu.org/licenses/gpl-2.0.html - * - * GPL HEADER END - */ +// SPDX-License-Identifier: GPL-2.0 + /* * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * * Copyright (c) 2011, 2017, Intel Corporation. */ + /* * This file is part of Lustre, http://www.lustre.org/ * - * iam.c * Top-level entry points into iam module * * Author: Wang Di @@ -130,7 +111,6 @@ * +---------+---------+---------+---------+------+---------+-------+ * * The logic blk# for the first table is stored in the root node "idle_blocks". - * */ #include @@ -2414,57 +2394,6 @@ static inline int ptr_inside(void *base, size_t size, void *ptr) return (base <= ptr) && (ptr < base + size); } -static int iam_frame_invariant(struct iam_frame *f) -{ - return - (f->bh != NULL && - f->bh->b_data != NULL && - ptr_inside(f->bh->b_data, f->bh->b_size, f->entries) && - ptr_inside(f->bh->b_data, f->bh->b_size, f->at) && - f->entries <= f->at); -} - -static int iam_leaf_invariant(struct iam_leaf *l) -{ - return - l->il_bh != NULL && - l->il_bh->b_data != NULL && - ptr_inside(l->il_bh->b_data, l->il_bh->b_size, l->il_entries) && - ptr_inside(l->il_bh->b_data, l->il_bh->b_size, l->il_at) && - l->il_entries <= l->il_at; -} - -static int iam_path_invariant(struct iam_path *p) -{ - int i; - - if (p->ip_container == NULL || - p->ip_indirect < 0 || p->ip_indirect > DX_MAX_TREE_HEIGHT - 1 || - p->ip_frame != p->ip_frames + p->ip_indirect || - !iam_leaf_invariant(&p->ip_leaf)) - return 0; - for (i = 0; i < ARRAY_SIZE(p->ip_frames); ++i) { - if (i <= p->ip_indirect) { - if (!iam_frame_invariant(&p->ip_frames[i])) - return 0; - } - } - return 1; -} - -int iam_it_invariant(struct iam_iterator *it) -{ - return - (it->ii_state == IAM_IT_DETACHED || - it->ii_state == IAM_IT_ATTACHED || - it->ii_state == IAM_IT_SKEWED) && - !(it->ii_flags & ~(IAM_IT_MOVE | IAM_IT_WRITE)) && - ergo(it->ii_state == IAM_IT_ATTACHED || - it->ii_state == IAM_IT_SKEWED, - iam_path_invariant(&it->ii_path) && - equi(it_at_rec(it), it->ii_state == IAM_IT_SKEWED)); -} - /* * Search container @c for record with key @k. If record is found, its data * are moved into @r.