X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Fquota%2Fqsd_reint.c;h=59e38777942ad421aee34e2802e28c02b52df3dc;hb=826a8ba3e9bacbd48a7b52f715640287f4a9b952;hp=aa317fb1c7beedbd91f5c6de182173fc1a82cd73;hpb=929ec628e6fef5609e55d519a1eb9e2cbbf1f1e8;p=fs%2Flustre-release.git diff --git a/lustre/quota/qsd_reint.c b/lustre/quota/qsd_reint.c index aa317fb..59e3877 100644 --- a/lustre/quota/qsd_reint.c +++ b/lustre/quota/qsd_reint.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2011, 2012, Intel, Inc. + * Copyright (c) 2012, 2013, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -98,7 +98,7 @@ out: static int qsd_reint_entries(const struct lu_env *env, struct qsd_qtype_info *qqi, struct idx_info *ii, bool global, - cfs_page_t **pages, + struct page **pages, unsigned int npages, bool need_swab) { struct qsd_thread_info *qti = qsd_info(env); @@ -123,7 +123,7 @@ static int qsd_reint_entries(const struct lu_env *env, size = ii->ii_recsize + ii->ii_keysize; for (i = 0; i < npages; i++) { - union lu_page *lip = cfs_kmap(pages[i]); + union lu_page *lip = kmap(pages[i]); for (j = 0; j < LU_PAGE_COUNT; j++) { if (need_swab) @@ -173,7 +173,7 @@ static int qsd_reint_entries(const struct lu_env *env, lip++; } out: - cfs_kunmap(pages[i]); + kunmap(pages[i]); if (rc) break; } @@ -187,7 +187,7 @@ static int qsd_reint_index(const struct lu_env *env, struct qsd_qtype_info *qqi, struct qsd_instance *qsd = qqi->qqi_qsd; struct idx_info *ii = &qti->qti_ii; struct lu_fid *fid; - cfs_page_t **pages = NULL; + struct page **pages = NULL; unsigned int npages, pg_cnt; __u64 start_hash = 0, ver = 0; bool need_swab = false; @@ -197,15 +197,15 @@ static int qsd_reint_index(const struct lu_env *env, struct qsd_qtype_info *qqi, fid = global ? &qqi->qqi_fid : &qqi->qqi_slv_fid; /* let's do a 1MB bulk */ - npages = min_t(unsigned int, PTLRPC_MAX_BRW_SIZE, 1 << 20); - npages /= CFS_PAGE_SIZE; + npages = min_t(unsigned int, OFD_MAX_BRW_SIZE, 1 << 20); + npages /= PAGE_CACHE_SIZE; /* allocate pages for bulk index read */ OBD_ALLOC(pages, npages * sizeof(*pages)); if (pages == NULL) GOTO(out, rc = -ENOMEM); for (i = 0; i < npages; i++) { - pages[i] = cfs_alloc_page(CFS_ALLOC_STD); + pages[i] = alloc_page(GFP_IOFS); if (pages[i] == NULL) GOTO(out, rc = -ENOMEM); } @@ -258,7 +258,7 @@ repeat: ver = ii->ii_version; pg_cnt = (ii->ii_count + (LU_PAGE_COUNT) - 1); - pg_cnt >>= CFS_PAGE_SHIFT - LU_PAGE_SHIFT; + pg_cnt >>= PAGE_CACHE_SHIFT - LU_PAGE_SHIFT; if (pg_cnt > npages) { CERROR("%s: master returned more pages than expected, %u > %u" @@ -278,7 +278,7 @@ out: if (pages != NULL) { for (i = 0; i < npages; i++) if (pages[i] != NULL) - cfs_free_page(pages[i]); + __free_page(pages[i]); OBD_FREE(pages, npages * sizeof(*pages)); } @@ -417,8 +417,6 @@ static int qsd_reint_main(void *args) int rc; ENTRY; - cfs_daemonize("qsd_reint"); - CDEBUG(D_QUOTA, "%s: Starting reintegration thread for "DFID"\n", qsd->qsd_svname, PFID(&qqi->qqi_fid)); @@ -511,7 +509,7 @@ static int qsd_reint_main(void *args) qsd_bump_version(qqi, qqi->qqi_slv_ver, false); } - /* wait for the connection to master established */ + /* wait for the qsd instance started (target recovery done) */ l_wait_event(thread->t_ctl_waitq, qsd_started(qsd) || !thread_is_running(thread), &lwi); @@ -628,12 +626,17 @@ int qsd_start_reint_thread(struct qsd_qtype_info *qqi) { struct ptlrpc_thread *thread = &qqi->qqi_reint_thread; struct qsd_instance *qsd = qqi->qqi_qsd; - struct l_wait_info lwi = { 0 }; - int rc; + struct l_wait_info lwi = { 0 }; + int rc; + char *name; ENTRY; /* don't bother to do reintegration when quota isn't enabled */ - if (!qsd_type_enabled(qqi->qqi_qsd, qqi->qqi_qtype)) + if (!qsd_type_enabled(qsd, qqi->qqi_qtype)) + RETURN(0); + + if (qsd->qsd_acct_failed) + /* no space accounting support, can't enable enforcement */ RETURN(0); /* check if the reintegration has already started or finished */ @@ -658,8 +661,17 @@ int qsd_start_reint_thread(struct qsd_qtype_info *qqi) RETURN(0); } - rc = cfs_create_thread(qsd_reint_main, (void *)qqi, 0); - if (rc < 0) { + OBD_ALLOC(name, MTI_NAME_MAXLEN); + if (name == NULL) + RETURN(-ENOMEM); + + snprintf(name, MTI_NAME_MAXLEN, "qsd_reint_%d.%s", + qqi->qqi_qtype, qsd->qsd_svname); + + rc = PTR_ERR(kthread_run(qsd_reint_main, (void *)qqi, name)); + OBD_FREE(name, MTI_NAME_MAXLEN); + + if (IS_ERR_VALUE(rc)) { thread_set_flags(thread, SVC_STOPPED); write_lock(&qsd->qsd_lock); qqi->qqi_reint = 0;