* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012 Whamcloud, Inc.
+ * Copyright (c) 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
ill = iam_get_head(l);
count = le16_to_cpu(ill->ill_count);
- if (ill->ill_magic == le16_to_cpu(IAM_LEAF_HEADER_MAGIC) &&
+ if (le16_to_cpu(ill->ill_magic) == IAM_LEAF_HEADER_MAGIC &&
0 <= count && count <= leaf_count_limit(l)) {
l->il_at = l->il_entries = iam_get_lentries(l);
result = 0;
CERROR("Wrong magic in node %llu (#%lu): %#x != %#x or "
"wrong count: %d (%d)\n",
(unsigned long long)l->il_bh->b_blocknr, obj->i_ino,
- ill->ill_magic, le16_to_cpu(IAM_LEAF_HEADER_MAGIC),
+ le16_to_cpu(ill->ill_magic), IAM_LEAF_HEADER_MAGIC,
count, leaf_count_limit(l));
result = -EIO;
}
static void l_print(struct iam_leaf *leaf, struct iam_lentry *entry)
{
- int i;
- char *area;
- char h[3];
+ int i;
+ char *area;
+ char h[3];
- area = (char *)entry;
- printk(CFS_KERN_EMERG "[");
- for (i = iam_lfix_key_size(leaf); i > 0; --i, ++area)
- printk("%s", hex(*area, h));
- printk("]-(");
- for (i = iam_leaf_descr(leaf)->id_rec_size; i > 0; --i, ++area)
- printk("%s", hex(*area, h));
- printk(")\n");
+ area = (char *)entry;
+ printk(KERN_EMERG "[");
+ for (i = iam_lfix_key_size(leaf); i > 0; --i, ++area)
+ printk("%s", hex(*area, h));
+ printk("]-(");
+ for (i = iam_leaf_descr(leaf)->id_rec_size; i > 0; --i, ++area)
+ printk("%s", hex(*area, h));
+ printk(")\n");
}
static void lfix_print(struct iam_leaf *leaf)
{
- struct iam_lentry *entry;
- int count;
- int i;
+ struct iam_lentry *entry;
+ int count;
+ int i;
- entry = leaf->il_entries;
- count = lentry_count_get(leaf);
- printk(CFS_KERN_EMERG "lfix: %p %p %d\n", leaf, leaf->il_at, count);
- for (i = 0; i < count; ++i, entry = iam_lfix_shift(leaf, entry, 1))
- l_print(leaf, entry);
+ entry = leaf->il_entries;
+ count = lentry_count_get(leaf);
+ printk(KERN_EMERG "lfix: %p %p %d\n", leaf, leaf->il_at, count);
+ for (i = 0; i < count; ++i, entry = iam_lfix_shift(leaf, entry, 1))
+ l_print(leaf, entry);
}
static int iam_lfix_lookup(struct iam_leaf *l, const struct iam_key *k)
static int iam_lfix_ilookup(struct iam_leaf *l, const struct iam_ikey *ik)
{
- assert(0);
- return IAM_LOOKUP_OK;
+ return iam_lfix_lookup(l, (const struct iam_key *)ik);
}
static void iam_lfix_key_set(struct iam_leaf *l, const struct iam_key *k)
pivot = (const struct iam_ikey *)iam_leaf_key_at(start);
memmove(iam_entries(new_leaf), start, finis - start);
- hdr->ill_count = count - split;
+ hdr->ill_count = cpu_to_le16(count - split);
lentry_count_set(l, split);
if ((void *)l->il_at >= start) {
/*
struct super_block *sb;
u32 blknr;
- int result;
+ int result = 0;
unsigned long bsize;
assert_corr(obj->i_size == 0);
sb = obj->i_sb;
bsize = sb->s_blocksize;
- root_node = ldiskfs_append(handle, obj, &blknr, &result);
- leaf_node = ldiskfs_append(handle, obj, &blknr, &result);
+ root_node = osd_ldiskfs_append(handle, obj, &blknr, &result);
+ leaf_node = osd_ldiskfs_append(handle, obj, &blknr, &result);
if (root_node != NULL && leaf_node != NULL) {
lfix_root(root_node->b_data, bsize, keysize, ptrsize, recsize);
lfix_leaf(leaf_node->b_data, bsize, keysize, ptrsize, recsize);