Lov_finish_set in lov_request.c considers freeing various things that
have never been initialized. Drop this and some dependent unnecessary
code.
drivers/staging/lustre/lustre/lov/lov_internal.h | 37 ------------------------
drivers/staging/lustre/lustre/lov/lov_request.c | 10 -------
2 files changed, 47 deletions(-)
Show replies by thread
The lov_lock_handles structure is only used as the type of the field
set_lockh in the lov_request_set structure, and this field is never set to
any value. Drop a test and free of this field in lov_finish_set. This
change enables also removing the functions lov_handle2llh and lov_llh_put
that manipulate values of type lov_lock_handles, but are now never called.
Signed-off-by: Julia Lawall <Julia.Lawall(a)lip6.fr>
---
drivers/staging/lustre/lustre/lov/lov_internal.h | 34 -----------------------
drivers/staging/lustre/lustre/lov/lov_request.c | 3 --
2 files changed, 37 deletions(-)
diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h
b/drivers/staging/lustre/lustre/lov/lov_internal.h
index 5e8bcc6..f52a90c 100644
--- a/drivers/staging/lustre/lustre/lov/lov_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_internal.h
@@ -71,13 +71,6 @@
})
#endif
-struct lov_lock_handles {
- struct portals_handle llh_handle;
- atomic_t llh_refcount;
- int llh_stripe_count;
- struct lustre_handle llh_handles[0];
-};
-
struct lov_request {
struct obd_info rq_oi;
struct lov_request_set *rq_rqset;
@@ -111,7 +104,6 @@ struct lov_request_set {
struct obd_trans_info *set_oti;
u32 set_oabufs;
struct brw_page *set_pga;
- struct lov_lock_handles *set_lockh;
struct list_head set_list;
wait_queue_head_t set_waitq;
spinlock_t set_lock;
@@ -136,32 +128,6 @@ static inline void lov_put_reqset(struct lov_request_set *set)
lov_finish_set(set);
}
-static inline struct lov_lock_handles *
-lov_handle2llh(struct lustre_handle *handle)
-{
- LASSERT(handle != NULL);
- return class_handle2object(handle->cookie);
-}
-
-static inline void lov_llh_put(struct lov_lock_handles *llh)
-{
- CDEBUG(D_INFO, "PUTting llh %p : new refcount %d\n", llh,
- atomic_read(&llh->llh_refcount) - 1);
- LASSERT(atomic_read(&llh->llh_refcount) > 0 &&
- atomic_read(&llh->llh_refcount) < 0x5a5a);
- if (atomic_dec_and_test(&llh->llh_refcount)) {
- class_handle_unhash(&llh->llh_handle);
- /* The structure may be held by other threads because RCU.
- * -jxiong */
- if (atomic_read(&llh->llh_refcount))
- return;
-
- OBD_FREE_RCU(llh, sizeof(*llh) +
- sizeof(*llh->llh_handles) * llh->llh_stripe_count,
- &llh->llh_handle);
- }
-}
-
#define lov_uuid2str(lv, index) \
(char *)((lv)->lov_tgts[index]->ltd_uuid.uuid)
diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c
b/drivers/staging/lustre/lustre/lov/lov_request.c
index f6e1314..7769f14 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -78,9 +78,6 @@ void lov_finish_set(struct lov_request_set *set)
int len = set->set_oabufs * sizeof(*set->set_pga);
OBD_FREE_LARGE(set->set_pga, len);
}
- if (set->set_lockh)
- lov_llh_put(set->set_lockh);
-
kfree(set);
}
The fields set_oabufs and set_pga fields in the lov_request_set structure
are never set, so drop them. Drop also the corresponding test and free in
lov_finish_set.
Signed-off-by: Julia Lawall <Julia.Lawall(a)lip6.fr>
---
drivers/staging/lustre/lustre/lov/lov_internal.h | 2 --
drivers/staging/lustre/lustre/lov/lov_request.c | 5 -----
2 files changed, 7 deletions(-)
diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h
b/drivers/staging/lustre/lustre/lov/lov_internal.h
index f52a90c..e4e0cfd 100644
--- a/drivers/staging/lustre/lustre/lov/lov_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_internal.h
@@ -102,8 +102,6 @@ struct lov_request_set {
struct llog_cookie *set_cookies;
int set_cookie_sent;
struct obd_trans_info *set_oti;
- u32 set_oabufs;
- struct brw_page *set_pga;
struct list_head set_list;
wait_queue_head_t set_waitq;
spinlock_t set_lock;
diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c
b/drivers/staging/lustre/lustre/lov/lov_request.c
index 7769f14..ada0a3c 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -73,11 +73,6 @@ void lov_finish_set(struct lov_request_set *set)
kfree(req->rq_oi.oi_osfs);
kfree(req);
}
-
- if (set->set_pga) {
- int len = set->set_oabufs * sizeof(*set->set_pga);
- OBD_FREE_LARGE(set->set_pga, len);
- }
kfree(set);
}
The rq_buflen field of the lov_request structure is never initialized. It
is only used in the free of req->rq_oi.oi_md in lov_finish_set. But no
oi_md field is ever initialized to the result of calling OBD_ALLOC_LARGE.
So it seems that the call to OBD_FREE_LARGE in lov_finish_set and the
rq_buflen in the lov_request structure are simply not needed.
Signed-off-by: Julia Lawall <Julia.Lawall(a)lip6.fr>
---
drivers/staging/lustre/lustre/lov/lov_internal.h | 1 -
drivers/staging/lustre/lustre/lov/lov_request.c | 2 --
2 files changed, 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h
b/drivers/staging/lustre/lustre/lov/lov_internal.h
index e4e0cfd..dde9656 100644
--- a/drivers/staging/lustre/lustre/lov/lov_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_internal.h
@@ -81,7 +81,6 @@ struct lov_request {
int rq_stripe; /* stripe number */
int rq_complete;
int rq_rc;
- int rq_buflen; /* length of sub_md */
u32 rq_oabufs;
u32 rq_pgaidx;
diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c
b/drivers/staging/lustre/lustre/lov/lov_request.c
index ada0a3c..f4f2058 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -68,8 +68,6 @@ void lov_finish_set(struct lov_request_set *set)
if (req->rq_oi.oi_oa)
OBDO_FREE(req->rq_oi.oi_oa);
- if (req->rq_oi.oi_md)
- OBD_FREE_LARGE(req->rq_oi.oi_md, req->rq_buflen);
kfree(req->rq_oi.oi_osfs);
kfree(req);
}