Merge branch 'for-3.14/core' of git://git.kernel.dk/linux-block
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 30 Jan 2014 19:19:05 +0000 (11:19 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 30 Jan 2014 19:19:05 +0000 (11:19 -0800)
Pull core block IO changes from Jens Axboe:
 "The major piece in here is the immutable bio_ve series from Kent, the
  rest is fairly minor.  It was supposed to go in last round, but
  various issues pushed it to this release instead.  The pull request
  contains:

   - Various smaller blk-mq fixes from different folks.  Nothing major
     here, just minor fixes and cleanups.

   - Fix for a memory leak in the error path in the block ioctl code
     from Christian Engelmayer.

   - Header export fix from CaiZhiyong.

   - Finally the immutable biovec changes from Kent Overstreet.  This
     enables some nice future work on making arbitrarily sized bios
     possible, and splitting more efficient.  Related fixes to immutable
     bio_vecs:

        - dm-cache immutable fixup from Mike Snitzer.
        - btrfs immutable fixup from Muthu Kumar.

  - bio-integrity fix from Nic Bellinger, which is also going to stable"

* 'for-3.14/core' of git://git.kernel.dk/linux-block: (44 commits)
  xtensa: fixup simdisk driver to work with immutable bio_vecs
  block/blk-mq-cpu.c: use hotcpu_notifier()
  blk-mq: for_each_* macro correctness
  block: Fix memory leak in rw_copy_check_uvector() handling
  bio-integrity: Fix bio_integrity_verify segment start bug
  block: remove unrelated header files and export symbol
  blk-mq: uses page->list incorrectly
  blk-mq: use __smp_call_function_single directly
  btrfs: fix missing increment of bi_remaining
  Revert "block: Warn and free bio if bi_end_io is not set"
  block: Warn and free bio if bi_end_io is not set
  blk-mq: fix initializing request's start time
  block: blk-mq: don't export blk_mq_free_queue()
  block: blk-mq: make blk_sync_queue support mq
  block: blk-mq: support draining mq queue
  dm cache: increment bi_remaining when bi_end_io is restored
  block: fixup for generic bio chaining
  block: Really silence spurious compiler warnings
  block: Silence spurious compiler warnings
  block: Kill bio_pair_split()
  ...

28 files changed:
1  2 
block/blk-throttle.c
drivers/block/rbd.c
drivers/block/xen-blkfront.c
drivers/md/bcache/request.c
drivers/md/dm-bufio.c
drivers/md/dm-cache-policy-mq.c
drivers/md/dm-cache-target.c
drivers/md/dm-delay.c
drivers/md/dm-snap.c
drivers/md/dm-thin.c
drivers/md/dm.c
drivers/md/md.c
drivers/md/raid1.c
drivers/md/raid10.c
drivers/md/raid5.c
drivers/s390/block/xpram.c
drivers/scsi/sd.c
drivers/staging/lustre/lustre/llite/lloop.c
fs/btrfs/inode.c
fs/f2fs/data.c
fs/gfs2/lops.c
fs/gfs2/ops_fstype.c
fs/xfs/xfs_aops.c
fs/xfs/xfs_buf.c
include/linux/ceph/messenger.h
include/trace/events/f2fs.h
mm/page_io.c
net/ceph/messenger.c

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 726228b33a012f9994fc2f8843b25a0ca46ef966,357eb272dbd9d3337bf5d1a13db443261eb2b24b..faaf944597ab7669b90f3ecb85152fbcd16cbe33
@@@ -1258,8 -1262,8 +1264,8 @@@ static void process_bio_read_only(struc
        r = dm_thin_find_block(tc->td, block, 1, &lookup_result);
        switch (r) {
        case 0:
-               if (lookup_result.shared && (rw == WRITE) && bio->bi_size)
+               if (lookup_result.shared && (rw == WRITE) && bio->bi_iter.bi_size)
 -                      bio_io_error(bio);
 +                      handle_unserviceable_bio(tc->pool, bio);
                else {
                        inc_all_io_entry(tc->pool, bio);
                        remap_and_issue(tc, bio, lookup_result.block);
diff --cc drivers/md/dm.c
Simple merge
diff --cc drivers/md/md.c
Simple merge
Simple merge
index 8d39d63281b9b5441b3ec8e524955356c8690871,6d43d88657aa81982e1f31540878e822ffd44a39..33fc408e5eacef0a1dce55fd5c0d578fc244b663
@@@ -1319,8 -1256,8 +1256,8 @@@ read_again
                        /* Could not read all from this device, so we will
                         * need another r10_bio.
                         */
 -                      sectors_handled = (r10_bio->sectors + max_sectors
 +                      sectors_handled = (r10_bio->sector + max_sectors
-                                          - bio->bi_sector);
+                                          - bio->bi_iter.bi_sector);
                        r10_bio->sectors = max_sectors;
                        spin_lock_irq(&conf->device_lock);
                        if (bio->bi_phys_segments == 0)
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc fs/f2fs/data.c
index 0ae558723506e1a8a96f5653444dc11f5a8feb27,a2c8de8ba6ce6d45e9450de5ab8b6c60fb01adea..2261ccdd0b5f04a37be390f1b28c8703fafa86b4
  #include "segment.h"
  #include <trace/events/f2fs.h>
  
-       const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
-       struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
 +static void f2fs_read_end_io(struct bio *bio, int err)
 +{
-       do {
++      struct bio_vec *bvec;
++      int i;
 +
-               if (--bvec >= bio->bi_io_vec)
-                       prefetchw(&bvec->bv_page->flags);
-               if (unlikely(!uptodate)) {
++      bio_for_each_segment_all(bvec, bio, i) {
 +              struct page *page = bvec->bv_page;
 +
-               } else {
-                       SetPageUptodate(page);
++              if (!err) {
++                      SetPageUptodate(page);
++              } else {
 +                      ClearPageUptodate(page);
 +                      SetPageError(page);
-       } while (bvec >= bio->bi_io_vec);
 +              }
 +              unlock_page(page);
-       const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
-       struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
-       struct f2fs_sb_info *sbi = F2FS_SB(bvec->bv_page->mapping->host->i_sb);
++      }
 +      bio_put(bio);
 +}
 +
 +static void f2fs_write_end_io(struct bio *bio, int err)
 +{
-       do {
++      struct f2fs_sb_info *sbi = F2FS_SB(bio->bi_io_vec->bv_page->mapping->host->i_sb);
++      struct bio_vec *bvec;
++      int i;
 +
-               if (--bvec >= bio->bi_io_vec)
-                       prefetchw(&bvec->bv_page->flags);
-               if (unlikely(!uptodate)) {
++      bio_for_each_segment_all(bvec, bio, i) {
 +              struct page *page = bvec->bv_page;
 +
-       } while (bvec >= bio->bi_io_vec);
++              if (unlikely(err)) {
 +                      SetPageError(page);
 +                      set_bit(AS_EIO, &page->mapping->flags);
 +                      set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG);
 +                      sbi->sb->s_flags |= MS_RDONLY;
 +              }
 +              end_page_writeback(page);
 +              dec_page_count(sbi, F2FS_WRITEBACK);
-       bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
++      }
 +
 +      if (bio->bi_private)
 +              complete(bio->bi_private);
 +
 +      if (!get_pages(sbi, F2FS_WRITEBACK) &&
 +                      !list_empty(&sbi->cp_wait.task_list))
 +              wake_up(&sbi->cp_wait);
 +
 +      bio_put(bio);
 +}
 +
 +/*
 + * Low-level block read/write IO operations.
 + */
 +static struct bio *__bio_alloc(struct f2fs_sb_info *sbi, block_t blk_addr,
 +                              int npages, bool is_read)
 +{
 +      struct bio *bio;
 +
 +      /* No failure on bio allocation */
 +      bio = bio_alloc(GFP_NOIO, npages);
 +
 +      bio->bi_bdev = sbi->sb->s_bdev;
++      bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
 +      bio->bi_end_io = is_read ? f2fs_read_end_io : f2fs_write_end_io;
 +
 +      return bio;
 +}
 +
 +static void __submit_merged_bio(struct f2fs_bio_info *io)
 +{
 +      struct f2fs_io_info *fio = &io->fio;
 +      int rw;
 +
 +      if (!io->bio)
 +              return;
 +
 +      rw = fio->rw;
 +
 +      if (is_read_io(rw)) {
 +              trace_f2fs_submit_read_bio(io->sbi->sb, rw,
 +                                              fio->type, io->bio);
 +              submit_bio(rw, io->bio);
 +      } else {
 +              trace_f2fs_submit_write_bio(io->sbi->sb, rw,
 +                                              fio->type, io->bio);
 +              /*
 +               * META_FLUSH is only from the checkpoint procedure, and we
 +               * should wait this metadata bio for FS consistency.
 +               */
 +              if (fio->type == META_FLUSH) {
 +                      DECLARE_COMPLETION_ONSTACK(wait);
 +                      io->bio->bi_private = &wait;
 +                      submit_bio(rw, io->bio);
 +                      wait_for_completion(&wait);
 +              } else {
 +                      submit_bio(rw, io->bio);
 +              }
 +      }
 +
 +      io->bio = NULL;
 +}
 +
 +void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi,
 +                              enum page_type type, int rw)
 +{
 +      enum page_type btype = PAGE_TYPE_OF_BIO(type);
 +      struct f2fs_bio_info *io;
 +
 +      io = is_read_io(rw) ? &sbi->read_io : &sbi->write_io[btype];
 +
 +      mutex_lock(&io->io_mutex);
 +
 +      /* change META to META_FLUSH in the checkpoint procedure */
 +      if (type >= META_FLUSH) {
 +              io->fio.type = META_FLUSH;
 +              io->fio.rw = WRITE_FLUSH_FUA | REQ_META | REQ_PRIO;
 +      }
 +      __submit_merged_bio(io);
 +      mutex_unlock(&io->io_mutex);
 +}
 +
 +/*
 + * Fill the locked page with data located in the block address.
 + * Return unlocked page.
 + */
 +int f2fs_submit_page_bio(struct f2fs_sb_info *sbi, struct page *page,
 +                                      block_t blk_addr, int rw)
 +{
 +      struct bio *bio;
 +
 +      trace_f2fs_submit_page_bio(page, blk_addr, rw);
 +
 +      /* Allocate a new bio */
 +      bio = __bio_alloc(sbi, blk_addr, 1, is_read_io(rw));
 +
 +      if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) {
 +              bio_put(bio);
 +              f2fs_put_page(page, 1);
 +              return -EFAULT;
 +      }
 +
 +      submit_bio(rw, bio);
 +      return 0;
 +}
 +
 +void f2fs_submit_page_mbio(struct f2fs_sb_info *sbi, struct page *page,
 +                      block_t blk_addr, struct f2fs_io_info *fio)
 +{
 +      enum page_type btype = PAGE_TYPE_OF_BIO(fio->type);
 +      struct f2fs_bio_info *io;
 +      bool is_read = is_read_io(fio->rw);
 +
 +      io = is_read ? &sbi->read_io : &sbi->write_io[btype];
 +
 +      verify_block_addr(sbi, blk_addr);
 +
 +      mutex_lock(&io->io_mutex);
 +
 +      if (!is_read)
 +              inc_page_count(sbi, F2FS_WRITEBACK);
 +
 +      if (io->bio && (io->last_block_in_bio != blk_addr - 1 ||
 +                                              io->fio.rw != fio->rw))
 +              __submit_merged_bio(io);
 +alloc_new:
 +      if (io->bio == NULL) {
 +              int bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
 +
 +              io->bio = __bio_alloc(sbi, blk_addr, bio_blocks, is_read);
 +              io->fio = *fio;
 +      }
 +
 +      if (bio_add_page(io->bio, page, PAGE_CACHE_SIZE, 0) <
 +                                                      PAGE_CACHE_SIZE) {
 +              __submit_merged_bio(io);
 +              goto alloc_new;
 +      }
 +
 +      io->last_block_in_bio = blk_addr;
 +
 +      mutex_unlock(&io->io_mutex);
 +      trace_f2fs_submit_page_mbio(page, fio->rw, fio->type, blk_addr);
 +}
 +
  /*
   * Lock ordering for the change of data block address:
   * ->data_page
diff --cc fs/gfs2/lops.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 3b9f28dfc8492160940d28e58acf1dc9dc6e5081,bd3ee4fbe7a7fce24a0c8022ea59359dd79892b5..67f38faac589ad52ac5850e5af602799753b8d29
@@@ -627,16 -614,16 +627,16 @@@ DECLARE_EVENT_CLASS(f2fs__submit_bio
  
        TP_fast_assign(
                __entry->dev            = sb->s_dev;
 -              __entry->btype          = btype;
 -              __entry->sync           = sync;
 +              __entry->rw             = rw;
 +              __entry->type           = type;
-               __entry->sector         = bio->bi_sector;
-               __entry->size           = bio->bi_size;
+               __entry->sector         = bio->bi_iter.bi_sector;
+               __entry->size           = bio->bi_iter.bi_size;
        ),
  
 -      TP_printk("dev = (%d,%d), type = %s, io = %s, sector = %lld, size = %u",
 +      TP_printk("dev = (%d,%d), %s%s, %s, sector = %lld, size = %u",
                show_dev(__entry),
 -              show_block_type(__entry->btype),
 -              __entry->sync ? "sync" : "no sync",
 +              show_bio_type(__entry->rw),
 +              show_block_type(__entry->type),
                (unsigned long long)__entry->sector,
                __entry->size)
  );
diff --cc mm/page_io.c
Simple merge
Simple merge