X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fosc%2Fosc_io.c;h=21080e30d9304039e87dc44024d20809b59e394f;hb=31569d70ad840e29a037655ed43e30f4260af265;hp=5fe0eb26c898b6c8f8e3e7738fde9d56c4031267;hpb=0a859380c36ac24871f221b35042f76c56b04438;p=fs%2Flustre-release.git diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index 5fe0eb2..21080e3 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -26,8 +26,11 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011 Whamcloud, Inc. + * */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -127,7 +130,7 @@ static int osc_io_submit(const struct lu_env *env, LASSERT(qin->pl_nr > 0); - CDEBUG(D_INFO, "%i %i\n", qin->pl_nr, crt); + CDEBUG(D_INFO, "%d %d\n", qin->pl_nr, crt); /* * NOTE: here @page is a top-level page. This is done to avoid * creation of sub-page-list. @@ -181,7 +184,7 @@ static int osc_io_submit(const struct lu_env *env, OSC_FLAGS); /* * bug 18881: we can't just break out here when - * error occurrs after cl_page_prep has been + * error occurs after cl_page_prep has been * called against the page. The correct * way is to call page's completion routine, * as in osc_oap_interrupted. For simplicity, @@ -221,7 +224,7 @@ static int osc_io_submit(const struct lu_env *env, if (queued > 0) osc_io_unplug(env, osc, cli); - CDEBUG(D_INFO, "%i/%i %i\n", qin->pl_nr, qout->pl_nr, result); + CDEBUG(D_INFO, "%d/%d %d\n", qin->pl_nr, qout->pl_nr, result); return qout->pl_nr > 0 ? 0 : result; } @@ -299,14 +302,24 @@ static int osc_io_prepare_write(const struct lu_env *env, { struct osc_device *dev = lu2osc_dev(slice->cpl_obj->co_lu.lo_dev); struct obd_import *imp = class_exp2cliimp(dev->od_exp); - + struct osc_io *oio = cl2osc_io(env, ios); + int result = 0; ENTRY; /* * This implements OBD_BRW_CHECK logic from old client. */ - RETURN(imp == NULL || imp->imp_invalid ? -EIO : 0); + if (imp == NULL || imp->imp_invalid) + result = -EIO; + if (result == 0 && oio->oi_lockless) + /* this page contains `invalid' data, but who cares? + * nobody can access the invalid data. + * in osc_io_commit_write(), we're going to write exact + * [from, to) bytes of this page to OST. -jay */ + cl_page_export(env, slice->cpl_page, 1); + + RETURN(result); } static int osc_io_commit_write(const struct lu_env *env, @@ -314,6 +327,7 @@ static int osc_io_commit_write(const struct lu_env *env, const struct cl_page_slice *slice, unsigned from, unsigned to) { + struct osc_io *oio = cl2osc_io(env, ios); struct osc_page *opg = cl2osc_page(slice); struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); struct osc_async_page *oap = &opg->ops_oap; @@ -331,6 +345,10 @@ static int osc_io_commit_write(const struct lu_env *env, cfs_capable(CFS_CAP_SYS_RESOURCE)) oap->oap_brw_flags |= OBD_BRW_NOQUOTA; + if (oio->oi_lockless) + /* see osc_io_prepare_write() for lockless io handling. */ + cl_page_clip(env, slice->cpl_page, from, to); + RETURN(0); } @@ -344,7 +362,7 @@ static int osc_io_fault_start(const struct lu_env *env, io = ios->cis_io; fio = &io->u.ci_fault; - CDEBUG(D_INFO, "%lu %i %i\n", + CDEBUG(D_INFO, "%lu %d %d\n", fio->ft_index, fio->ft_writable, fio->ft_nob); /* * If mapping is writeable, adjust kms to cover this page, @@ -396,7 +414,7 @@ static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, * XXX this is quite expensive check. */ cl_page_list_init(list); - cl_page_gang_lookup(env, clob, io, start + partial, CL_PAGE_EOF, list, 0); + cl_page_gang_lookup(env, clob, io, start + partial, CL_PAGE_EOF, list); cl_page_list_for_each(page, list) CL_PAGE_DEBUG(D_ERROR, env, page, "exists %lu\n", start); @@ -415,7 +433,7 @@ static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, /* * XXX Linux specific debugging stuff. */ - CL_PAGE_DEBUG(D_ERROR, env, page, "%s/%i %lu\n", + CL_PAGE_DEBUG(D_ERROR, env, page, "%s/%d %lu\n", submitter->comm, submitter->pid, start); libcfs_debug_dumpstack(submitter); }