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-4937 osc: get rid of old checksum initial value
[fs/lustre-release.git]
/
lustre
/
ofd
/
ofd_io.c
diff --git
a/lustre/ofd/ofd_io.c
b/lustre/ofd/ofd_io.c
index
6a81d87
..
cdc5940
100644
(file)
--- a/
lustre/ofd/ofd_io.c
+++ b/
lustre/ofd/ofd_io.c
@@
-216,7
+216,8
@@
int ofd_start_inconsistency_verification_thread(struct ofd_device *ofd)
{
struct ptlrpc_thread *thread = &ofd->ofd_inconsistency_thread;
struct l_wait_info lwi = { 0 };
- long rc;
+ struct task_struct *task;
+ int rc;
spin_lock(&ofd->ofd_inconsistency_lock);
if (unlikely(thread_is_running(thread))) {
@@
-227,10
+228,11
@@
int ofd_start_inconsistency_verification_thread(struct ofd_device *ofd)
thread_set_flags(thread, 0);
spin_unlock(&ofd->ofd_inconsistency_lock);
- rc = PTR_ERR(kthread_run(ofd_inconsistency_verification_main, ofd,
- "inconsistency_verification"));
- if (IS_ERR_VALUE(rc)) {
- CERROR("%s: cannot start self_repair thread: rc = %ld\n",
+ task = kthread_run(ofd_inconsistency_verification_main, ofd,
+ "inconsistency_verification");
+ if (IS_ERR(task)) {
+ rc = PTR_ERR(task);
+ CERROR("%s: cannot start self_repair thread: rc = %d\n",
ofd_obd(ofd)->obd_name, rc);
} else {
rc = 0;
@@
-436,27
+438,62
@@
static int ofd_preprw_write(const struct lu_env *env, struct obd_export *exp,
LASSERT(objcount == 1);
if (unlikely(exp->exp_obd->obd_recovering)) {
- struct ofd_thread_info *info = ofd_info(env);
-
- /* copied from ofd_precreate_object */
- /* XXX this should be consolidated to use the same code
- * instead of a copy, due to the ongoing risk of bugs. */
- memset(&info->fti_attr, 0, sizeof(info->fti_attr));
- info->fti_attr.la_valid = LA_TYPE | LA_MODE;
- info->fti_attr.la_mode = S_IFREG | S_ISUID | S_ISGID | 0666;
- info->fti_attr.la_valid |= LA_ATIME | LA_MTIME | LA_CTIME;
- /* Initialize a/c/m time so any client timestamp will always
- * be newer and update the inode. ctime = 0 is also handled
- * specially in osd_inode_setattr(). See LU-221, LU-1042 */
- info->fti_attr.la_atime = 0;
- info->fti_attr.la_mtime = 0;
- info->fti_attr.la_ctime = 0;
-
- fo = ofd_object_find_or_create(env, ofd, fid, &info->fti_attr);
- } else {
- fo = ofd_object_find(env, ofd, fid);
+ obd_seq seq = fid_seq(fid);
+ obd_id oid = fid_oid(fid);
+ struct ofd_seq *oseq;
+
+ oseq = ofd_seq_load(env, ofd, seq);
+ if (IS_ERR(oseq)) {
+ CERROR("%s: Can't find FID Sequence "LPX64": rc = %d\n",
+ ofd_name(ofd), seq, (int)PTR_ERR(oseq));
+ GOTO(out, rc = -EINVAL);
+ }
+
+ if (oid > ofd_seq_last_oid(oseq)) {
+ int sync = 0;
+ int diff;
+
+ mutex_lock(&oseq->os_create_lock);
+ diff = oid - ofd_seq_last_oid(oseq);
+
+ /* Do sync create if the seq is about to used up */
+ if (fid_seq_is_idif(seq) || fid_seq_is_mdt0(seq)) {
+ if (unlikely(oid >= IDIF_MAX_OID - 1))
+ sync = 1;
+ } else if (fid_seq_is_norm(seq)) {
+ if (unlikely(oid >=
+ LUSTRE_DATA_SEQ_MAX_WIDTH - 1))
+ sync = 1;
+ } else {
+ CERROR("%s : invalid o_seq "DOSTID"\n",
+ ofd_name(ofd), POSTID(&oa->o_oi));
+ mutex_unlock(&oseq->os_create_lock);
+ ofd_seq_put(env, oseq);
+ GOTO(out, rc = -EINVAL);
+ }
+
+ while (diff > 0) {
+ obd_id next_id = ofd_seq_last_oid(oseq) + 1;
+ int count = ofd_precreate_batch(ofd, diff);
+
+ rc = ofd_precreate_objects(env, ofd, next_id,
+ oseq, count, sync);
+ if (rc < 0) {
+ mutex_unlock(&oseq->os_create_lock);
+ ofd_seq_put(env, oseq);
+ GOTO(out, rc);
+ }
+
+ diff -= rc;
+ }
+
+ mutex_unlock(&oseq->os_create_lock);
+ }
+
+ ofd_seq_put(env, oseq);
}
+ fo = ofd_object_find(env, ofd, fid);
if (IS_ERR(fo))
GOTO(out, rc = PTR_ERR(fo));
LASSERT(fo != NULL);