]> Pileus Git - ~andy/linux/blobdiff - fs/nilfs2/segment.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
[~andy/linux] / fs / nilfs2 / segment.c
index 51ff3d0a4ee256445f8ddbe9e85d7ff2ae2a7798..6eff66a070d5e39c23a8c2af4f51f6b62ba91881 100644 (file)
@@ -2468,17 +2468,22 @@ static void nilfs_segctor_notify(struct nilfs_sc_info *sci,
        /* Clear requests (even when the construction failed) */
        spin_lock(&sci->sc_state_lock);
 
-       sci->sc_state &= ~NILFS_SEGCTOR_COMMIT;
-
        if (req->mode == SC_LSEG_SR) {
+               sci->sc_state &= ~NILFS_SEGCTOR_COMMIT;
                sci->sc_seq_done = req->seq_accepted;
                nilfs_segctor_wakeup(sci, req->sc_err ? : req->sb_err);
                sci->sc_flush_request = 0;
-       } else if (req->mode == SC_FLUSH_FILE)
-               sci->sc_flush_request &= ~FLUSH_FILE_BIT;
-       else if (req->mode == SC_FLUSH_DAT)
-               sci->sc_flush_request &= ~FLUSH_DAT_BIT;
+       } else {
+               if (req->mode == SC_FLUSH_FILE)
+                       sci->sc_flush_request &= ~FLUSH_FILE_BIT;
+               else if (req->mode == SC_FLUSH_DAT)
+                       sci->sc_flush_request &= ~FLUSH_DAT_BIT;
 
+               /* re-enable timer if checkpoint creation was not done */
+               if (sci->sc_timer && (sci->sc_state & NILFS_SEGCTOR_COMMIT) &&
+                   time_before(jiffies, sci->sc_timer->expires))
+                       add_timer(sci->sc_timer);
+       }
        spin_unlock(&sci->sc_state_lock);
 }
 
@@ -2501,7 +2506,8 @@ static int nilfs_segctor_construct(struct nilfs_sc_info *sci,
                if (test_bit(NILFS_SC_SUPER_ROOT, &sci->sc_flags) &&
                    nilfs_discontinued(nilfs)) {
                        down_write(&nilfs->ns_sem);
-                       req->sb_err = nilfs_commit_super(sbi, 0);
+                       req->sb_err = nilfs_commit_super(sbi,
+                                       nilfs_altsb_need_update(nilfs));
                        up_write(&nilfs->ns_sem);
                }
        }
@@ -2689,6 +2695,7 @@ static int nilfs_segctor_thread(void *arg)
        } else {
                DEFINE_WAIT(wait);
                int should_sleep = 1;
+               struct the_nilfs *nilfs;
 
                prepare_to_wait(&sci->sc_wait_daemon, &wait,
                                TASK_INTERRUPTIBLE);
@@ -2709,6 +2716,9 @@ static int nilfs_segctor_thread(void *arg)
                finish_wait(&sci->sc_wait_daemon, &wait);
                timeout = ((sci->sc_state & NILFS_SEGCTOR_COMMIT) &&
                           time_after_eq(jiffies, sci->sc_timer->expires));
+               nilfs = sci->sc_sbi->s_nilfs;
+               if (sci->sc_super->s_dirt && nilfs_sb_need_update(nilfs))
+                       set_nilfs_discontinued(nilfs);
        }
        goto loop;