X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Flov%2Flov_offset.c;h=cd13068b65c3da483515a928b317484317e19927;hb=624c5d51a26097bbda9483750422d090761a51d8;hp=ebfd3767aad2f7284d3a1414a19ac77221b4ac2d;hpb=2e6f5c160a4acdd509ca7b4245e96ed83b19bb57;p=fs%2Flustre-release.git diff --git a/lustre/lov/lov_offset.c b/lustre/lov/lov_offset.c index ebfd376..cd13068 100644 --- a/lustre/lov/lov_offset.c +++ b/lustre/lov/lov_offset.c @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,17 +24,16 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. */ -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif #define DEBUG_SUBSYSTEM S_LOV #ifdef __KERNEL__ @@ -66,13 +63,13 @@ obd_size lov_stripe_size(struct lov_stripe_md *lsm, obd_size ost_size, LASSERT(lsm_op_find(magic) != NULL); lsm_op_find(magic)->lsm_stripe_by_index(lsm, &stripeno, NULL, &swidth); - - /* do_div(a, b) returns a % b, and a = a / b */ - stripe_size = do_div(ost_size, ssize); - if (stripe_size) - lov_size = ost_size * swidth + stripeno * ssize + stripe_size; - else - lov_size = (ost_size - 1) * swidth + (stripeno + 1) * ssize; + + /* lov_do_div64(a, b) returns a % b, and a = a / b */ + stripe_size = lov_do_div64(ost_size, ssize); + if (stripe_size) + lov_size = ost_size * swidth + stripeno * ssize + stripe_size; + else + lov_size = (ost_size - 1) * swidth + (stripeno + 1) * ssize; RETURN(lov_size); } @@ -142,9 +139,9 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, obd_off lov_off, lsm_op_find(magic)->lsm_stripe_by_index(lsm, &stripeno, &lov_off, &swidth); - - /* ll_do_div64(a, b) returns a % b, and a = a / b */ - stripe_off = ll_do_div64(lov_off, swidth); + + /* lov_do_div64(a, b) returns a % b, and a = a / b */ + stripe_off = lov_do_div64(lov_off, swidth); this_stripe = (obd_off)stripeno * ssize; if (stripe_off < this_stripe) { @@ -196,8 +193,8 @@ obd_off lov_size_to_stripe(struct lov_stripe_md *lsm, obd_off file_size, lsm_op_find(magic)->lsm_stripe_by_index(lsm, &stripeno, &file_size, &swidth); - /* ll_do_div64(a, b) returns a % b, and a = a / b */ - stripe_off = ll_do_div64(file_size, swidth); + /* lov_do_div64(a, b) returns a % b, and a = a / b */ + stripe_off = lov_do_div64(file_size, swidth); this_stripe = (obd_off)stripeno * ssize; if (stripe_off < this_stripe) { @@ -258,17 +255,17 @@ int lov_stripe_intersects(struct lov_stripe_md *lsm, int stripeno, /* compute which stripe number "lov_off" will be written into */ int lov_stripe_number(struct lov_stripe_md *lsm, obd_off lov_off) { - unsigned long ssize = lsm->lsm_stripe_size; - obd_off stripe_off, swidth; - int magic = lsm->lsm_magic; + unsigned long ssize = lsm->lsm_stripe_size; + obd_off stripe_off, swidth; + int magic = lsm->lsm_magic; - LASSERT(lsm_op_find(magic) != NULL); - lsm_op_find(magic)->lsm_stripe_by_offset(lsm, NULL, &lov_off, &swidth); + LASSERT(lsm_op_find(magic) != NULL); + lsm_op_find(magic)->lsm_stripe_by_offset(lsm, NULL, &lov_off, &swidth); - stripe_off = ll_do_div64(lov_off, swidth); + stripe_off = lov_do_div64(lov_off, swidth); - /* Puts stripe_off/ssize result into stripe_off */ - do_div(stripe_off, ssize); + /* Puts stripe_off/ssize result into stripe_off */ + lov_do_div64(stripe_off, ssize); - return stripe_off; + return stripe_off; }