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-6142 lov: Fix style issues for lov_request.c
[fs/lustre-release.git]
/
lustre
/
lov
/
lov_request.c
diff --git
a/lustre/lov/lov_request.c
b/lustre/lov/lov_request.c
index
6da1912
..
75e5c90
100644
(file)
--- a/
lustre/lov/lov_request.c
+++ b/
lustre/lov/lov_request.c
@@
-49,6
+49,7
@@
static void lov_finish_set(struct lov_request_set *set)
{
struct list_head *pos, *n;
struct lov_request *req;
+
ENTRY;
LASSERT(set != NULL);
@@
-56,7
+57,7
@@
static void lov_finish_set(struct lov_request_set *set)
req = list_entry(pos, struct lov_request, rq_link);
list_del_init(&req->rq_link);
- if (req->rq_oi.oi_osfs
!= NULL
)
+ if (req->rq_oi.oi_osfs)
OBD_FREE_PTR(req->rq_oi.oi_osfs);
OBD_FREE_PTR(req);
@@
-78,18
+79,18
@@
static void
lov_set_add_req(struct lov_request *req, struct lov_request_set *set)
{
list_add_tail(&req->rq_link, &set->set_list);
-
set->set_count++;
-
req->rq_rqset = set;
+ set->set_count++;
+ req->rq_rqset = set;
}
static int lov_check_set(struct lov_obd *lov, int idx)
{
int rc = 0;
+
mutex_lock(&lov->lov_lock);
- if (lov->lov_tgts[idx] == NULL ||
- lov->lov_tgts[idx]->ltd_active ||
- (lov->lov_tgts[idx]->ltd_exp != NULL &&
+ if (!lov->lov_tgts[idx] || lov->lov_tgts[idx]->ltd_active ||
+ (lov->lov_tgts[idx]->ltd_exp &&
class_exp2cliimp(lov->lov_tgts[idx]->ltd_exp)->imp_connect_tried))
rc = 1;
@@
-97,7
+98,8
@@
static int lov_check_set(struct lov_obd *lov, int idx)
return rc;
}
-/* Check if the OSC connection exists and is active.
+/*
+ * Check if the OSC connection exists and is active.
* If the OSC has not yet had a chance to connect to the OST the first time,
* wait once for it to connect instead of returning an error.
*/
@@
-113,7
+115,7
@@
static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx)
tgt = lov->lov_tgts[ost_idx];
- if (unlikely(
tgt == NULL
))
+ if (unlikely(
!tgt
))
GOTO(out, rc = 0);
if (likely(tgt->ltd_active))
@@
-145,20
+147,20
@@
out:
#define LOV_U64_MAX ((__u64)~0ULL)
#define LOV_SUM_MAX(tot, add) \
-
do { \
-
if ((tot) + (add) < (tot)) \
-
(tot) = LOV_U64_MAX; \
-
else \
-
(tot) += (add); \
-
} while
(0)
+ do { \
+ if ((tot) + (add) < (tot)) \
+ (tot) = LOV_U64_MAX; \
+ else \
+ (tot) += (add); \
+
} while
(0)
static int
lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs, int success)
{
-
ENTRY;
+ ENTRY;
-
if (success) {
-
__u32 expected_stripes = lov_get_stripe_count(&obd->u.lov,
+ if (success) {
+ __u32 expected_stripes = lov_get_stripe_count(&obd->u.lov,
LOV_MAGIC, 0);
if (osfs->os_files != LOV_U64_MAX)
lov_do_div64(osfs->os_files, expected_stripes);
@@
-180,7
+182,7
@@
int lov_fini_statfs_set(struct lov_request_set *set)
int rc = 0;
ENTRY;
- if (
set == NULL
)
+ if (
!set
)
RETURN(0);
if (atomic_read(&set->set_completes)) {
@@
-197,84
+199,91
@@
static void
lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs,
int success)
{
- int shift = 0, quit = 0;
- __u64 tmp;
-
- if (success == 0) {
- memcpy(osfs, lov_sfs, sizeof(*lov_sfs));
- } else {
- if (osfs->os_bsize != lov_sfs->os_bsize) {
- /* assume all block sizes are always powers of 2 */
- /* get the bits difference */
- tmp = osfs->os_bsize | lov_sfs->os_bsize;
- for (shift = 0; shift <= 64; ++shift) {
- if (tmp & 1) {
- if (quit)
- break;
- else
- quit = 1;
- shift = 0;
- }
- tmp >>= 1;
- }
- }
-
- if (osfs->os_bsize < lov_sfs->os_bsize) {
- osfs->os_bsize = lov_sfs->os_bsize;
-
- osfs->os_bfree >>= shift;
- osfs->os_bavail >>= shift;
- osfs->os_blocks >>= shift;
- } else if (shift != 0) {
- lov_sfs->os_bfree >>= shift;
- lov_sfs->os_bavail >>= shift;
- lov_sfs->os_blocks >>= shift;
- }
+ int shift = 0, quit = 0;
+ __u64 tmp;
+
+ if (success == 0) {
+ memcpy(osfs, lov_sfs, sizeof(*lov_sfs));
+ } else {
+ if (osfs->os_bsize != lov_sfs->os_bsize) {
+ /* assume all block sizes are always powers of 2 */
+ /* get the bits difference */
+ tmp = osfs->os_bsize | lov_sfs->os_bsize;
+ for (shift = 0; shift <= 64; ++shift) {
+ if (tmp & 1) {
+ if (quit)
+ break;
+ quit = 1;
+ shift = 0;
+ }
+ tmp >>= 1;
+ }
+ }
+
+ if (osfs->os_bsize < lov_sfs->os_bsize) {
+ osfs->os_bsize = lov_sfs->os_bsize;
+
+ osfs->os_bfree >>= shift;
+ osfs->os_bavail >>= shift;
+ osfs->os_blocks >>= shift;
+ } else if (shift != 0) {
+ lov_sfs->os_bfree >>= shift;
+ lov_sfs->os_bavail >>= shift;
+ lov_sfs->os_blocks >>= shift;
+ }
#ifdef MIN_DF
- /* Sandia requested that df (and so, statfs) only
- returned minimal available space on
- a single OST, so people would be able to
- write this much data guaranteed. */
- if (osfs->os_bavail > lov_sfs->os_bavail) {
- /* Presumably if new bavail is smaller,
- new bfree is bigger as well */
- osfs->os_bfree = lov_sfs->os_bfree;
- osfs->os_bavail = lov_sfs->os_bavail;
- }
+ /*
+ * Sandia requested that df (and so, statfs) only
+ * returned minimal available space on
+ * a single OST, so people would be able to
+ * write this much data guaranteed.
+ */
+ if (osfs->os_bavail > lov_sfs->os_bavail) {
+ /*
+ * Presumably if new bavail is smaller,
+ * new bfree is bigger as well
+ */
+ osfs->os_bfree = lov_sfs->os_bfree;
+ osfs->os_bavail = lov_sfs->os_bavail;
+ }
#else
-
osfs->os_bfree += lov_sfs->os_bfree;
-
osfs->os_bavail += lov_sfs->os_bavail;
+ osfs->os_bfree += lov_sfs->os_bfree;
+ osfs->os_bavail += lov_sfs->os_bavail;
#endif
- osfs->os_blocks += lov_sfs->os_blocks;
- /* XXX not sure about this one - depends on policy.
- * - could be minimum if we always stripe on all OBDs
- * (but that would be wrong for any other policy,
- * if one of the OBDs has no more objects left)
- * - could be sum if we stripe whole objects
- * - could be average, just to give a nice number
- *
- * To give a "reasonable" (if not wholly accurate)
- * number, we divide the total number of free objects
- * by expected stripe count (watch out for overflow).
- */
- LOV_SUM_MAX(osfs->os_files, lov_sfs->os_files);
- LOV_SUM_MAX(osfs->os_ffree, lov_sfs->os_ffree);
- }
+ osfs->os_blocks += lov_sfs->os_blocks;
+ /*
+ * XXX not sure about this one - depends on policy.
+ * - could be minimum if we always stripe on all OBDs
+ * (but that would be wrong for any other policy,
+ * if one of the OBDs has no more objects left)
+ * - could be sum if we stripe whole objects
+ * - could be average, just to give a nice number
+ *
+ * To give a "reasonable" (if not wholly accurate)
+ * number, we divide the total number of free objects
+ * by expected stripe count (watch out for overflow).
+ */
+ LOV_SUM_MAX(osfs->os_files, lov_sfs->os_files);
+ LOV_SUM_MAX(osfs->os_ffree, lov_sfs->os_ffree);
+ }
}
-/* The callback for osc_statfs_async that finilizes a request info when a
- * response is received. */
+/*
+ * The callback for osc_statfs_async that finilizes a request info when a
+ * response is received.
+ */
static int cb_statfs_update(void *cookie, int rc)
{
- struct obd_info *oinfo = cookie;
- struct lov_request *lovreq;
- struct lov_request_set *set;
- struct obd_statfs *osfs, *lov_sfs;
- struct lov_obd *lov;
- struct lov_tgt_desc *tgt;
- struct obd_device *lovobd, *tgtobd;
- int success;
- ENTRY;
+ struct obd_info *oinfo = cookie;
+ struct lov_request *lovreq;
+ struct lov_request_set *set;
+ struct obd_statfs *osfs, *lov_sfs;
+ struct lov_obd *lov;
+ struct lov_tgt_desc *tgt;
+ struct obd_device *lovobd, *tgtobd;
+ int success;
+
+ ENTRY;
lovreq = container_of(oinfo, struct lov_request, rq_oi);
set = lovreq->rq_rqset;
@@
-283,18
+292,20
@@
static int cb_statfs_update(void *cookie, int rc)
osfs = set->set_oi->oi_osfs;
lov_sfs = oinfo->oi_osfs;
success = atomic_read(&set->set_success);
- /* XXX: the same is done in lov_update_common_set, however
- lovset->set_exp is not initialized. */
+ /*
+ * XXX: the same is done in lov_update_common_set, however
+ * lovset->set_exp is not initialized.
+ */
lov_update_set(set, lovreq, rc);
if (rc)
GOTO(out, rc);
lov_tgts_getref(lovobd);
-
tgt = lov->lov_tgts[lovreq->rq_idx];
-
if (!tgt || !tgt->ltd_active)
-
GOTO(out_update, rc);
+ tgt = lov->lov_tgts[lovreq->rq_idx];
+ if (!tgt || !tgt->ltd_active)
+ GOTO(out_update, rc);
-
tgtobd = class_exp2obd(tgt->ltd_exp);
+ tgtobd = class_exp2obd(tgt->ltd_exp);
spin_lock(&tgtobd->obd_osfs_lock);
memcpy(&tgtobd->obd_osfs, lov_sfs, sizeof(*lov_sfs));
if ((oinfo->oi_flags & OBD_STATFS_FROM_CACHE) == 0)
@@
-302,40
+313,43
@@
static int cb_statfs_update(void *cookie, int rc)
spin_unlock(&tgtobd->obd_osfs_lock);
out_update:
-
lov_update_statfs(osfs, lov_sfs, success);
+ lov_update_statfs(osfs, lov_sfs, success);
lov_tgts_putref(lovobd);
out:
RETURN(0);
}
int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
-
struct lov_request_set **reqset)
+ struct lov_request_set **reqset)
{
- struct lov_request_set *set;
- struct lov_obd *lov = &obd->u.lov;
- int rc = 0, i;
- ENTRY;
+ struct lov_request_set *set;
+ struct lov_obd *lov = &obd->u.lov;
+ int rc = 0, i;
+
+ ENTRY;
-
OBD_ALLOC(set, sizeof(*set));
-
if (set == NULL
)
-
RETURN(-ENOMEM);
-
lov_init_set(set);
+ OBD_ALLOC(set, sizeof(*set));
+
if (!set
)
+ RETURN(-ENOMEM);
+ lov_init_set(set);
-
set->set_obd = obd;
-
set->set_oi = oinfo;
+ set->set_obd = obd;
+ set->set_oi = oinfo;
-
/* We only get block data from the OBD */
-
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
+ /* We only get block data from the OBD */
+ for (i = 0; i < lov->desc.ld_tgt_count; i++) {
struct lov_tgt_desc *ltd = lov->lov_tgts[i];
struct lov_request *req;
- if (
ltd == NULL
) {
+ if (
!ltd
) {
CDEBUG(D_HA, "lov idx %d inactive\n", i);
continue;
}
- /* skip targets that have been explicitely disabled by the
- * administrator */
+ /*
+ * skip targets that have been explicitely disabled by the
+ * administrator
+ */
if (!ltd->ltd_exp) {
CDEBUG(D_HA, "lov idx %d administratively disabled\n",
i);
@@
-353,11
+367,11
@@
int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
lov_check_and_wait_active(lov, i);
OBD_ALLOC(req, sizeof(*req));
- if (
req == NULL
)
+ if (
!req
)
GOTO(out_set, rc = -ENOMEM);
OBD_ALLOC(req->rq_oi.oi_osfs, sizeof(*req->rq_oi.oi_osfs));
- if (
req->rq_oi.oi_osfs == NULL
) {
+ if (
!req->rq_oi.oi_osfs
) {
OBD_FREE(req, sizeof(*req));
GOTO(out_set, rc = -ENOMEM);
}