From 9512620894916205f843ec6751c494c885aa7976 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 17 Dec 2018 13:39:10 +1100 Subject: [PATCH] LU-9679 osc: remove cl_io_cancel() cl_io_cancel() is never used, so remove it and various other things that it is the only user of. Signed-off-by: Mr NeilBrown Change-Id: I6cf9b53aa7fc3379e57fa0ac0ea236ccda4ff6b7 Reviewed-on: https://review.whamcloud.com/37597 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Wang Shilong Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/include/cl_object.h | 20 -------------- lustre/include/lustre_net.h | 1 - lustre/include/lustre_osc.h | 2 -- lustre/obdclass/cl_io.c | 19 ------------- lustre/obdclass/cl_page.c | 20 -------------- lustre/osc/osc_cache.c | 66 --------------------------------------------- lustre/osc/osc_page.c | 19 +------------ lustre/osc/osc_request.c | 21 +++++---------- lustre/ptlrpc/client.c | 15 +++-------- 9 files changed, 10 insertions(+), 173 deletions(-) diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index 202bec2..99d0a59 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -993,23 +993,6 @@ struct cl_page_operations { void (*cpo_clip)(const struct lu_env *env, const struct cl_page_slice *slice, int from, int to); - /** - * \pre the page was queued for transferring. - * \post page is removed from client's pending list, or -EBUSY - * is returned if it has already been in transferring. - * - * This is one of seldom page operation which is: - * 0. called from top level; - * 1. don't have vmpage locked; - * 2. every layer should synchronize execution of its ->cpo_cancel() - * with completion handlers. Osc uses client obd lock for this - * purpose. Based on there is no vvp_page_cancel and - * lov_page_cancel(), cpo_cancel is defacto protected by client lock. - * - * \see osc_page_cancel(). - */ - int (*cpo_cancel)(const struct lu_env *env, - const struct cl_page_slice *slice); /** * Write out a page by kernel. This is only called by ll_writepage * right now. @@ -2237,7 +2220,6 @@ int cl_page_cache_add (const struct lu_env *env, struct cl_io *io, struct cl_page *pg, enum cl_req_type crt); void cl_page_clip (const struct lu_env *env, struct cl_page *pg, int from, int to); -int cl_page_cancel (const struct lu_env *env, struct cl_page *page); int cl_page_flush (const struct lu_env *env, struct cl_io *io, struct cl_page *pg); @@ -2375,8 +2357,6 @@ int cl_io_read_ahead (const struct lu_env *env, struct cl_io *io, pgoff_t start, struct cl_read_ahead *ra); void cl_io_rw_advance (const struct lu_env *env, struct cl_io *io, size_t nob); -int cl_io_cancel (const struct lu_env *env, struct cl_io *io, - struct cl_page_list *queue); /** * True, iff \a io is an O_APPEND write(2). diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index f3f5b47..43efca0 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -2114,7 +2114,6 @@ struct ptlrpc_request_set *ptlrpc_prep_fcset(int max, set_producer_func func, void *arg); int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set); int ptlrpc_set_wait(const struct lu_env *env, struct ptlrpc_request_set *); -void ptlrpc_mark_interrupted(struct ptlrpc_request *req); void ptlrpc_set_destroy(struct ptlrpc_request_set *); void ptlrpc_set_add_req(struct ptlrpc_request_set *, struct ptlrpc_request *); diff --git a/lustre/include/lustre_osc.h b/lustre/include/lustre_osc.h index 6c30b61..0837764 100644 --- a/lustre/include/lustre_osc.h +++ b/lustre/include/lustre_osc.h @@ -73,7 +73,6 @@ enum async_flags { struct osc_async_page { int oap_magic; unsigned short oap_cmd; - unsigned short oap_interrupted:1; struct list_head oap_pending_item; struct list_head oap_rpc_item; @@ -575,7 +574,6 @@ long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli, long target, bool force); /* osc_cache.c */ -int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops); int osc_set_async_flags(struct osc_object *obj, struct osc_page *opg, u32 async_flags); int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index bc6dba9..fdc80ae 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -684,25 +684,6 @@ int cl_io_submit_sync(const struct lu_env *env, struct cl_io *io, EXPORT_SYMBOL(cl_io_submit_sync); /** - * Cancel an IO which has been submitted by cl_io_submit_rw. - */ -int cl_io_cancel(const struct lu_env *env, struct cl_io *io, - struct cl_page_list *queue) -{ - struct cl_page *page; - int result = 0; - - CERROR("Canceling ongoing page trasmission\n"); - cl_page_list_for_each(page, queue) { - int rc; - - rc = cl_page_cancel(env, page); - result = result ?: rc; - } - return result; -} - -/** * Main io loop. * * Pumps io through iterations calling diff --git a/lustre/obdclass/cl_page.c b/lustre/obdclass/cl_page.c index a1b1e13..2508c0c 100644 --- a/lustre/obdclass/cl_page.c +++ b/lustre/obdclass/cl_page.c @@ -1071,26 +1071,6 @@ void cl_page_print(const struct lu_env *env, void *cookie, EXPORT_SYMBOL(cl_page_print); /** - * Cancel a page which is still in a transfer. - */ -int cl_page_cancel(const struct lu_env *env, struct cl_page *page) -{ - const struct cl_page_slice *slice; - int result = 0; - - list_for_each_entry(slice, &page->cp_layers, cpl_linkage) { - if (slice->cpl_ops->cpo_cancel != NULL) - result = (*slice->cpl_ops->cpo_cancel)(env, slice); - if (result != 0) - break; - } - if (result > 0) - result = 0; - - return result; -} - -/** * Converts a byte offset within object \a obj into a page index. */ loff_t cl_offset(const struct cl_object *obj, pgoff_t idx) diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index f043f89..18c676a 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -1880,7 +1880,6 @@ static void osc_ap_completion(const struct lu_env *env, struct client_obd *cli, spin_lock(&oap->oap_lock); oap->oap_async_flags = 0; spin_unlock(&oap->oap_lock); - oap->oap_interrupted = 0; if (oap->oap_cmd & OBD_BRW_WRITE && xid > 0) { spin_lock(&cli->cl_loi_list_lock); @@ -2638,71 +2637,6 @@ out: return rc; } -/** - * this is called when a sync waiter receives an interruption. Its job is to - * get the caller woken as soon as possible. If its page hasn't been put in an - * rpc yet it can dequeue immediately. Otherwise it has to mark the rpc as - * desiring interruption which will forcefully complete the rpc once the rpc - * has timed out. - */ -int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) -{ - struct osc_async_page *oap = &ops->ops_oap; - struct osc_object *obj = oap->oap_obj; - struct client_obd *cli = osc_cli(obj); - struct osc_extent *ext; - struct osc_extent *found = NULL; - struct list_head *plist; - pgoff_t index = osc_index(ops); - int rc = -EBUSY; - int cmd; - ENTRY; - - LASSERT(!oap->oap_interrupted); - oap->oap_interrupted = 1; - - /* Find out the caching extent */ - osc_object_lock(obj); - if (oap->oap_cmd & OBD_BRW_WRITE) { - plist = &obj->oo_urgent_exts; - cmd = OBD_BRW_WRITE; - } else { - plist = &obj->oo_reading_exts; - cmd = OBD_BRW_READ; - } - list_for_each_entry(ext, plist, oe_link) { - if (ext->oe_start <= index && ext->oe_end >= index) { - LASSERT(ext->oe_state == OES_LOCK_DONE); - /* For OES_LOCK_DONE state extent, it has already held - * a refcount for RPC. */ - found = osc_extent_get(ext); - break; - } - } - if (found != NULL) { - list_del_init(&found->oe_link); - osc_update_pending(obj, cmd, -found->oe_nr_pages); - osc_object_unlock(obj); - - osc_extent_finish(env, found, 0, -EINTR); - osc_extent_put(env, found); - rc = 0; - } else { - osc_object_unlock(obj); - /* ok, it's been put in an rpc. only one oap gets a request - * reference */ - if (oap->oap_request != NULL) { - ptlrpc_mark_interrupted(oap->oap_request); - ptlrpcd_wake(oap->oap_request); - ptlrpc_req_finished(oap->oap_request); - oap->oap_request = NULL; - } - } - - osc_list_maint(cli, obj); - RETURN(rc); -} - int osc_queue_sync_pages(const struct lu_env *env, const struct cl_io *io, struct osc_object *obj, struct list_head *list, int brw_flags) diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index dc62fcd..acce0ed 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -129,7 +129,7 @@ static int osc_page_print(const struct lu_env *env, struct client_obd *cli = &osc_export(obj)->exp_obd->u.cli; return (*printer)(env, cookie, LUSTRE_OSC_NAME"-page@%p %lu: " - "1< %#x %d %u %c %c > " + "1< %#x %d %c %c > " "2< %lld %u %u %#x %#x | %p %p %p > " "3< %d %lld %d > " "4< %d %d %d %lu %c | %c %c %c %c > " @@ -137,7 +137,6 @@ static int osc_page_print(const struct lu_env *env, opg, osc_index(opg), /* 1 */ oap->oap_magic, oap->oap_cmd, - oap->oap_interrupted, list_empty_marker(&oap->oap_pending_item), list_empty_marker(&oap->oap_rpc_item), /* 2 */ @@ -221,21 +220,6 @@ static void osc_page_clip(const struct lu_env *env, spin_unlock(&oap->oap_lock); } -static int osc_page_cancel(const struct lu_env *env, - const struct cl_page_slice *slice) -{ - struct osc_page *opg = cl2osc_page(slice); - int rc = 0; - - /* Check if the transferring against this page - * is completed, or not even queued. */ - if (opg->ops_transfer_pinned) - /* FIXME: may not be interrupted.. */ - rc = osc_cancel_async_page(env, opg); - LASSERT(ergo(rc == 0, opg->ops_transfer_pinned == 0)); - return rc; -} - static int osc_page_flush(const struct lu_env *env, const struct cl_page_slice *slice, struct cl_io *io) @@ -260,7 +244,6 @@ static const struct cl_page_operations osc_page_ops = { .cpo_print = osc_page_print, .cpo_delete = osc_page_delete, .cpo_clip = osc_page_clip, - .cpo_cancel = osc_page_cancel, .cpo_flush = osc_page_flush, .cpo_page_touch = osc_page_touch, }; diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 15f43979..3a76729 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1940,16 +1940,12 @@ static int osc_brw_redo_request(struct ptlrpc_request *request, RETURN(rc); list_for_each_entry(oap, &aa->aa_oaps, oap_rpc_item) { - if (oap->oap_request != NULL) { - LASSERTF(request == oap->oap_request, - "request %p != oap_request %p\n", - request, oap->oap_request); - if (oap->oap_interrupted) { - ptlrpc_req_finished(new_req); - RETURN(-EINTR); - } - } - } + if (oap->oap_request != NULL) { + LASSERTF(request == oap->oap_request, + "request %p != oap_request %p\n", + request, oap->oap_request); + } + } /* * New request takes over pga and oaps from old request. * Note that copying a list_head doesn't work, need to move it... @@ -2196,7 +2192,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, int mem_tight = 0; int page_count = 0; bool soft_sync = false; - bool interrupted = false; bool ndelay = false; int i; int grant = 0; @@ -2253,8 +2248,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, else LASSERT(oap->oap_page_off + oap->oap_count == PAGE_SIZE); - if (oap->oap_interrupted) - interrupted = true; } if (ext->oe_ndelay) ndelay = true; @@ -2293,8 +2286,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, req->rq_interpret_reply = brw_interpret; req->rq_memalloc = mem_tight != 0; oap->oap_request = ptlrpc_request_addref(req); - if (interrupted && !req->rq_intr) - ptlrpc_mark_interrupted(req); if (ndelay) { req->rq_no_resend = req->rq_no_delay = 1; /* probably set a shorter timeout value. diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 98486eb..ca510a7 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -2363,17 +2363,6 @@ void ptlrpc_expired_set(struct ptlrpc_request_set *set) } /** - * Sets rq_intr flag in \a req under spinlock. - */ -void ptlrpc_mark_interrupted(struct ptlrpc_request *req) -{ - spin_lock(&req->rq_lock); - req->rq_intr = 1; - spin_unlock(&req->rq_lock); -} -EXPORT_SYMBOL(ptlrpc_mark_interrupted); - -/** * Interrupts (sets interrupted flag) all uncompleted requests in * a set \a data. Callback for l_wait_event for interruptible waits. */ @@ -2396,7 +2385,9 @@ static void ptlrpc_interrupted_set(struct ptlrpc_request_set *set) !req->rq_allow_intr) continue; - ptlrpc_mark_interrupted(req); + spin_lock(&req->rq_lock); + req->rq_intr = 1; + spin_unlock(&req->rq_lock); } } -- 1.8.3.1