X-Git-Url: http://drtracing.org/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fstaging%2Flustre%2Flustre%2Fosc%2Fosc_lock.c;h=5455d9de045b29896dee81df443518714c2fd960;hb=fbe0456482aa5c482342735f342483a75ada8b96;hp=16f9cd9d3b12bfbe7aba3a4e691fb2371f06c7a7;hpb=1d6da87a3241deb13d073c4125d19ed0e5a0c62c;p=deliverable%2Flinux.git diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 16f9cd9d3b12..5455d9de045b 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -638,11 +634,10 @@ static int weigh_cb(const struct lu_env *env, struct cl_io *io, if (cl_page_is_vmlocked(env, page) || PageDirty(page->cp_vmpage) || PageWriteback(page->cp_vmpage) - ) { - (*(unsigned long *)cbdata)++; + ) return CLP_GANG_ABORT; - } + *(pgoff_t *)cbdata = osc_index(ops) + 1; return CLP_GANG_OKAY; } @@ -652,7 +647,7 @@ static unsigned long osc_lock_weight(const struct lu_env *env, { struct cl_io *io = &osc_env_info(env)->oti_io; struct cl_object *obj = cl_object_top(&oscobj->oo_cl); - unsigned long npages = 0; + pgoff_t page_index; int result; io->ci_obj = obj; @@ -661,11 +656,12 @@ static unsigned long osc_lock_weight(const struct lu_env *env, if (result != 0) return result; + page_index = cl_index(obj, extent->start); do { result = osc_page_gang_lookup(env, io, oscobj, - cl_index(obj, extent->start), + page_index, cl_index(obj, extent->end), - weigh_cb, (void *)&npages); + weigh_cb, (void *)&page_index); if (result == CLP_GANG_ABORT) break; if (result == CLP_GANG_RESCHED) @@ -673,7 +669,7 @@ static unsigned long osc_lock_weight(const struct lu_env *env, } while (result != CLP_GANG_OKAY); cl_io_fini(env, io); - return npages; + return result == CLP_GANG_ABORT ? 1 : 0; } /** @@ -703,7 +699,7 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock) LASSERT(dlmlock->l_resource->lr_type == LDLM_EXTENT); obj = dlmlock->l_ast_data; - if (obj) { + if (!obj) { weight = 1; goto out; } @@ -1120,7 +1116,8 @@ static void osc_lock_set_writer(const struct lu_env *env, } } else { LASSERT(cl_io_is_mkwrite(io)); - io_start = io_end = io->u.ci_fault.ft_index; + io_start = io->u.ci_fault.ft_index; + io_end = io->u.ci_fault.ft_index; } if (descr->cld_mode >= CLM_WRITE &&