ext4: use i_size_read in ext4_unaligned_aio()
[linux-3.10.git] / fs / jfs / jfs_logmgr.c
index c51af2a..360d27c 100644 (file)
@@ -67,6 +67,7 @@
 #include <linux/buffer_head.h>         /* for sync_blockdev() */
 #include <linux/bio.h>
 #include <linux/freezer.h>
+#include <linux/export.h>
 #include <linux/delay.h>
 #include <linux/mutex.h>
 #include <linux/seq_file.h>
@@ -1010,15 +1011,13 @@ static int lmLogSync(struct jfs_log * log, int hard_sync)
                 * option 2 - shutdown file systems
                 *            associated with log ?
                 * option 3 - extend log ?
-                */
-               /*
                 * option 4 - second chance
                 *
                 * mark log wrapped, and continue.
                 * when all active transactions are completed,
-                * mark log vaild for recovery.
+                * mark log valid for recovery.
                 * if crashed during invalid state, log state
-                * implies invald log, forcing fsck().
+                * implies invalid log, forcing fsck().
                 */
                /* mark log state log wrap in log superblock */
                /* log->state = LOGWRAP; */
@@ -1059,7 +1058,8 @@ static int lmLogSync(struct jfs_log * log, int hard_sync)
  */
 void jfs_syncpt(struct jfs_log *log, int hard_sync)
 {      LOG_LOCK(log);
-       lmLogSync(log, hard_sync);
+       if (!test_bit(log_QUIESCE, &log->flag))
+               lmLogSync(log, hard_sync);
        LOG_UNLOCK(log);
 }
 
@@ -1122,16 +1122,13 @@ int lmLogOpen(struct super_block *sb)
         * file systems to log may have n-to-1 relationship;
         */
 
-       bdev = open_by_devnum(sbi->logdev, FMODE_READ|FMODE_WRITE);
+       bdev = blkdev_get_by_dev(sbi->logdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL,
+                                log);
        if (IS_ERR(bdev)) {
-               rc = -PTR_ERR(bdev);
+               rc = PTR_ERR(bdev);
                goto free;
        }
 
-       if ((rc = bd_claim(bdev, log))) {
-               goto close;
-       }
-
        log->bdev = bdev;
        memcpy(log->uuid, sbi->loguuid, sizeof(log->uuid));
 
@@ -1139,7 +1136,7 @@ int lmLogOpen(struct super_block *sb)
         * initialize log:
         */
        if ((rc = lmLogInit(log)))
-               goto unclaim;
+               goto close;
 
        list_add(&log->journal_list, &jfs_external_logs);
 
@@ -1165,11 +1162,8 @@ journal_found:
        list_del(&log->journal_list);
        lbmLogShutdown(log);
 
-      unclaim:
-       bd_release(bdev);
-
       close:           /* close external log device */
-       blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
+       blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
 
       free:            /* free log descriptor */
        mutex_unlock(&jfs_log_mutex);
@@ -1514,8 +1508,7 @@ int lmLogClose(struct super_block *sb)
        bdev = log->bdev;
        rc = lmLogShutdown(log);
 
-       bd_release(bdev);
-       blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
+       blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
 
        kfree(log);
 
@@ -2012,12 +2005,17 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
        bio->bi_io_vec[0].bv_offset = bp->l_offset;
 
        bio->bi_vcnt = 1;
-       bio->bi_idx = 0;
        bio->bi_size = LOGPSIZE;
 
        bio->bi_end_io = lbmIODone;
        bio->bi_private = bp;
-       submit_bio(READ_SYNC, bio);
+       /*check if journaling to disk has been disabled*/
+       if (log->no_integrity) {
+               bio->bi_size = 0;
+               lbmIODone(bio, 0);
+       } else {
+               submit_bio(READ_SYNC, bio);
+       }
 
        wait_event(bp->l_ioevent, (bp->l_flag != lbmREAD));
 
@@ -2153,7 +2151,6 @@ static void lbmStartIO(struct lbuf * bp)
        bio->bi_io_vec[0].bv_offset = bp->l_offset;
 
        bio->bi_vcnt = 1;
-       bio->bi_idx = 0;
        bio->bi_size = LOGPSIZE;
 
        bio->bi_end_io = lbmIODone;
@@ -2357,7 +2354,7 @@ int jfsIOWait(void *arg)
 
                if (freezing(current)) {
                        spin_unlock_irq(&log_redrive_lock);
-                       refrigerator();
+                       try_to_freeze();
                } else {
                        set_current_state(TASK_INTERRUPTIBLE);
                        spin_unlock_irq(&log_redrive_lock);