From 980df27d988fd1783974273ed3074db86632f6a7 Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 13 Oct 2006 10:28:15 +0000 Subject: [PATCH] iam: use config.h switches, defined by ./configure --- .../kernel_patches/patches/ext3-iam-separate.patch | 14 +-- lustre/kernel_patches/patches/ext3-iam-uapi.patch | 127 +++++++++++++-------- 2 files changed, 86 insertions(+), 55 deletions(-) diff --git a/lustre/kernel_patches/patches/ext3-iam-separate.patch b/lustre/kernel_patches/patches/ext3-iam-separate.patch index 03e378c..ca2d683 100644 --- a/lustre/kernel_patches/patches/ext3-iam-separate.patch +++ b/lustre/kernel_patches/patches/ext3-iam-separate.patch @@ -354,7 +354,7 @@ Index: iam/fs/ext3/iam.c + return iam_leaf_ops(leaf)->key_cmp(leaf, key); +} + -+#if EXT3_INVARIANT ++#if EXT3_INVARIANT_ON +static int iam_leaf_check(struct iam_leaf *leaf); +extern int dx_node_check(struct iam_path *p, struct iam_frame *f); + @@ -457,7 +457,7 @@ Index: iam/fs/ext3/iam.c + return iam_leaf_ops(l)->can_add(l, k, r); +} + -+#if EXT3_INVARIANT ++#if EXT3_INVARIANT_ON +static int iam_leaf_check(struct iam_leaf *leaf) +{ + return 1; @@ -1514,7 +1514,7 @@ Index: iam/fs/ext3/iam_htree.c + return 0; +} + -+#if EXT3_CORRECTNESS || EXT3_INVARIANT ++#if EXT3_CORRECTNESS_ON || EXT3_INVARIANT_ON +static int iam_leaf_at_rec(const struct iam_leaf *folio) +{ + struct ext3_dir_entry_2 *ent; @@ -2147,7 +2147,7 @@ Index: iam/fs/ext3/iam_lfix.c + +static struct iam_lentry *iam_lfix_get_end(const struct iam_leaf *l); + -+#if EXT3_CORRECTNESS || EXT3_INVARIANT ++#if EXT3_CORRECTNESS_ON || EXT3_INVARIANT_ON +static int iam_leaf_at_rec(const struct iam_leaf *folio) +{ + return @@ -2958,7 +2958,7 @@ Index: iam/fs/ext3/iam_lvar.c + return lentry_lvar(l->il_at); +} + -+#if EXT3_CORRECTNESS || EXT3_INVARIANT ++#if EXT3_CORRECTNESS_ON || EXT3_INVARIANT_ON +static int n_at_rec(const struct iam_leaf *folio) +{ + return @@ -4946,7 +4946,7 @@ Index: iam/fs/ext3/namei.c - err = iam_leaf_init(path, &leaf); - if (err) - goto errout; -+ if (EXT3_INVARIANT) { ++ if (EXT3_INVARIANT_ON) { + err = param->id_ops->id_node_check(path, frame); + if (err != 0) + break; @@ -4985,7 +4985,7 @@ Index: iam/fs/ext3/namei.c + } + + frame->at = iam_entry_shift(path, p, -1); -+ if (EXT3_INVARIANT) { // linear search cross check ++ if (EXT3_INVARIANT_ON) { // linear search cross check + unsigned n = count - 1; + struct iam_entry *at; + diff --git a/lustre/kernel_patches/patches/ext3-iam-uapi.patch b/lustre/kernel_patches/patches/ext3-iam-uapi.patch index a148f2a..812e781 100644 --- a/lustre/kernel_patches/patches/ext3-iam-uapi.patch +++ b/lustre/kernel_patches/patches/ext3-iam-uapi.patch @@ -27,7 +27,7 @@ Index: iam/fs/ext3/dir.c } -+#if EXT3_INVARIANT ++#if EXT3_INVARIANT_ON int ext3_check_dir_entry (const char * function, struct inode * dir, struct ext3_dir_entry_2 * de, struct buffer_head * bh, @@ -495,7 +495,7 @@ Index: iam/include/linux/lustre_iam.h /* * linux/include/linux/lustre_iam.h */ -@@ -57,14 +54,64 @@ enum { +@@ -57,14 +54,95 @@ enum { * [2] reserved for leaf node operations. * * [3] reserved for index operations. @@ -521,38 +521,69 @@ Index: iam/include/linux/lustre_iam.h + * Various debugging levels. + */ + ++#if 0 ++/* ++ * Following macros are defined in config.h and are tunable through ++ * appropriate configure switches (indicated below). ++ */ ++ +/* + * Compile basic assertions in. You want this most of the time. ++ * ++ * --{enable,disable}-ldiskfs-assert (on by default). + */ +#define EXT3_ASSERT (1) + +/* + * Compile heavier correctness checks in. You want this during development + * cycle. ++ * ++ * --{enable,disable}-ldiskfs-correctness (off by default). + */ +#define EXT3_CORRECTNESS (1) + +/* + * Compile heavy invariant checking in. You want this early during development + * or when chasing a bug. ++ * ++ * --{enable,disable}-ldiskfs-invariant (off by default). + */ +#define EXT3_INVARIANT (1) ++#endif ++ ++#if defined(EXT3_ASSERT) ++#define EXT3_ASSERT_ON (1) ++#else ++#define EXT3_ASSERT_ON (0) ++#endif ++ ++#if defined(EXT3_CORRECTNESS) ++#define EXT3_CORRECTNESS_ON (1) ++#else ++#define EXT3_CORRECTNESS_ON (0) ++#endif ++ ++#if defined(EXT3_INVARIANT) ++#define EXT3_INVARIANT_ON (1) ++#else ++#define EXT3_INVARIANT_ON (0) ++#endif + +#ifndef assert -+#if EXT3_ASSERT ++#if EXT3_ASSERT_ON +#define assert(test) J_ASSERT(test) +#else +#define assert(test) ((void)(test)) +#endif +#endif + -+#if EXT3_CORRECTNESS ++#if EXT3_CORRECTNESS_ON +#define assert_corr(test) J_ASSERT(test) +#else +#define assert_corr(test) do {;} while (0) +#endif + -+#if EXT3_INVARIANT ++#if EXT3_INVARIANT_ON +#define assert_inv(test) J_ASSERT(test) +#else +#define assert_inv(test) do {;} while (0) @@ -561,7 +592,7 @@ Index: iam/include/linux/lustre_iam.h /* * Entry within index tree node. Consists of a key immediately followed * (without padding) by a pointer to the child node. -@@ -86,14 +133,21 @@ struct iam_entry_compat { +@@ -86,14 +164,21 @@ struct iam_entry_compat { */ struct iam_key; @@ -588,7 +619,7 @@ Index: iam/include/linux/lustre_iam.h typedef __u64 iam_ptr_t; /* -@@ -123,6 +177,31 @@ struct iam_leaf { +@@ -123,6 +208,31 @@ struct iam_leaf { void *il_descr_data; }; @@ -620,7 +651,7 @@ Index: iam/include/linux/lustre_iam.h struct iam_operations { /* * Returns pointer (in the same sense as pointer in index entry) to -@@ -131,11 +210,15 @@ struct iam_operations { +@@ -131,11 +241,15 @@ struct iam_operations { __u32 (*id_root_ptr)(struct iam_container *c); /* @@ -638,7 +669,7 @@ Index: iam/include/linux/lustre_iam.h * Initialize new node (stored in @bh) that is going to be added into * tree. */ -@@ -144,23 +227,33 @@ struct iam_operations { +@@ -144,23 +258,33 @@ struct iam_operations { int (*id_node_read)(struct iam_container *c, iam_ptr_t ptr, handle_t *h, struct buffer_head **bh); /* @@ -680,7 +711,7 @@ Index: iam/include/linux/lustre_iam.h struct iam_leaf_operations { /* * leaf operations. -@@ -186,7 +279,8 @@ struct iam_leaf_operations { +@@ -186,7 +310,8 @@ struct iam_leaf_operations { void (*start)(struct iam_leaf *l); /* more leaf to the next entry. */ void (*next)(struct iam_leaf *l); @@ -690,7 +721,7 @@ Index: iam/include/linux/lustre_iam.h * either pointer to the key stored in node, or copy key into * @k buffer supplied by caller and return pointer to this * buffer. The latter approach is used when keys in nodes are -@@ -194,8 +288,10 @@ struct iam_leaf_operations { +@@ -194,8 +319,10 @@ struct iam_leaf_operations { * all). * * Caller should assume that returned pointer is only valid @@ -703,7 +734,7 @@ Index: iam/include/linux/lustre_iam.h /* return pointer to entry body. Pointer is valid while corresponding leaf node is locked and pinned. */ struct iam_rec *(*rec)(const struct iam_leaf *l); -@@ -203,6 +299,9 @@ struct iam_leaf_operations { +@@ -203,6 +330,9 @@ struct iam_leaf_operations { void (*key_set)(struct iam_leaf *l, const struct iam_key *k); void (*rec_set)(struct iam_leaf *l, const struct iam_rec *r); @@ -713,7 +744,7 @@ Index: iam/include/linux/lustre_iam.h /* * Search leaf @l for a record with key @k or for a place * where such record is to be inserted. -@@ -210,6 +309,7 @@ struct iam_leaf_operations { +@@ -210,6 +340,7 @@ struct iam_leaf_operations { * Scratch keys from @path can be used. */ int (*lookup)(struct iam_leaf *l, const struct iam_key *k); @@ -721,7 +752,7 @@ Index: iam/include/linux/lustre_iam.h int (*can_add)(const struct iam_leaf *l, const struct iam_key *k, const struct iam_rec *r); -@@ -221,12 +321,13 @@ struct iam_leaf_operations { +@@ -221,12 +352,13 @@ struct iam_leaf_operations { /* * remove rec for a leaf */ @@ -737,7 +768,7 @@ Index: iam/include/linux/lustre_iam.h }; struct iam_path *iam_leaf_path(const struct iam_leaf *leaf); -@@ -241,6 +342,10 @@ struct iam_descr { +@@ -241,6 +373,10 @@ struct iam_descr { */ size_t id_key_size; /* @@ -748,7 +779,7 @@ Index: iam/include/linux/lustre_iam.h * Size of a pointer to the next level (stored in index nodes), in * bytes. */ -@@ -264,6 +369,9 @@ struct iam_descr { +@@ -264,6 +400,9 @@ struct iam_descr { struct iam_leaf_operations *id_leaf_ops; }; @@ -758,7 +789,7 @@ Index: iam/include/linux/lustre_iam.h struct iam_container { /* * Underlying flat file. IO against this object is issued to -@@ -284,7 +392,7 @@ struct iam_path_descr { +@@ -284,7 +423,7 @@ struct iam_path_descr { /* * Scratch-pad area for temporary keys. */ @@ -767,7 +798,7 @@ Index: iam/include/linux/lustre_iam.h }; /* -@@ -316,6 +424,7 @@ struct iam_path { +@@ -316,6 +455,7 @@ struct iam_path { * Key searched for. */ const struct iam_key *ip_key_target; @@ -775,7 +806,7 @@ Index: iam/include/linux/lustre_iam.h /* * Description-specific data. */ -@@ -334,6 +443,7 @@ struct iam_path_compat { +@@ -334,6 +474,7 @@ struct iam_path_compat { struct dx_hash_info *ipc_hinfo; struct dentry *ipc_dentry; struct iam_path_descr ipc_descr; @@ -783,7 +814,7 @@ Index: iam/include/linux/lustre_iam.h }; /* -@@ -347,7 +457,9 @@ enum iam_it_state { +@@ -347,7 +488,9 @@ enum iam_it_state { /* initial state */ IAM_IT_DETACHED, /* iterator is above particular record in the container */ @@ -794,7 +825,7 @@ Index: iam/include/linux/lustre_iam.h }; /* -@@ -355,7 +467,7 @@ enum iam_it_state { +@@ -355,7 +498,7 @@ enum iam_it_state { */ enum iam_it_flags { /* @@ -803,7 +834,7 @@ Index: iam/include/linux/lustre_iam.h */ IAM_IT_MOVE = (1 << 0), /* -@@ -372,15 +484,26 @@ enum iam_it_flags { +@@ -372,15 +515,26 @@ enum iam_it_flags { * doesn't point to any particular record in this container. * * After successful call to iam_it_get() and until corresponding call to @@ -833,7 +864,7 @@ Index: iam/include/linux/lustre_iam.h * */ struct iam_iterator { -@@ -390,7 +513,8 @@ struct iam_iterator { +@@ -390,7 +544,8 @@ struct iam_iterator { __u32 ii_flags; enum iam_it_state ii_state; /* @@ -843,7 +874,7 @@ Index: iam/include/linux/lustre_iam.h */ struct iam_path ii_path; }; -@@ -405,133 +529,26 @@ void iam_path_compat_fini(struct iam_pat +@@ -405,133 +560,26 @@ void iam_path_compat_fini(struct iam_pat struct iam_path_descr *iam_ipd_alloc(int keysize); void iam_ipd_free(struct iam_path_descr *ipd); @@ -982,7 +1013,7 @@ Index: iam/include/linux/lustre_iam.h int iam_it_load(struct iam_iterator *it, iam_pos_t pos); int iam_lookup(struct iam_container *c, const struct iam_key *k, -@@ -539,10 +556,10 @@ int iam_lookup(struct iam_container *c, +@@ -539,10 +587,10 @@ int iam_lookup(struct iam_container *c, int iam_delete(handle_t *h, struct iam_container *c, const struct iam_key *k, struct iam_path_descr *pd); int iam_update(handle_t *h, struct iam_container *c, const struct iam_key *k, @@ -995,7 +1026,7 @@ Index: iam/include/linux/lustre_iam.h /* * Initialize container @c. */ -@@ -558,10 +575,6 @@ void iam_container_fini(struct iam_conta +@@ -558,10 +606,6 @@ void iam_container_fini(struct iam_conta */ int iam_container_setup(struct iam_container *c); @@ -1006,7 +1037,7 @@ Index: iam/include/linux/lustre_iam.h static inline struct iam_descr *iam_container_descr(struct iam_container *c) { return c->ic_descr; -@@ -577,16 +590,65 @@ static inline struct inode *iam_path_obj +@@ -577,16 +621,65 @@ static inline struct inode *iam_path_obj return p->ip_container->ic_object; } @@ -1014,12 +1045,16 @@ Index: iam/include/linux/lustre_iam.h - struct iam_key *k1, const struct iam_key *k2) +static inline void iam_ikeycpy(const struct iam_container *c, + struct iam_ikey *k1, const struct iam_ikey *k2) -+{ + { +- memcpy(k1, k2, c->ic_descr->id_key_size); + memcpy(k1, k2, c->ic_descr->id_ikey_size); -+} -+ + } + +-static inline int iam_keycmp(const struct iam_container *c, +- const struct iam_key *k1, const struct iam_key *k2) +static inline size_t iam_entry_size(struct iam_path *p) -+{ + { +- return c->ic_descr->id_ops->id_keycmp(c, k1, k2); + return iam_path_descr(p)->id_ikey_size + iam_path_descr(p)->id_ptr_size; +} + @@ -1034,17 +1069,13 @@ Index: iam/include/linux/lustre_iam.h +static inline struct iam_ikey *iam_get_ikey(struct iam_path *p, + struct iam_entry *entry, + struct iam_ikey *key) - { -- memcpy(k1, k2, c->ic_descr->id_key_size); ++{ + return memcpy(key, entry, iam_path_descr(p)->id_ikey_size); - } - --static inline int iam_keycmp(const struct iam_container *c, -- const struct iam_key *k1, const struct iam_key *k2) ++} ++ +static inline struct iam_ikey *iam_ikey_at(struct iam_path *p, + struct iam_entry *entry) - { -- return c->ic_descr->id_ops->id_keycmp(c, k1, k2); ++{ + return (struct iam_ikey *)entry; +} + @@ -1078,7 +1109,7 @@ Index: iam/include/linux/lustre_iam.h } static inline void iam_reccpy(const struct iam_path *p, struct iam_rec *rec_dst, -@@ -604,7 +666,7 @@ static inline void *iam_entry_off(struct +@@ -604,7 +697,7 @@ static inline void *iam_entry_off(struct static inline unsigned dx_get_block(struct iam_path *p, struct iam_entry *entry) { return le32_to_cpu(*(u32*)iam_entry_off(entry, @@ -1087,7 +1118,7 @@ Index: iam/include/linux/lustre_iam.h & 0x00ffffff; } -@@ -612,21 +674,64 @@ static inline void dx_set_block(struct i +@@ -612,21 +705,64 @@ static inline void dx_set_block(struct i struct iam_entry *entry, unsigned value) { *(u32*)iam_entry_off(entry, @@ -1156,7 +1187,7 @@ Index: iam/include/linux/lustre_iam.h static inline unsigned dx_get_count(struct iam_entry *entries) { return le16_to_cpu(((struct dx_countlimit *) entries)->count); -@@ -647,9 +752,21 @@ static inline unsigned dx_node_limit(str +@@ -647,9 +783,21 @@ static inline unsigned dx_node_limit(str struct iam_descr *param = iam_path_descr(p); unsigned entry_space = iam_path_obj(p)->i_sb->s_blocksize - param->id_node_gap; @@ -1179,7 +1210,7 @@ Index: iam/include/linux/lustre_iam.h static inline struct iam_entry *dx_get_entries(struct iam_path *path, void *data, int root) { -@@ -665,7 +782,8 @@ static inline struct iam_entry *dx_node_ +@@ -665,7 +813,8 @@ static inline struct iam_entry *dx_node_ frame->bh->b_data, frame == path->ip_frames); } @@ -1189,7 +1220,7 @@ Index: iam/include/linux/lustre_iam.h { assert(0 <= nr && nr < ARRAY_SIZE(path->ip_data->ipd_key_scratch)); return path->ip_data->ipd_key_scratch[nr]; -@@ -674,6 +792,7 @@ static inline struct iam_key *iam_path_k +@@ -674,6 +823,7 @@ static inline struct iam_key *iam_path_k int dx_lookup(struct iam_path *path); void dx_insert_block(struct iam_path *path, struct iam_frame *frame, u32 hash, u32 block); @@ -1197,7 +1228,7 @@ Index: iam/include/linux/lustre_iam.h int ext3_htree_next_block(struct inode *dir, __u32 hash, struct iam_path *path, __u32 *start_hash); -@@ -681,6 +800,20 @@ int ext3_htree_next_block(struct inode * +@@ -681,6 +831,20 @@ int ext3_htree_next_block(struct inode * struct buffer_head *ext3_append(handle_t *handle, struct inode *inode, u32 *block, int *err); int split_index_node(handle_t *handle, struct iam_path *path); @@ -1218,7 +1249,7 @@ Index: iam/include/linux/lustre_iam.h /* * external -@@ -698,10 +831,12 @@ int iam_node_read(struct iam_container * +@@ -698,10 +862,12 @@ int iam_node_read(struct iam_container * handle_t *handle, struct buffer_head **bh); void iam_insert_key(struct iam_path *path, struct iam_frame *frame, @@ -1232,7 +1263,7 @@ Index: iam/include/linux/lustre_iam.h struct iam_path *iam_leaf_path(const struct iam_leaf *leaf); struct iam_container *iam_leaf_container(const struct iam_leaf *leaf); -@@ -709,14 +844,95 @@ struct iam_descr *iam_leaf_descr(const s +@@ -709,14 +875,95 @@ struct iam_descr *iam_leaf_descr(const s struct iam_leaf_operations *iam_leaf_ops(const struct iam_leaf *leaf); @@ -1273,7 +1304,7 @@ Index: iam/include/linux/lustre_iam.h + unsigned long arg); + +/* dir.c */ -+#if EXT3_INVARIANT ++#if EXT3_INVARIANT_ON +extern int ext3_check_dir_entry(const char *, struct inode *, + struct ext3_dir_entry_2 *, + struct buffer_head *, unsigned long); -- 1.8.3.1