diff options
author | James Simmons <jsimmons@infradead.org> | 2017-01-28 19:05:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-03 07:01:38 -0500 |
commit | 8e7a7362c3cbb67b867a39548f6b6e2eac58c01c (patch) | |
tree | 565e208fdcc51880eecb7805b2651ddd3e1ce07f | |
parent | 098b325b8fc3bb1e000cadbae538e20cd1ee1fa7 (diff) |
staging: lustre: header: remove assert from interval_set()
In the case of interval_tree.h only interval_set()
uses LASSERT which is removed in this patch and
interval_set() instead reports a real error. The
header libcfs.h for interval_tree.h is not needed
anymore so we can just use the standard linux
kernel headers instead.h
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6401
Reviewed-on: https://review.whamcloud.com/22522
Reviewed-on: https://review.whamcloud.com/24323
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 files changed, 20 insertions, 9 deletions
diff --git a/drivers/staging/lustre/lustre/include/interval_tree.h b/drivers/staging/lustre/lustre/include/interval_tree.h index 5d387d372547..0d4f92ec8334 100644 --- a/drivers/staging/lustre/lustre/include/interval_tree.h +++ b/drivers/staging/lustre/lustre/include/interval_tree.h | |||
@@ -36,7 +36,9 @@ | |||
36 | #ifndef _INTERVAL_H__ | 36 | #ifndef _INTERVAL_H__ |
37 | #define _INTERVAL_H__ | 37 | #define _INTERVAL_H__ |
38 | 38 | ||
39 | #include "../../include/linux/libcfs/libcfs.h" /* LASSERT. */ | 39 | #include <linux/errno.h> |
40 | #include <linux/string.h> | ||
41 | #include <linux/types.h> | ||
40 | 42 | ||
41 | struct interval_node { | 43 | struct interval_node { |
42 | struct interval_node *in_left; | 44 | struct interval_node *in_left; |
@@ -73,13 +75,15 @@ static inline __u64 interval_high(struct interval_node *node) | |||
73 | return node->in_extent.end; | 75 | return node->in_extent.end; |
74 | } | 76 | } |
75 | 77 | ||
76 | static inline void interval_set(struct interval_node *node, | 78 | static inline int interval_set(struct interval_node *node, |
77 | __u64 start, __u64 end) | 79 | __u64 start, __u64 end) |
78 | { | 80 | { |
79 | LASSERT(start <= end); | 81 | if (start > end) |
82 | return -ERANGE; | ||
80 | node->in_extent.start = start; | 83 | node->in_extent.start = start; |
81 | node->in_extent.end = end; | 84 | node->in_extent.end = end; |
82 | node->in_max_high = end; | 85 | node->in_max_high = end; |
86 | return 0; | ||
83 | } | 87 | } |
84 | 88 | ||
85 | /* | 89 | /* |
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index 5616ea4197cd..08f97e2117ed 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | |||
@@ -162,7 +162,7 @@ void ldlm_extent_add_lock(struct ldlm_resource *res, | |||
162 | struct interval_node *found, **root; | 162 | struct interval_node *found, **root; |
163 | struct ldlm_interval *node; | 163 | struct ldlm_interval *node; |
164 | struct ldlm_extent *extent; | 164 | struct ldlm_extent *extent; |
165 | int idx; | 165 | int idx, rc; |
166 | 166 | ||
167 | LASSERT(lock->l_granted_mode == lock->l_req_mode); | 167 | LASSERT(lock->l_granted_mode == lock->l_req_mode); |
168 | 168 | ||
@@ -176,7 +176,8 @@ void ldlm_extent_add_lock(struct ldlm_resource *res, | |||
176 | 176 | ||
177 | /* node extent initialize */ | 177 | /* node extent initialize */ |
178 | extent = &lock->l_policy_data.l_extent; | 178 | extent = &lock->l_policy_data.l_extent; |
179 | interval_set(&node->li_node, extent->start, extent->end); | 179 | rc = interval_set(&node->li_node, extent->start, extent->end); |
180 | LASSERT(!rc); | ||
180 | 181 | ||
181 | root = &res->lr_itree[idx].lit_root; | 182 | root = &res->lr_itree[idx].lit_root; |
182 | found = interval_insert(&node->li_node, root); | 183 | found = interval_insert(&node->li_node, root); |
diff --git a/drivers/staging/lustre/lustre/llite/range_lock.c b/drivers/staging/lustre/lustre/llite/range_lock.c index 94c818f1478b..14148a097476 100644 --- a/drivers/staging/lustre/lustre/llite/range_lock.c +++ b/drivers/staging/lustre/lustre/llite/range_lock.c | |||
@@ -61,17 +61,23 @@ void range_lock_tree_init(struct range_lock_tree *tree) | |||
61 | * Pre: Caller should have allocated the range lock node. | 61 | * Pre: Caller should have allocated the range lock node. |
62 | * Post: The range lock node is meant to cover [start, end] region | 62 | * Post: The range lock node is meant to cover [start, end] region |
63 | */ | 63 | */ |
64 | void range_lock_init(struct range_lock *lock, __u64 start, __u64 end) | 64 | int range_lock_init(struct range_lock *lock, __u64 start, __u64 end) |
65 | { | 65 | { |
66 | int rc; | ||
67 | |||
66 | memset(&lock->rl_node, 0, sizeof(lock->rl_node)); | 68 | memset(&lock->rl_node, 0, sizeof(lock->rl_node)); |
67 | if (end != LUSTRE_EOF) | 69 | if (end != LUSTRE_EOF) |
68 | end >>= PAGE_SHIFT; | 70 | end >>= PAGE_SHIFT; |
69 | interval_set(&lock->rl_node, start >> PAGE_SHIFT, end); | 71 | rc = interval_set(&lock->rl_node, start >> PAGE_SHIFT, end); |
72 | if (rc) | ||
73 | return rc; | ||
74 | |||
70 | INIT_LIST_HEAD(&lock->rl_next_lock); | 75 | INIT_LIST_HEAD(&lock->rl_next_lock); |
71 | lock->rl_task = NULL; | 76 | lock->rl_task = NULL; |
72 | lock->rl_lock_count = 0; | 77 | lock->rl_lock_count = 0; |
73 | lock->rl_blocking_ranges = 0; | 78 | lock->rl_blocking_ranges = 0; |
74 | lock->rl_sequence = 0; | 79 | lock->rl_sequence = 0; |
80 | return rc; | ||
75 | } | 81 | } |
76 | 82 | ||
77 | static inline struct range_lock *next_lock(struct range_lock *lock) | 83 | static inline struct range_lock *next_lock(struct range_lock *lock) |
diff --git a/drivers/staging/lustre/lustre/llite/range_lock.h b/drivers/staging/lustre/lustre/llite/range_lock.h index c6d04a6f99fd..779091ccec4e 100644 --- a/drivers/staging/lustre/lustre/llite/range_lock.h +++ b/drivers/staging/lustre/lustre/llite/range_lock.h | |||
@@ -76,7 +76,7 @@ struct range_lock_tree { | |||
76 | }; | 76 | }; |
77 | 77 | ||
78 | void range_lock_tree_init(struct range_lock_tree *tree); | 78 | void range_lock_tree_init(struct range_lock_tree *tree); |
79 | void range_lock_init(struct range_lock *lock, __u64 start, __u64 end); | 79 | int range_lock_init(struct range_lock *lock, __u64 start, __u64 end); |
80 | int range_lock(struct range_lock_tree *tree, struct range_lock *lock); | 80 | int range_lock(struct range_lock_tree *tree, struct range_lock *lock); |
81 | void range_unlock(struct range_lock_tree *tree, struct range_lock *lock); | 81 | void range_unlock(struct range_lock_tree *tree, struct range_lock *lock); |
82 | #endif | 82 | #endif |