Skip to contentSkip to conversation

Core block IO changes for 3.14

GIT PULL Jens Axboe 5 participants 9 messages Jan 28, 2014 – Jan 30, 2014

Subsystems (6)
lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

Hi Linus,

This is the pull request for the core block IO changes for 3.14. 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.

Please pull! There will be a bit of merge work for you, but it should be fairly straight forward. It's mostly related to changin:

bio->bi_sector -> bio->bi_iter.bi_sector
bio->bi_size -> bio->bi_iter.bi_size

git://git.kernel.dk/linux-block.git for-3.14/core

----------------------------------------------------------------
Andrew Morton (1):
block/blk-mq-cpu.c: use hotcpu_notifier()

CaiZhiyong (1):
block: remove unrelated header files and export symbol

Christian Engelmayer (1):
block: Fix memory leak in rw_copy_check_uvector() handling

Christoph Hellwig (1):
blk-mq: use __smp_call_function_single directly

Dave Hansen (1):

      blk-mq: uses page->list incorrectly

Jens Axboe (2):
Merge tag 'v3.13-rc6' into for-3.14/core
Revert "block: Warn and free bio if bi_end_io is not set"

Jose Alonso (1):
blk-mq: for_each_* macro correctness

Kent Overstreet (28):
block: submit_bio_wait() conversions
block: Convert various code to bio_for_each_segment()
bcache: Kill unaligned bvec hack
block: Abstract out bvec iterator
dm: Use bvec_iter for dm_bio_record()
block: Convert bio_iovec() to bvec_iter
block: Convert bio_for_each_segment() to bvec_iter
block: Immutable bio vecs
block: Convert bio_copy_data() to bvec_iter
bio-integrity: Convert to bvec_iter
block: Kill bio_segments()/bi_vcnt usage
block: Convert drivers to immutable biovecs
aoe: Convert to immutable biovecs
ceph: Convert to immutable biovecs
block: Kill bio_iovec_idx(), __bio_iovec()
block: Refactor bio_clone_bioset() for immutable biovecs
block: Add bio_clone_fast()
rbd: Refactor bio cloning
dm: Refactor for new bio cloning/splitting
block: Don't save/copy bvec array anymore
block: Remove bi_idx hacks
block: Generic bio chaining
block: Rename bio_split() -> bio_pair_split()
block: Introduce new bio_split()
block: Kill bio_pair_split()
block: Silence spurious compiler warnings
block: Really silence spurious compiler warnings
block: fixup for generic bio chaining

Mike Snitzer (1):
dm cache: increment bi_remaining when bi_end_io is restored

Ming Lei (4):
block: blk-mq: support draining mq queue
block: blk-mq: make blk_sync_queue support mq
block: blk-mq: don't export blk_mq_free_queue()
blk-mq: fix initializing request's start time

Muthu Kumar (1):
btrfs: fix missing increment of bi_remaining

Muthukumar Ratty (1):
block: Warn and free bio if bi_end_io is not set

Nicholas Bellinger (1):
bio-integrity: Fix bio_integrity_verify segment start bug

 Documentation/block/biodoc.txt              |   7 +-
 Documentation/block/biovecs.txt             | 111 ++++++
 arch/m68k/emu/nfblock.c                     |  13 +-
 arch/powerpc/sysdev/axonram.c               |  21 +-
 block/blk-core.c                            |  61 ++--
 block/blk-exec.c                            |   4 +
 block/blk-flush.c                           |   2 +-
 block/blk-integrity.c                       |  40 ++-
 block/blk-lib.c                             |  12 +-
 block/blk-map.c                             |   6 +-
 block/blk-merge.c                           |  66 ++--
 block/blk-mq-cpu.c                          |  37 +-
 block/blk-mq.c                              | 123 +++----
 block/blk-mq.h                              |   3 +-
 block/blk-sysfs.c                           |   1 +
 block/blk-throttle.c                        |  14 +-
 block/cmdline-parser.c                      |  18 +-
 block/elevator.c                            |   2 +-
 block/scsi_ioctl.c                          |   6 +-
 drivers/block/aoe/aoe.h                     |  10 +-
 drivers/block/aoe/aoecmd.c                  | 153 ++++-----
 drivers/block/brd.c                         |  16 +-
 drivers/block/drbd/drbd_actlog.c            |   2 +-
 drivers/block/drbd/drbd_bitmap.c            |   2 +-
 drivers/block/drbd/drbd_main.c              |  27 +-
 drivers/block/drbd/drbd_receiver.c          |  19 +-
 drivers/block/drbd/drbd_req.c               |   6 +-
 drivers/block/drbd/drbd_req.h               |   2 +-
 drivers/block/drbd/drbd_worker.c            |   8 +-
 drivers/block/floppy.c                      |  16 +-
 drivers/block/loop.c                        |  27 +-
 drivers/block/mtip32xx/mtip32xx.c           |  20 +-
 drivers/block/nbd.c                         |  14 +-
 drivers/block/nvme-core.c                   | 142 ++------
 drivers/block/pktcdvd.c                     | 182 +++++-----
 drivers/block/ps3disk.c                     |  17 +-
 drivers/block/ps3vram.c                     |  12 +-
 drivers/block/rbd.c                         |  91 +----
 drivers/block/rsxx/dev.c                    |   6 +-
 drivers/block/rsxx/dma.c                    |  15 +-
 drivers/block/umem.c                        |  53 ++-
 drivers/block/xen-blkback/blkback.c         |   2 +-
 drivers/block/xen-blkfront.c                |   2 +-
 drivers/md/bcache/bcache.h                  |   2 -
 drivers/md/bcache/btree.c                   |   8 +-
 drivers/md/bcache/debug.c                   |  21 +-
 drivers/md/bcache/io.c                      | 196 ++---------
 drivers/md/bcache/journal.c                 |  12 +-
 drivers/md/bcache/movinggc.c                |   4 +-
 drivers/md/bcache/request.c                 | 131 +++-----
 drivers/md/bcache/super.c                   |  20 +-
 drivers/md/bcache/util.c                    |   4 +-
 drivers/md/bcache/writeback.c               |   6 +-
 drivers/md/bcache/writeback.h               |   2 +-
 drivers/md/dm-bio-record.h                  |  37 +-
 drivers/md/dm-bufio.c                       |   2 +-
 drivers/md/dm-cache-policy-mq.c             |   4 +-
 drivers/md/dm-cache-target.c                |  28 +-
 drivers/md/dm-crypt.c                       |  64 ++--
 drivers/md/dm-delay.c                       |   7 +-
 drivers/md/dm-flakey.c                      |   7 +-
 drivers/md/dm-io.c                          |  37 +-
 drivers/md/dm-linear.c                      |   3 +-
 drivers/md/dm-raid1.c                       |  20 +-
 drivers/md/dm-region-hash.c                 |   3 +-
 drivers/md/dm-snap.c                        |  19 +-
 drivers/md/dm-stripe.c                      |  13 +-
 drivers/md/dm-switch.c                      |   4 +-
 drivers/md/dm-thin.c                        |  30 +-
 drivers/md/dm-verity.c                      |  62 ++--
 drivers/md/dm.c                             | 189 ++---------
 drivers/md/faulty.c                         |  19 +-
 drivers/md/linear.c                         |  96 +++---
 drivers/md/md.c                             |  12 +-
 drivers/md/multipath.c                      |  13 +-
 drivers/md/raid0.c                          |  79 ++---
 drivers/md/raid1.c                          |  75 +++--
 drivers/md/raid10.c                         | 194 +++++------
 drivers/md/raid5.c                          |  84 ++---
 drivers/message/fusion/mptsas.c             |   8 +-
 drivers/s390/block/dasd_diag.c              |  10 +-
 drivers/s390/block/dasd_eckd.c              |  48 +--
 drivers/s390/block/dasd_fba.c               |  26 +-
 drivers/s390/block/dcssblk.c                |  21 +-
 drivers/s390/block/scm_blk.c                |   8 +-
 drivers/s390/block/scm_blk_cluster.c        |   4 +-
 drivers/s390/block/xpram.c                  |  19 +-
 drivers/scsi/libsas/sas_expander.c          |   8 +-
 drivers/scsi/mpt2sas/mpt2sas_transport.c    |  41 +--
 drivers/scsi/mpt3sas/mpt3sas_transport.c    |  39 +--
 drivers/scsi/osd/osd_initiator.c            |   2 +-
 drivers/scsi/sd.c                           |   2 +-
 drivers/scsi/sd_dif.c                       |  30 +-
 drivers/staging/lustre/lustre/llite/lloop.c |  26 +-
 drivers/staging/zram/zram_drv.c             |  33 +-
 drivers/target/target_core_iblock.c         |   2 +-
 fs/bio-integrity.c                          | 170 ++--------
 fs/bio.c                                    | 502 +++++++++++++---------------
 fs/btrfs/check-integrity.c                  |   8 +-
 fs/btrfs/compression.c                      |  27 +-
 fs/btrfs/disk-io.c                          |  13 +-
 fs/btrfs/extent_io.c                        |  49 ++-
 fs/btrfs/file-item.c                        |  19 +-
 fs/btrfs/inode.c                            |  37 +-
 fs/btrfs/raid56.c                           |  22 +-
 fs/btrfs/scrub.c                            |  12 +-
 fs/btrfs/volumes.c                          |  19 +-
 fs/buffer.c                                 |  12 +-
 fs/direct-io.c                              |   4 +-
 fs/ext4/page-io.c                           |   8 +-
 fs/f2fs/data.c                              |  15 +-
 fs/f2fs/segment.c                           |  14 +-
 fs/gfs2/lops.c                              |   2 +-
 fs/gfs2/ops_fstype.c                        |   2 +-
 fs/hfsplus/wrapper.c                        |   2 +-
 fs/jfs/jfs_logmgr.c                         |  12 +-
 fs/jfs/jfs_metapage.c                       |   9 +-
 fs/logfs/dev_bdev.c                         |  38 +--
 fs/mpage.c                                  |  19 +-
 fs/nfs/blocklayout/blocklayout.c            |  43 +--
 fs/nilfs2/segbuf.c                          |   3 +-
 fs/ocfs2/cluster/heartbeat.c                |   2 +-
 fs/xfs/xfs_aops.c                           |   2 +-
 fs/xfs/xfs_buf.c                            |   4 +-
 include/linux/bio.h                         | 283 ++++++++++------
 include/linux/blk-mq.h                      |  13 +-
 include/linux/blk_types.h                   |  24 +-
 include/linux/blkdev.h                      |   9 +-
 include/linux/ceph/messenger.h              |   4 +-
 include/linux/cmdline-parser.h              |   8 +-
 include/linux/dm-io.h                       |   4 +-
 include/trace/events/bcache.h               |  26 +-
 include/trace/events/block.h                |  26 +-
 include/trace/events/f2fs.h                 |   4 +-
 kernel/power/block_io.c                     |   2 +-
 kernel/trace/blktrace.c                     |  15 +-
 mm/bounce.c                                 |  44 ++-
 mm/page_io.c                                |  10 +-
 net/ceph/messenger.c                        |  43 +--
 139 files changed, 2136 insertions(+), 2673 deletions(-)
 create mode 100644 Documentation/block/biovecs.txt
Signature · 1 line
Jens Axboe
author
#1 lore raw
Quoted 27 lines · Jens Axboe

Hi Linus,

This is the pull request for the core block IO changes for 3.14. 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.

Quoted 8 lines

Please pull! There will be a bit of merge work for you, but it should be fairly straight forward. It's mostly related to changin:

bio->bi_sector -> bio->bi_iter.bi_sector
bio->bi_size -> bio->bi_iter.bi_size

git://git.kernel.dk/linux-block.git for-3.14/core

BTW, let me know if you want me to merge this. The above has been in for-next since forever, and Stephen has carried a fix or two for new merges.

Signature · 1 line
Jens Axboe
#2 lore raw

Hi all,

Quoted 35 lines · On Tue, 28 Jan 2014 15:52:29 -0700 Jens Axboe <[email protected]> wrote:
Quoted 33 lines · Jens Axboe

This is the pull request for the core block IO changes for 3.14. 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.

Please pull! There will be a bit of merge work for you, but it should be fairly straight forward. It's mostly related to changin:

bio->bi_sector -> bio->bi_iter.bi_sector
bio->bi_size -> bio->bi_iter.bi_size

Quoted 5 lines
Quoted 1 line

git://git.kernel.dk/linux-block.git for-3.14/core

BTW, let me know if you want me to merge this. The above has been in for-next since forever, and Stephen has carried a fix or two for new merges.

The worst bit is the conflicts with the f2fs changes that have already been merged. My current merge commit looks like this (though I don't remember getting any comments on my fixes):

da3f6c793c656a022453df8bf458d13e5a353beb

drivers/md/dm-thin.c +0 -0
diff --cc drivers/md/dm-thin.c
index 726228b33a01,357eb272dbd9..faaf944597ab
@@@ -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);
drivers/md/raid10.c +0 -0
diff --cc drivers/md/raid10.c
index 8d39d63281b9,6d43d88657aa..33fc408e5eac
@@@ -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)
fs/btrfs/extent_io.c +0 -0
diff --cc fs/btrfs/extent_io.c
index fbe501d3bd01,bcb6f1b780d6..85bbd01f1271
@@@ -2375,12 -2332,15 +2375,13 @@@ int end_extent_writepage(struct page *p
   */
  static void end_bio_extent_writepage(struct bio *bio, int err)
  {
- 	struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
+ 	struct bio_vec *bvec;
 -	struct extent_io_tree *tree;
  	u64 start;
  	u64 end;
+ 	int i;
  
- 	do {
+ 	bio_for_each_segment_all(bvec, bio, i) {
  		struct page *page = bvec->bv_page;
 -		tree = &BTRFS_I(page->mapping->host)->io_tree;
  
  		/* We always issue full-page reads, but if some block
  		 * in a page fails to read, blk_update_request() will
fs/btrfs/inode.c +0 -0
diff --cc fs/btrfs/inode.c
index 1ef056837755,7ab0e94ad492..f0422a5efa78
@@@ -7016,10 -6891,11 +7013,11 @@@ static void btrfs_end_dio_bio(struct bi
  	struct btrfs_dio_private *dip = bio->bi_private;
  
  	if (err) {
 -		printk(KERN_ERR "btrfs direct IO failed ino %llu rw %lu "
 -		      "sector %#Lx len %u err no %d\n",
 +		btrfs_err(BTRFS_I(dip->inode)->root->fs_info,
 +			  "direct IO failed ino %llu rw %lu sector %#Lx len %u err no %d",
  		      btrfs_ino(dip->inode), bio->bi_rw,
- 		      (unsigned long long)bio->bi_sector, bio->bi_size, err);
+ 		      (unsigned long long)bio->bi_iter.bi_sector,
+ 		      bio->bi_iter.bi_size, err);
  		dip->errors = 1;
  
  		/*
fs/f2fs/data.c +0 -0
diff --cc fs/f2fs/data.c
index 0ae558723506,a2c8de8ba6ce..25d675e6a138
@@@ -24,195 -24,6 +24,192 @@@
  #include "segment.h"
  #include <trace/events/f2fs.h>
  
 +static void f2fs_read_end_io(struct bio *bio, int err)
 +{
- 	const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
- 	struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
++	struct bio_vec *bvec;
++	int i;
 +
- 	do {
++	bio_for_each_segment_all(bvec, bio, i) {
 +		struct page *page = bvec->bv_page;
 +
- 		if (--bvec >= bio->bi_io_vec)
- 			prefetchw(&bvec->bv_page->flags);
- 
- 		if (unlikely(!uptodate)) {
++		if (unlikely(err)) {
 +			ClearPageUptodate(page);
 +			SetPageError(page);
 +		} else {
 +			SetPageUptodate(page);
 +		}
 +		unlock_page(page);
- 	} while (bvec >= bio->bi_io_vec);
++	}
 +
 +	bio_put(bio);
 +}
 +
 +static void f2fs_write_end_io(struct bio *bio, int err)
 +{
- 	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);
++	struct bio_vec *bvec;
++	struct f2fs_sb_info *sbi = NULL;
++	int i;
 +
- 	do {
++	bio_for_each_segment_all(bvec, bio, i) {
 +		struct page *page = bvec->bv_page;
 +
- 		if (--bvec >= bio->bi_io_vec)
- 			prefetchw(&bvec->bv_page->flags);
++		if (!sbi)
++			sbi = F2FS_SB(bvec->bv_page->mapping->host->i_sb);
 +
- 		if (unlikely(!uptodate)) {
++		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);
- 	} while (bvec >= bio->bi_io_vec);
++	}
 +
 +	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_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
++	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
include/trace/events/f2fs.h +0 -0
diff --cc include/trace/events/f2fs.h
index 3b9f28dfc849,bd3ee4fbe7a7..67f38faac589
@@@ -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)
  );
Signature · 2 lines
Cheers,
Stephen Rothwell <[email protected]>
#3 lore raw

Hi Jens and Stephen,

In the case of f2fs, could you please check the following code changes? It is based on the following commit from Linus tree.

commit d891ea23d5203e5c47439b2a174f86a00b356a6c
Merge: 08d21b5 125d725
Author: Linus Torvalds <[email protected]>
Date: Tue Jan 28 11:02:23 2014 -0800

Merge branch 'for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client

---
 fs/f2fs/data.c              | 31 ++++++++++++++-----------------
 include/trace/events/f2fs.h |  4 ++--
 2 files changed, 16 insertions(+), 19 deletions(-)
fs/f2fs/data.c +5 -11
index 0ae5587..55ae30a 100644
@@ -26,40 +26,37 @@
 
 static void f2fs_read_end_io(struct bio *bio, int err)
 {
-	const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
-	struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
+	struct bio_vec *bvec;
+	int i;
 
-	do {
+	bio_for_each_segment_all(bvec, bio, i) {
 		struct page *page = bvec->bv_page;
 
-		if (--bvec >= bio->bi_io_vec)
-			prefetchw(&bvec->bv_page->flags);
-
-		if (unlikely(!uptodate)) {
+		if (unlikely(err)) {
 			ClearPageUptodate(page);
 			SetPageError(page);
 		} else {
 			SetPageUptodate(page);
 		}
 		unlock_page(page);
-	} while (bvec >= bio->bi_io_vec);
+	}
 
 	bio_put(bio);
 }
 
 static void f2fs_write_end_io(struct bio *bio, int err)
 {
-	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);
+ struct f2fs_sb_info *sbi = NULL;
+ struct bio_vec *bvec;
+ int i;

- do {
+ bio_for_each_segment_all(bvec, bio, i) {
struct page *page = bvec->bv_page;

- if (--bvec >= bio->bi_io_vec)
- prefetchw(&bvec->bv_page->flags);
+ if (!sbi)
+ sbi = F2FS_SB(bvec->bv_page->mapping->host->i_sb);

- if (unlikely(!uptodate)) {
+ if (unlikely(err)) {
SetPageError(page); set_bit(AS_EIO, &page->mapping->flags); set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG);
@@ -67,7 +64,7 @@ static void f2fs_write_end_io(struct bio *bio, int err)
}
end_page_writeback(page); dec_page_count(sbi, F2FS_WRITEBACK);
- } while (bvec >= bio->bi_io_vec);
+ }

if (bio->bi_private)
complete(bio->bi_private);
@@ -91,7 +88,7 @@ static struct bio *__bio_alloc(struct f2fs_sb_info *sbi, block_t blk_addr,
bio = bio_alloc(GFP_NOIO, npages);

bio->bi_bdev = sbi->sb->s_bdev;
- bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
+ 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;

include/trace/events/f2fs.h +2 -2
index 3b9f28d..67f38fa 100644
@@ -629,8 +629,8 @@ DECLARE_EVENT_CLASS(f2fs__submit_bio,
 		__entry->dev		= sb->s_dev;
 		__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), %s%s, %s, sector = %lld, size = %u",
Signature · 5 lines
1.8.4.474.g128a96c

Thanks,

2014-01-29 (수), 11:05 +1100, Stephen Rothwell:
Quoted 363 lines

Hi all,

Quoted 35 lines · On Tue, 28 Jan 2014 15:52:29 -0700 Jens Axboe <[email protected]> wrote:
Quoted 33 lines · Jens Axboe

This is the pull request for the core block IO changes for 3.14. 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.

Please pull! There will be a bit of merge work for you, but it should be fairly straight forward. It's mostly related to changin:

bio->bi_sector -> bio->bi_iter.bi_sector
bio->bi_size -> bio->bi_iter.bi_size

Quoted 5 lines
Quoted 1 line

git://git.kernel.dk/linux-block.git for-3.14/core

BTW, let me know if you want me to merge this. The above has been in for-next since forever, and Stephen has carried a fix or two for new merges.

The worst bit is the conflicts with the f2fs changes that have already been merged. My current merge commit looks like this (though I don't remember getting any comments on my fixes):

da3f6c793c656a022453df8bf458d13e5a353beb

drivers/md/dm-thin.c +1 -1
diff --cc drivers/md/dm-thin.c
index 726228b33a01,357eb272dbd9..faaf944597ab
@@@ -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);
drivers/md/raid10.c +1 -1
diff --cc drivers/md/raid10.c
index 8d39d63281b9,6d43d88657aa..33fc408e5eac
@@@ -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)
fs/btrfs/extent_io.c +3 -2
diff --cc fs/btrfs/extent_io.c
index fbe501d3bd01,bcb6f1b780d6..85bbd01f1271
@@@ -2375,12 -2332,15 +2375,13 @@@ int end_extent_writepage(struct page *p
   */
  static void end_bio_extent_writepage(struct bio *bio, int err)
  {
- 	struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
+ 	struct bio_vec *bvec;
 -	struct extent_io_tree *tree;
  	u64 start;
  	u64 end;
+ 	int i;
 
- 	do {
+ 	bio_for_each_segment_all(bvec, bio, i) {
  		struct page *page = bvec->bv_page;
 -		tree = &BTRFS_I(page->mapping->host)->io_tree;
 
  		/* We always issue full-page reads, but if some block
  		 * in a page fails to read, blk_update_request() will
fs/btrfs/inode.c +2 -1
diff --cc fs/btrfs/inode.c
index 1ef056837755,7ab0e94ad492..f0422a5efa78
@@@ -7016,10 -6891,11 +7013,11 @@@ static void btrfs_end_dio_bio(struct bi
  	struct btrfs_dio_private *dip = bio->bi_private;
 
  	if (err) {
 -		printk(KERN_ERR "btrfs direct IO failed ino %llu rw %lu "
 -		      "sector %#Lx len %u err no %d\n",
 +		btrfs_err(BTRFS_I(dip->inode)->root->fs_info,
 +			  "direct IO failed ino %llu rw %lu sector %#Lx len %u err no %d",
  		      btrfs_ino(dip->inode), bio->bi_rw,
- 		      (unsigned long long)bio->bi_sector, bio->bi_size, err);
+ 		      (unsigned long long)bio->bi_iter.bi_sector,
+ 		      bio->bi_iter.bi_size, err);
  		dip->errors = 1;
 
  		/*
fs/f2fs/data.c +14 -17
diff --cc fs/f2fs/data.c
index 0ae558723506,a2c8de8ba6ce..25d675e6a138
@@@ -24,195 -24,6 +24,192 @@@
  #include "segment.h"
  #include <trace/events/f2fs.h>
 
 +static void f2fs_read_end_io(struct bio *bio, int err)
 +{
- 	const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
- 	struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
++	struct bio_vec *bvec;
++	int i;
 +
- 	do {
++	bio_for_each_segment_all(bvec, bio, i) {
 +		struct page *page = bvec->bv_page;
 +
- 		if (--bvec >= bio->bi_io_vec)
- 			prefetchw(&bvec->bv_page->flags);
- 
- 		if (unlikely(!uptodate)) {
++		if (unlikely(err)) {
 +			ClearPageUptodate(page);
 +			SetPageError(page);
 +		} else {
 +			SetPageUptodate(page);
 +		}
 +		unlock_page(page);
- 	} while (bvec >= bio->bi_io_vec);
++	}
 +
 +	bio_put(bio);
 +}
 +
 +static void f2fs_write_end_io(struct bio *bio, int err)
 +{
- 	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);
++	struct bio_vec *bvec;
++	struct f2fs_sb_info *sbi = NULL;
++	int i;
 +
- 	do {
++	bio_for_each_segment_all(bvec, bio, i) {
 +		struct page *page = bvec->bv_page;
 +
- 		if (--bvec >= bio->bi_io_vec)
- 			prefetchw(&bvec->bv_page->flags);
++		if (!sbi)
++			sbi = F2FS_SB(bvec->bv_page->mapping->host->i_sb);
 +
- 		if (unlikely(!uptodate)) {
++		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);
- 	} while (bvec >= bio->bi_io_vec);
++	}
 +
 +	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_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
++	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
include/trace/events/f2fs.h +2 -2
diff --cc include/trace/events/f2fs.h
index 3b9f28dfc849,bd3ee4fbe7a7..67f38faac589
@@@ -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)
  );
Signature · 2 lines
Jaegeuk Kim
Samsung
#4 lore raw
Quoted 2 lines · Jaegeuk Kim

In the case of f2fs, could you please check the following code changes?

So I ended up doing the merge differently wrt the f2fs_write_end_io() function.

As far as I can tell, we can just initialize the f2fs_sb_info directly and unconditionally using the first bio_vec entry, giving us the simpler

struct f2fs_sb_info *sbi =
F2FS_SB(bio->bi_io_vec->bv_page->mapping->host->i_sb);

which is still ugly, but whatever. I'm not quite seeing why f2fs doesn't just set bio->private to the superblock pointer and avoid this whole complex and long pointer chasing, but there's probably some reason.

Anyway, it compiles for me, and looks simpler than the alternate resolutions, but maybe there is some reason I miss why you guys did it the way you did. And while I could test that it compiles and looks sane, I don't have a f2fs to actually *test* it on, and maybe I screwed up royally.

I'll push it out once I've done the rest of the allmodconfig build-test.

Linus

#5 lore raw
In reply to Jens Axboe
Quoted 18 lines · Jens Axboe
Quoted 18 lines

- 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.

Please pull! There will be a bit of merge work for you, but it should be fairly straight forward. It's mostly related to changin:

bio->bi_sector -> bio->bi_iter.bi_sector
bio->bi_size -> bio->bi_iter.bi_size

Quoted 5 lines
Quoted 1 line

git://git.kernel.dk/linux-block.git for-3.14/core

BTW, let me know if you want me to merge this. The above has been in for-next since forever, and Stephen has carried a fix or two for new merges.

arch/xtensa/platforms/iss/simdisk.c:108:23: error: 'struct bio' has no member named 'bi_sector'

http://kisskb.ellerman.id.au/kisskb/buildresult/10542666/

Reported before at:
http://www.spinics.net/lists/dm-devel/msg20937.html

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author
#6 lore raw
Quoted 21 lines · Geert Uytterhoeven
Quoted 20 lines · Jens Axboe
Quoted 19 lines

- 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.

Please pull! There will be a bit of merge work for you, but it should be fairly straight forward. It's mostly related to changin:

bio->bi_sector -> bio->bi_iter.bi_sector
bio->bi_size -> bio->bi_iter.bi_size

git://git.kernel.dk/linux-block.git for-3.14/core

Quoted 8 lines
Quoted 3 lines

BTW, let me know if you want me to merge this. The above has been in for-next since forever, and Stephen has carried a fix or two for new merges.

arch/xtensa/platforms/iss/simdisk.c:108:23: error: 'struct bio' has no member named 'bi_sector'

http://kisskb.ellerman.id.au/kisskb/buildresult/10542666/

Does the below fix it for you? There's an existing bug in there where it kunmaps the wrong part (page instead of the address). Not sure that matters on xtensa or whether the kmaps are a no-op, but cleaned up none the less.

arch/xtensa/platforms/iss/simdisk.c +7 -7
index 8c6e819cd8ed..48eebacdf5fe 100644
@@ -103,18 +103,18 @@ static void simdisk_transfer(struct simdisk *dev, unsigned long sector,
 
 static int simdisk_xfer_bio(struct simdisk *dev, struct bio *bio)
 {
-	int i;
-	struct bio_vec *bvec;
-	sector_t sector = bio->bi_sector;
+	struct bio_vec bvec;
+	struct bvec_iter iter;
+	sector_t sector = bio->bi_iter.bi_sector;
 
-	bio_for_each_segment(bvec, bio, i) {
-		char *buffer = __bio_kmap_atomic(bio, i);
-		unsigned len = bvec->bv_len >> SECTOR_SHIFT;
+	bio_for_each_segment(bvec, bio, iter) {
+		char *buffer = __bio_kmap_atomic(bio, iter);
+		unsigned len = bvec.bv_len >> SECTOR_SHIFT;
 
 		simdisk_transfer(dev, sector, len, buffer,
 				bio_data_dir(bio) == WRITE);
 		sector += len;
-		__bio_kunmap_atomic(bio);
+		__bio_kunmap_atomic(buffer);
 	}
 	return 0;
 }
Signature · 1 line
Jens Axboe
#7 lore raw

Hi Jens,

Quoted 29 lines · Jens Axboe
Quoted 28 lines · Geert Uytterhoeven
Quoted 18 lines · Jens Axboe
Quoted 18 lines

- 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.

Please pull! There will be a bit of merge work for you, but it should be fairly straight forward. It's mostly related to changin:

bio->bi_sector -> bio->bi_iter.bi_sector
bio->bi_size -> bio->bi_iter.bi_size

Quoted 5 lines
Quoted 1 line

git://git.kernel.dk/linux-block.git for-3.14/core

BTW, let me know if you want me to merge this. The above has been in for-next since forever, and Stephen has carried a fix or two for new merges.

arch/xtensa/platforms/iss/simdisk.c:108:23: error: 'struct bio' has no member named 'bi_sector'

Quoted 6 lines
Quoted 1 line

http://kisskb.ellerman.id.au/kisskb/buildresult/10542666/

Does the below fix it for you? There's an existing bug in there where it kunmaps the wrong part (page instead of the address). Not sure that matters on xtensa or whether the kmaps are a no-op, but cleaned up none the less.

Yes, it does. Thanks!

Quoted 20 lines
arch/xtensa/platforms/iss/simdisk.c +5 -6
index 8c6e819cd8ed..48eebacdf5fe 100644
@@ -103,18 +103,18 @@ static void simdisk_transfer(struct simdisk *dev, unsigned long sector,
 
 static int simdisk_xfer_bio(struct simdisk *dev, struct bio *bio)
 {
-       int i;
-       struct bio_vec *bvec;
-       sector_t sector = bio->bi_sector;
+       struct bio_vec bvec;
+       struct bvec_iter iter;
+       sector_t sector = bio->bi_iter.bi_sector;
 
-       bio_for_each_segment(bvec, bio, i) {
-               char *buffer = __bio_kmap_atomic(bio, i);
-               unsigned len = bvec->bv_len >> SECTOR_SHIFT;
+       bio_for_each_segment(bvec, bio, iter) {
+               char *buffer = __bio_kmap_atomic(bio, iter);

arch/xtensa/platforms/iss/simdisk.c static void simdisk_transfer(struct simdisk *dev, unsigned long sector, · line 120

Quoted 10 lines
arch/xtensa/platforms/iss/simdisk.c +2 -1
+               unsigned len = bvec.bv_len >> SECTOR_SHIFT;
 
                simdisk_transfer(dev, sector, len, buffer,
                                bio_data_dir(bio) == WRITE);
                sector += len;
-               __bio_kunmap_atomic(bio);
+               __bio_kunmap_atomic(buffer);
        }
        return 0;
 }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author
#8 lore raw
Quoted 32 lines · Geert Uytterhoeven

Hi Jens,

Quoted 29 lines · Jens Axboe
Quoted 28 lines · Geert Uytterhoeven
Quoted 18 lines · Jens Axboe
Quoted 18 lines

- 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.

Please pull! There will be a bit of merge work for you, but it should be fairly straight forward. It's mostly related to changin:

bio->bi_sector -> bio->bi_iter.bi_sector
bio->bi_size -> bio->bi_iter.bi_size

Quoted 5 lines
Quoted 1 line

git://git.kernel.dk/linux-block.git for-3.14/core

BTW, let me know if you want me to merge this. The above has been in for-next since forever, and Stephen has carried a fix or two for new merges.

arch/xtensa/platforms/iss/simdisk.c:108:23: error: 'struct bio' has no member named 'bi_sector'

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

http://kisskb.ellerman.id.au/kisskb/buildresult/10542666/

Does the below fix it for you? There's an existing bug in there where it kunmaps the wrong part (page instead of the address). Not sure that matters on xtensa or whether the kmaps are a no-op, but cleaned up none the less.

Yes, it does. Thanks!

Thanks for testing!

Quoted 1 line

Added.

Linus, I queued up this patch, it's in for-3.14/core as well. This will offset the inserted/deleted lines by 7/7.

Signature · 1 line
Jens Axboe