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
Land b_smallfix onto HEAD (20040414_1359)
[fs/lustre-release.git]
/
lustre
/
lov
/
lov_pack.c
diff --git
a/lustre/lov/lov_pack.c
b/lustre/lov/lov_pack.c
index
ef04e68
..
164bcec
100644
(file)
--- a/
lustre/lov/lov_pack.c
+++ b/
lustre/lov/lov_pack.c
@@
-33,7
+33,7
@@
#include <linux/obd_lov.h>
#include <linux/obd_class.h>
#include <linux/obd_support.h>
#include <linux/obd_lov.h>
#include <linux/obd_class.h>
#include <linux/obd_support.h>
-#include <l
inux
/lustre_user.h>
+#include <l
ustre
/lustre_user.h>
#include "lov_internal.h"
#include "lov_internal.h"
@@
-186,7
+186,7
@@
static int lov_verify_lmm_v0(struct lov_mds_md_v0 *lmm, int lmm_bytes,
if (lmm_bytes < lov_mds_md_v0_size(*stripe_count)) {
CERROR("LOV EA too small: %d, need %d\n",
if (lmm_bytes < lov_mds_md_v0_size(*stripe_count)) {
CERROR("LOV EA too small: %d, need %d\n",
- lmm_bytes, lov_mds_md_size(*stripe_count));
+ lmm_bytes, lov_mds_md_
v0_
size(*stripe_count));
lov_dump_lmm_v0(D_WARNING, lmm);
return -EINVAL;
}
lov_dump_lmm_v0(D_WARNING, lmm);
return -EINVAL;
}
@@
-238,9
+238,9
@@
static int lov_verify_lmm_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes,
return -EINVAL;
}
return -EINVAL;
}
- if (lmm_bytes < lov_mds_md_size(*stripe_count)) {
+ if (lmm_bytes < lov_mds_md_
v1_
size(*stripe_count)) {
CERROR("LOV EA too small: %d, need %d\n",
CERROR("LOV EA too small: %d, need %d\n",
- lmm_bytes, lov_mds_md_size(*stripe_count));
+ lmm_bytes, lov_mds_md_
v1_
size(*stripe_count));
lov_dump_lmm_v1(D_WARNING, lmm);
return -EINVAL;
}
lov_dump_lmm_v1(D_WARNING, lmm);
return -EINVAL;
}
@@
-295,6
+295,7
@@
int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count, int pattern)
(*lsmp)->lsm_magic = LOV_MAGIC;
(*lsmp)->lsm_stripe_count = stripe_count;
(*lsmp)->lsm_maxbytes = LUSTRE_STRIPE_MAXBYTES * stripe_count;
(*lsmp)->lsm_magic = LOV_MAGIC;
(*lsmp)->lsm_stripe_count = stripe_count;
(*lsmp)->lsm_maxbytes = LUSTRE_STRIPE_MAXBYTES * stripe_count;
+ (*lsmp)->lsm_xfersize = PTLRPC_MAX_BRW_SIZE * stripe_count;
(*lsmp)->lsm_pattern = pattern;
(*lsmp)->lsm_oinfo[0].loi_ost_idx = ~0;
(*lsmp)->lsm_pattern = pattern;
(*lsmp)->lsm_oinfo[0].loi_ost_idx = ~0;
@@
-319,6
+320,7
@@
int lov_unpackmd_v0(struct lov_obd *lov, struct lov_stripe_md *lsm,
lsm->lsm_object_id = le64_to_cpu(lmm->lmm_object_id);
/* lsm->lsm_object_gr = 0; implicit */
lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size);
lsm->lsm_object_id = le64_to_cpu(lmm->lmm_object_id);
/* lsm->lsm_object_gr = 0; implicit */
lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size);
+ lsm->lsm_xfersize = lsm->lsm_stripe_size * lsm->lsm_stripe_count;
lsm->lsm_pattern = LOV_PATTERN_RAID0;
ost_offset = le32_to_cpu(lmm->lmm_stripe_offset);
ost_count = le16_to_cpu(lmm->lmm_ost_count);
lsm->lsm_pattern = LOV_PATTERN_RAID0;
ost_offset = le32_to_cpu(lmm->lmm_stripe_offset);
ost_count = le16_to_cpu(lmm->lmm_ost_count);
@@
-356,6
+358,7
@@
int lov_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm,
lsm->lsm_object_gr = le64_to_cpu(lmm->lmm_object_gr);
lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size);
lsm->lsm_pattern = le32_to_cpu(lmm->lmm_pattern);
lsm->lsm_object_gr = le64_to_cpu(lmm->lmm_object_gr);
lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size);
lsm->lsm_pattern = le32_to_cpu(lmm->lmm_pattern);
+ lsm->lsm_xfersize = lsm->lsm_stripe_size * lsm->lsm_stripe_count;
for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++) {
/* XXX LOV STACKING call down to osc_unpackmd() */
for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++) {
/* XXX LOV STACKING call down to osc_unpackmd() */
@@
-496,6
+499,7
@@
int lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp,
(*lsmp)->lsm_oinfo[0].loi_ost_idx = lum.lmm_stripe_offset;
(*lsmp)->lsm_stripe_size = lum.lmm_stripe_size;
(*lsmp)->lsm_oinfo[0].loi_ost_idx = lum.lmm_stripe_offset;
(*lsmp)->lsm_stripe_size = lum.lmm_stripe_size;
+ (*lsmp)->lsm_xfersize = lum.lmm_stripe_size * stripe_count;
RETURN(0);
}
RETURN(0);
}
@@
-512,25
+516,26
@@
int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp,
for (i = 0; i < lump->lmm_stripe_count; i++) {
__u32 len = sizeof(last_id);
oexp = lov->tgts[lump->lmm_objects[i].l_ost_idx].ltd_exp;
for (i = 0; i < lump->lmm_stripe_count; i++) {
__u32 len = sizeof(last_id);
oexp = lov->tgts[lump->lmm_objects[i].l_ost_idx].ltd_exp;
- rc = obd_get_info(oexp, strlen("last_id"), "last_id",
- &len, &last_id);
+ rc = obd_get_info(oexp, strlen("last_id"), "last_id",
+ &len, &last_id);
if (rc)
RETURN(rc);
if (rc)
RETURN(rc);
- if (l
ast_id < lump->lmm_objects[i].l_objec
t_id) {
+ if (l
ump->lmm_objects[i].l_object_id > las
t_id) {
CERROR("Setting EA for object > than last id on "
CERROR("Setting EA for object > than last id on "
- "ost idx %d "LPD64" > "LPD64" \n",
- lump->lmm_objects[i].l_ost_idx,
- lump->lmm_objects[i].l_object_id, last_id);
+ "ost idx %d "LPD64" > "LPD64" \n",
+
lump->lmm_objects[i].l_ost_idx,
+
lump->lmm_objects[i].l_object_id, last_id);
RETURN(-EINVAL);
}
}
rc = lov_setstripe(exp, lsmp, lump);
RETURN(-EINVAL);
}
}
rc = lov_setstripe(exp, lsmp, lump);
- if (rc)
+ if (rc)
RETURN(rc);
RETURN(rc);
+
for (i = 0; i < lump->lmm_stripe_count; i++) {
for (i = 0; i < lump->lmm_stripe_count; i++) {
- (*lsmp)->lsm_oinfo[i].loi_ost_idx =
-
lump->lmm_objects[i].l_ost_idx;
+ (*lsmp)->lsm_oinfo[i].loi_ost_idx =
+ lump->lmm_objects[i].l_ost_idx;
(*lsmp)->lsm_oinfo[i].loi_id = lump->lmm_objects[i].l_object_id;
(*lsmp)->lsm_oinfo[i].loi_gr = lump->lmm_objects[i].l_object_gr;
}
(*lsmp)->lsm_oinfo[i].loi_id = lump->lmm_objects[i].l_object_id;
(*lsmp)->lsm_oinfo[i].loi_gr = lump->lmm_objects[i].l_object_gr;
}
@@
-573,10
+578,14
@@
int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm,
LASSERT(sizeof(lum.lmm_objects[0]) == sizeof(lmmk->lmm_objects[0]));
/* User wasn't expecting this many OST entries */
LASSERT(sizeof(lum.lmm_objects[0]) == sizeof(lmmk->lmm_objects[0]));
/* User wasn't expecting this many OST entries */
- if (lum.lmm_stripe_count < lmmk->lmm_stripe_count)
+ if (lum.lmm_stripe_count == 0) {
+ if (copy_to_user(lump, lmmk, sizeof(lum)))
+ rc = -EFAULT;
+ } else if (lum.lmm_stripe_count < lmmk->lmm_stripe_count) {
rc = -EOVERFLOW;
rc = -EOVERFLOW;
- else if (copy_to_user(lump, lmmk, lmm_size))
+ } else if (copy_to_user(lump, lmmk, lmm_size)) {
rc = -EFAULT;
rc = -EFAULT;
+ }
obd_free_diskmd(exp, &lmmk);
obd_free_diskmd(exp, &lmmk);