Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-6271 osc: handle osc eviction correctly
[fs/lustre-release.git]
/
lustre
/
osc
/
osc_object.c
diff --git
a/lustre/osc/osc_object.c
b/lustre/osc/osc_object.c
index
2b9b50a
..
16bb564
100644
(file)
--- a/
lustre/osc/osc_object.c
+++ b/
lustre/osc/osc_object.c
@@
-75,16
+75,11
@@
static int osc_object_init(const struct lu_env *env, struct lu_object *obj,
{
struct osc_object *osc = lu2osc(obj);
const struct cl_object_conf *cconf = lu2cl_conf(conf);
- int i;
osc->oo_oinfo = cconf->u.coc_oinfo;
#ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK
mutex_init(&osc->oo_debug_mutex);
#endif
- spin_lock_init(&osc->oo_seatbelt);
- for (i = 0; i < CRT_NR; ++i)
- INIT_LIST_HEAD(&osc->oo_inflight[i]);
-
INIT_LIST_HEAD(&osc->oo_ready_item);
INIT_LIST_HEAD(&osc->oo_hp_ready_item);
INIT_LIST_HEAD(&osc->oo_write_item);
@@
-102,6
+97,9
@@
static int osc_object_init(const struct lu_env *env, struct lu_object *obj,
spin_lock_init(&osc->oo_ol_spin);
INIT_LIST_HEAD(&osc->oo_ol_list);
+ atomic_set(&osc->oo_nr_ios, 0);
+ init_waitqueue_head(&osc->oo_io_waitq);
+
cl_object_page_init(lu2cl(obj), sizeof(struct osc_page));
return 0;
@@
-110,10
+108,6
@@
static int osc_object_init(const struct lu_env *env, struct lu_object *obj,
static void osc_object_free(const struct lu_env *env, struct lu_object *obj)
{
struct osc_object *osc = lu2osc(obj);
- int i;
-
- for (i = 0; i < CRT_NR; ++i)
- LASSERT(list_empty(&osc->oo_inflight[i]));
LASSERT(list_empty(&osc->oo_ready_item));
LASSERT(list_empty(&osc->oo_hp_ready_item));
@@
-128,6
+122,7
@@
static void osc_object_free(const struct lu_env *env, struct lu_object *obj)
LASSERT(atomic_read(&osc->oo_nr_reads) == 0);
LASSERT(atomic_read(&osc->oo_nr_writes) == 0);
LASSERT(list_empty(&osc->oo_ol_list));
+ LASSERT(atomic_read(&osc->oo_nr_ios) == 0);
lu_object_fini(obj);
OBD_SLAB_FREE_PTR(osc, osc_object_kmem);
@@
-260,15
+255,15
@@
static int osc_object_fiemap(const struct lu_env *env, struct cl_object *obj,
struct ll_fiemap_info_key *fmkey,
struct fiemap *fiemap, size_t *buflen)
{
- struct obd_export
*exp = osc_export(cl2osc(obj));
- struct ldlm_res_id
resid;
-
ldlm_policy_data_t
policy;
- struct lustre_handle
lockh;
-
ldlm_mode_t mode = 0
;
- struct ptlrpc_request
*req;
- struct fiemap
*reply;
- char
*tmp;
- int
rc;
+ struct obd_export *exp = osc_export(cl2osc(obj));
+ struct ldlm_res_id resid;
+
union ldlm_policy_data
policy;
+ struct lustre_handle lockh;
+
enum ldlm_mode mode = LCK_MINMODE
;
+ struct ptlrpc_request *req;
+ struct fiemap *reply;
+ char *tmp;
+ int rc;
ENTRY;
fmkey->lfik_oa.o_oi = cl2osc(obj)->oo_oinfo->loi_oi;
@@
-417,4
+412,20
@@
struct lu_object *osc_object_alloc(const struct lu_env *env,
return obj;
}
+int osc_object_invalidate(const struct lu_env *env, struct osc_object *osc)
+{
+ struct l_wait_info lwi = { 0 };
+ ENTRY;
+
+ CDEBUG(D_INODE, "Invalidate osc object: %p, # of active IOs: %d\n",
+ osc, atomic_read(&osc->oo_nr_ios));
+
+ l_wait_event(osc->oo_io_waitq, atomic_read(&osc->oo_nr_ios) == 0, &lwi);
+
+ /* Discard all pages of this object. */
+ osc_cache_truncate_start(env, osc, 0, NULL);
+
+ RETURN(0);
+}
+
/** @} osc */