libceph: a few miscellaneous cleanups
PATCH 1/3 libceph: lock outside send_queued()
In reply to Alex ElderTwo of the three callers of the osd client's send_queued() function already hold the osd client mutex and drop it before the call.
Change send_queued() so it assumes the caller holds the mutex, and update all callers accordingly. Rename it __send_queued() to match the convention used elsewhere in the file with respect to the lock.
--- net/ceph/osd_client.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
net/ceph/osd_client.c +2 -2
@@ -23,7 +23,7 @@static const struct ceph_connection_operations osd_con_ops; -static void send_queued (struct ceph_osd_client *osdc); +static void __send_queued (struct ceph_osd_client *osdc);static int __reset_osd (struct ceph_osd_client *osdc,struct ceph_osd *osd);static void __register_request (struct ceph_osd_client *osdc,struct ceph_osd_request *req);
@@ -554,8 +554,8 @@ static void osd_reset(struct ceph_connection *con)down_read (&osdc->map_sem);mutex_lock (&osdc->request_mutex);__kick_osd_requests (osdc, osd); +__send_queued (osdc);mutex_unlock (&osdc->request_mutex); -send_queued (osdc);up_read (&osdc->map_sem); }
@@ -997,16 +997,13 @@ static void __send_request(struct ceph_osd_client
*osdc,
/*
* Send any requests in the queue (req_unsent). */
-static void send_queued(struct ceph_osd_client *osdc) +static void __send_queued(struct ceph_osd_client *osdc)
{
struct ceph_osd_request *req, *tmp;
- dout("send_queued\n");
- mutex_lock(&osdc->request_mutex);
- list_for_each_entry_safe(req, tmp, &osdc->req_unsent, r_req_lru_item) {
+ dout("__send_queued\n");
+ list_for_each_entry_safe(req, tmp, &osdc->req_unsent, r_req_lru_item)
__send_request(osdc, req);
- }
- mutex_unlock(&osdc->request_mutex);
}
/*
@@ -1058,8 +1055,8 @@ static void handle_timeout(struct work_struct *work)
}
__schedule_osd_timeout(osdc);
+ __send_queued(osdc);
mutex_unlock(&osdc->request_mutex);
- send_queued(osdc);
up_read(&osdc->map_sem);
}
@@ -1397,7 +1394,9 @@ done:
if (ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL))
ceph_monc_request_next_osdmap(&osdc->client->monc);
- send_queued(osdc);
+ mutex_lock(&osdc->request_mutex);
+ __send_queued(osdc);
+ mutex_unlock(&osdc->request_mutex);
up_read(&osdc->map_sem);
wake_up_all(&osdc->client->auth_wq);
return;
Signature · 1 line
1.7.9.5
PATCH 2/3 libdeph: don't export ceph_osdc_init() or ceph_osdc_stop()
In reply to Alex ElderThe only callers of ceph_osdc_init() and ceph_osdc_stop() ceph_create_client() and ceph_destroy_client() (respectively) and they are in the same kernel module as those two functions. There's therefore no need to export those interfaces, so don't.
--- net/ceph/osd_client.c | 2 -- 1 file changed, 2 deletions(-)
net/ceph/osd_client.c +0 -2
@@ -1799,7 +1799,6 @@ out_mempool: out:return err; } -EXPORT_SYMBOL (ceph_osdc_init);void ceph_osdc_stop (struct ceph_osd_client *osdc) {
@@ -1816,7 +1815,6 @@ void ceph_osdc_stop(struct ceph_osd_client *osdc)ceph_msgpool_destroy (&osdc->msgpool_op);ceph_msgpool_destroy (&osdc->msgpool_op_reply); } -EXPORT_SYMBOL (ceph_osdc_stop);/* * Read some contiguous pages. If we cross a stripe boundary, shorten
Signature · 1 line
1.7.9.5
PATCH 3/3 libceph: kill ceph_calc_raw_layout()
In reply to Alex ElderThere is no caller of ceph_calc_raw_layout() outside of libceph, so there's no need to export from the module.
Furthermore, there is only one caller, in calc_layout(), and it is not much more than a simple wrapper for that function.
So get rid of ceph_calc_raw_layout() and embed it instead within calc_layout().
While touching "osd_client.c", get rid of the unnecessary forward declaration of __send_request().
--- include/linux/ceph/osd_client.h | 5 --- net/ceph/osd_client.c | 77 ++++++++++++++++----------------------- 2 files changed, 32 insertions(+), 50 deletions(-)
(quoted diff) +0 -0
b/include/linux/ceph/osd_client.h
index 5812802..c39e7ed 100644
include/linux/ceph/osd_client.h +0 -0
@@ -207,11 +207,6 @@ extern void ceph_osdc_handle_reply(struct
ceph_osd_client *osdc,
extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
struct ceph_msg *msg);
-extern int ceph_calc_raw_layout(struct ceph_file_layout *layout,
- u64 off, u64 *plen, u64 *bno,
- struct ceph_osd_request *req,
- struct ceph_osd_req_op *op);
-
extern struct ceph_osd_request *ceph_osdc_alloc_request(structceph_osd_client *osdc,
struct ceph_snap_context *snapc, unsigned int num_op,
net/ceph/osd_client.c +32 -45
93 lines not on this page · raw message
Signature · 1 line
1.7.9.5
cover libceph: a few miscellaneous cleanups
These changes aren't all that closely related, but they all are cleanups in the osd client.
-Alex
[PATCH 1/3] libceph: lock outside send_queued()
[PATCH 2/3] libdeph: don't export ceph_osdc_init() or ceph_osdc_stop() [PATCH 3/3] libceph: kill ceph_calc_raw_layout()
Quoted 8 lines · Alex Elder
These changes aren't all that closely related, but they all are cleanups in the osd client.
-Alex
[PATCH 1/3] libceph: lock outside
send_queued()
[PATCH 2/3] libdeph: don't exportceph_osdc_init()orceph_osdc_stop()[PATCH 3/3] libceph: killceph_calc_raw_layout()
These look good.