* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
iam_ptr_t curidx; /* (logical) offset of this node. Used to
* per-node locking to detect concurrent
* splits. */
+ unsigned int at_shifted:1; /* The "at" entry has moved to next
+ * because of shrinking index node
+ * for recycling empty leaf node. */
};
/*
*/
void (*split)(struct iam_leaf *l, struct buffer_head **bh,
iam_ptr_t newblknr);
+ /*
+ * the leaf is empty?
+ */
+ int (*leaf_empty)(struct iam_leaf *l);
};
/*
struct iam_leaf_operations *id_leaf_ops;
};
+enum {
+ IAM_IDLE_HEADER_MAGIC = 0x7903,
+};
+
+/*
+ * Header structure to record idle blocks.
+ */
+struct iam_idle_head {
+ __le16 iih_magic;
+ __le16 iih_count; /* how many idle blocks in this head */
+ __le32 iih_next; /* next head for idle blocks */
+ __le32 iih_blks[0];
+};
+
/*
* An instance of iam container.
*/
/*
* read-write lock protecting index consistency.
*/
- cfs_rw_semaphore_t ic_sem;
+ struct rw_semaphore ic_sem;
struct dynlock ic_tree_lock;
+ /*
+ * Protect ic_idle_bh
+ */
+ struct semaphore ic_idle_sem;
+ /*
+ * BH for idle blocks
+ */
+ struct buffer_head *ic_idle_bh;
+ unsigned int ic_idle_failed:1; /* Idle block mechanism failed */
};
/*
};
struct dx_countlimit {
- __le16 limit;
- __le16 count;
+ __le16 limit;
+ __le16 count;
};
/*
static inline struct iam_ikey *iam_path_ikey(const struct iam_path *path,
int nr)
{
- assert(0 <= nr && nr < ARRAY_SIZE(path->ip_data->ipd_key_scratch));
+ LASSERT(0 <= nr && nr < ARRAY_SIZE(path->ip_data->ipd_key_scratch));
return path->ip_data->ipd_key_scratch[nr];
}
{
DX_DEVAL(iam_lock_stats.dls_bh_lock++);
#ifdef CONFIG_SMP
- while (cfs_test_and_set_bit(BH_DXLock, &bh->b_state)) {
- DX_DEVAL(iam_lock_stats.dls_bh_busy++);
- while (cfs_test_bit(BH_DXLock, &bh->b_state))
+ while (test_and_set_bit(BH_DXLock, &bh->b_state)) {
+ DX_DEVAL(iam_lock_stats.dls_bh_busy++);
+ while (test_bit(BH_DXLock, &bh->b_state))
cpu_relax();
}
#endif