linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the block tree with the f2fs tree
@ 2014-01-06  6:03 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2014-01-06  6:03 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim
  Cc: linux-next, linux-kernel, Huajun Li, Chao Yu, Gu Zheng, Kent Overstreet

[-- Attachment #1: Type: text/plain, Size: 6602 bytes --]

Hi Jens,

Today's linux-next merge of the block tree got a conflict in
fs/f2fs/data.c between various commits from the f2fs tree and commits
2c30c71bd653 ("block: Convert various code to bio_for_each_segment()")
and 4f024f3797c4 ("block: Abstract out bvec iterator") from the block
tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

The conflict in this file are a bit of a pain as I am having to fix this
up by hand most days (and I hope I am getting it right).  Maybe the f2fs
tree could merge commit 4f024f3797c4 ("block: Abstract out bvec
iterator") from the block tree (assuming that it will remain stable) as
it is only 4 commits and do these fixups properly (with a bit of help in
case what I have done above is not exactly right).  That merge commit
would need a good commit message, of course.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/f2fs/data.c
index 63d190264a36,a2c8de8ba6ce..000000000000
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@@ -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;
 +	}
 +	__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

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: linux-next: manual merge of the block tree with the f2fs tree
  2020-12-14 20:12 ` Stephen Rothwell
@ 2020-12-17  1:50   ` Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2020-12-17  1:50 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Jens Axboe, Chao Yu, Chao Yu, Christoph Hellwig,
	Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 2785 bytes --]

Hi all,

On Tue, 15 Dec 2020 07:12:12 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> On Thu, 3 Dec 2020 14:43:48 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > Today's linux-next merge of the block tree got conflicts in:
> > 
> >   fs/f2fs/checkpoint.c
> >   fs/f2fs/f2fs.h
> >   fs/f2fs/super.c
> > 
> > between commit:
> > 
> >   5c0602188dc7 ("f2fs: fix kbytes written stat for multi-device case")
> > 
> > from the f2fs tree and commits:
> > 
> >   8446fe9255be ("block: switch partition lookup to use struct block_device")
> >   9499ffc75217 ("f2fs: remove a few bd_part checks")
> > 
> > from the block tree.
> > 
> > I fixed it up (I think, see below, fs/f2fs/f2fs.h and fs/f2fs/super.c
> > used the versions from the f2fs tree) and can carry the fix as
> > necessary. This is now fixed as far as linux-next is concerned, but any
> > non trivial conflicts should be mentioned to your upstream maintainer
> > when your tree is submitted for merging.  You may also want to consider
> > cooperating with the maintainer of the conflicting tree to minimise any
> > particularly complex conflicts.
> > 
> > 
> > diff --cc fs/f2fs/checkpoint.c
> > index 14ba1519639e,54a1905af052..000000000000
> > --- a/fs/f2fs/checkpoint.c
> > +++ b/fs/f2fs/checkpoint.c
> > @@@ -1385,27 -1385,6 +1385,26 @@@ static void commit_checkpoint(struct f2
> >   	f2fs_submit_merged_write(sbi, META_FLUSH);
> >   }
> >   
> >  +static inline u64 get_sectors_written(struct block_device *bdev)
> >  +{
> > - 	return bdev->bd_part ?
> > - 		(u64)part_stat_read(bdev->bd_part, sectors[STAT_WRITE]) : 0;
> > ++	return (u64)part_stat_read(bdev, sectors[STAT_WRITE]) : 0;  
>                                                              ^^^^
> With this removed.
> 
> >  +}
> >  +
> >  +u64 f2fs_get_sectors_written(struct f2fs_sb_info *sbi)
> >  +{
> >  +	if (f2fs_is_multi_device(sbi)) {
> >  +		u64 sectors = 0;
> >  +		int i;
> >  +
> >  +		for (i = 0; i < sbi->s_ndevs; i++)
> >  +			sectors += get_sectors_written(FDEV(i).bdev);
> >  +
> >  +		return sectors;
> >  +	}
> >  +
> >  +	return get_sectors_written(sbi->sb->s_bdev);
> >  +}
> >  +
> >   static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
> >   {
> >   	struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
> > diff --cc fs/f2fs/f2fs.h
> > index 5cd1b9f7cc53,49681a8d2b14..000000000000
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > diff --cc fs/f2fs/super.c
> > index 47858e0c5e95,af9f449da64b..000000000000
> > --- a/fs/f2fs/super.c
> > +++ b/fs/f2fs/super.c  
> 
> Just a reminder that the above conflict still exists.

This is now a conflict between the f2fs tree and Linus' tree.
-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: linux-next: manual merge of the block tree with the f2fs tree
  2020-12-03  3:43 Stephen Rothwell
  2020-12-03  3:47 ` Chao Yu
  2020-12-03  3:57 ` Stephen Rothwell
@ 2020-12-14 20:12 ` Stephen Rothwell
  2020-12-17  1:50   ` Stephen Rothwell
  2 siblings, 1 reply; 18+ messages in thread
From: Stephen Rothwell @ 2020-12-14 20:12 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim
  Cc: Chao Yu, Chao Yu, Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 2521 bytes --]

Hi all,

On Thu, 3 Dec 2020 14:43:48 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the block tree got conflicts in:
> 
>   fs/f2fs/checkpoint.c
>   fs/f2fs/f2fs.h
>   fs/f2fs/super.c
> 
> between commit:
> 
>   5c0602188dc7 ("f2fs: fix kbytes written stat for multi-device case")
> 
> from the f2fs tree and commits:
> 
>   8446fe9255be ("block: switch partition lookup to use struct block_device")
>   9499ffc75217 ("f2fs: remove a few bd_part checks")
> 
> from the block tree.
> 
> I fixed it up (I think, see below, fs/f2fs/f2fs.h and fs/f2fs/super.c
> used the versions from the f2fs tree) and can carry the fix as
> necessary. This is now fixed as far as linux-next is concerned, but any
> non trivial conflicts should be mentioned to your upstream maintainer
> when your tree is submitted for merging.  You may also want to consider
> cooperating with the maintainer of the conflicting tree to minimise any
> particularly complex conflicts.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc fs/f2fs/checkpoint.c
> index 14ba1519639e,54a1905af052..000000000000
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@@ -1385,27 -1385,6 +1385,26 @@@ static void commit_checkpoint(struct f2
>   	f2fs_submit_merged_write(sbi, META_FLUSH);
>   }
>   
>  +static inline u64 get_sectors_written(struct block_device *bdev)
>  +{
> - 	return bdev->bd_part ?
> - 		(u64)part_stat_read(bdev->bd_part, sectors[STAT_WRITE]) : 0;
> ++	return (u64)part_stat_read(bdev, sectors[STAT_WRITE]) : 0;
                                                             ^^^^
With this rmeoved.

>  +}
>  +
>  +u64 f2fs_get_sectors_written(struct f2fs_sb_info *sbi)
>  +{
>  +	if (f2fs_is_multi_device(sbi)) {
>  +		u64 sectors = 0;
>  +		int i;
>  +
>  +		for (i = 0; i < sbi->s_ndevs; i++)
>  +			sectors += get_sectors_written(FDEV(i).bdev);
>  +
>  +		return sectors;
>  +	}
>  +
>  +	return get_sectors_written(sbi->sb->s_bdev);
>  +}
>  +
>   static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
>   {
>   	struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
> diff --cc fs/f2fs/f2fs.h
> index 5cd1b9f7cc53,49681a8d2b14..000000000000
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> diff --cc fs/f2fs/super.c
> index 47858e0c5e95,af9f449da64b..000000000000
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c

Just a reminder that the above conflict still exists.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: linux-next: manual merge of the block tree with the f2fs tree
  2020-12-03  3:43 Stephen Rothwell
  2020-12-03  3:47 ` Chao Yu
@ 2020-12-03  3:57 ` Stephen Rothwell
  2020-12-14 20:12 ` Stephen Rothwell
  2 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2020-12-03  3:57 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim
  Cc: Chao Yu, Chao Yu, Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

Hi all,

On Thu, 3 Dec 2020 14:43:48 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> diff --cc fs/f2fs/checkpoint.c
> index 14ba1519639e,54a1905af052..000000000000
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@@ -1385,27 -1385,6 +1385,26 @@@ static void commit_checkpoint(struct f2
>   	f2fs_submit_merged_write(sbi, META_FLUSH);
>   }
>   
>  +static inline u64 get_sectors_written(struct block_device *bdev)
>  +{
> - 	return bdev->bd_part ?
> - 		(u64)part_stat_read(bdev->bd_part, sectors[STAT_WRITE]) : 0;
> ++	return (u64)part_stat_read(bdev, sectors[STAT_WRITE]) : 0;
                                                             ^^^^
Clearly, that should have been removed - I have done that now.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: linux-next: manual merge of the block tree with the f2fs tree
  2020-12-03  3:43 Stephen Rothwell
@ 2020-12-03  3:47 ` Chao Yu
  2020-12-03  3:57 ` Stephen Rothwell
  2020-12-14 20:12 ` Stephen Rothwell
  2 siblings, 0 replies; 18+ messages in thread
From: Chao Yu @ 2020-12-03  3:47 UTC (permalink / raw)
  To: Stephen Rothwell, Jens Axboe, Jaegeuk Kim
  Cc: Chao Yu, Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List

On 2020/12/3 11:43, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the block tree got conflicts in:
> 
>    fs/f2fs/checkpoint.c
>    fs/f2fs/f2fs.h
>    fs/f2fs/super.c
> 
> between commit:
> 
>    5c0602188dc7 ("f2fs: fix kbytes written stat for multi-device case")
> 
> from the f2fs tree and commits:
> 
>    8446fe9255be ("block: switch partition lookup to use struct block_device")
>    9499ffc75217 ("f2fs: remove a few bd_part checks")
> 
> from the block tree.
> 
> I fixed it up (I think, see below, fs/f2fs/f2fs.h and fs/f2fs/super.c
> used the versions from the f2fs tree) and can carry the fix as
> necessary. This is now fixed as far as linux-next is concerned, but any
> non trivial conflicts should be mentioned to your upstream maintainer
> when your tree is submitted for merging.  You may also want to consider
> cooperating with the maintainer of the conflicting tree to minimise any
> particularly complex conflicts.
> 

The fix looks good to me. :)

Thanks,


^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2020-12-03  3:43 Stephen Rothwell
  2020-12-03  3:47 ` Chao Yu
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Stephen Rothwell @ 2020-12-03  3:43 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim
  Cc: Chao Yu, Chao Yu, Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 2116 bytes --]

Hi all,

Today's linux-next merge of the block tree got conflicts in:

  fs/f2fs/checkpoint.c
  fs/f2fs/f2fs.h
  fs/f2fs/super.c

between commit:

  5c0602188dc7 ("f2fs: fix kbytes written stat for multi-device case")

from the f2fs tree and commits:

  8446fe9255be ("block: switch partition lookup to use struct block_device")
  9499ffc75217 ("f2fs: remove a few bd_part checks")

from the block tree.

I fixed it up (I think, see below, fs/f2fs/f2fs.h and fs/f2fs/super.c
used the versions from the f2fs tree) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging.  You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/checkpoint.c
index 14ba1519639e,54a1905af052..000000000000
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@@ -1385,27 -1385,6 +1385,26 @@@ static void commit_checkpoint(struct f2
  	f2fs_submit_merged_write(sbi, META_FLUSH);
  }
  
 +static inline u64 get_sectors_written(struct block_device *bdev)
 +{
- 	return bdev->bd_part ?
- 		(u64)part_stat_read(bdev->bd_part, sectors[STAT_WRITE]) : 0;
++	return (u64)part_stat_read(bdev, sectors[STAT_WRITE]) : 0;
 +}
 +
 +u64 f2fs_get_sectors_written(struct f2fs_sb_info *sbi)
 +{
 +	if (f2fs_is_multi_device(sbi)) {
 +		u64 sectors = 0;
 +		int i;
 +
 +		for (i = 0; i < sbi->s_ndevs; i++)
 +			sectors += get_sectors_written(FDEV(i).bdev);
 +
 +		return sectors;
 +	}
 +
 +	return get_sectors_written(sbi->sb->s_bdev);
 +}
 +
  static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
  {
  	struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
diff --cc fs/f2fs/f2fs.h
index 5cd1b9f7cc53,49681a8d2b14..000000000000
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
diff --cc fs/f2fs/super.c
index 47858e0c5e95,af9f449da64b..000000000000
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2016-11-22  3:42 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2016-11-22  3:42 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim; +Cc: linux-next, linux-kernel, Christoph Hellwig

Hi Jens,

Today's linux-next merge of the block tree got a conflict in:

  fs/f2fs/segment.c

between commit:

  792b84b74b54 ("f2fs: support multiple devices")

from the f2fs tree and commit:

  70fd76140a6c ("block,fs: use REQ_* flags directly")

from the block tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/segment.c
index eaa0b40e1ba0,f1b4a1775ebe..000000000000
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@@ -401,33 -400,6 +401,33 @@@ void f2fs_balance_fs_bg(struct f2fs_sb_
  	}
  }
  
 +static int __submit_flush_wait(struct block_device *bdev)
 +{
 +	struct bio *bio = f2fs_bio_alloc(0);
 +	int ret;
 +
- 	bio_set_op_attrs(bio, REQ_OP_WRITE, WRITE_FLUSH);
++	bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH;
 +	bio->bi_bdev = bdev;
 +	ret = submit_bio_wait(bio);
 +	bio_put(bio);
 +	return ret;
 +}
 +
 +static int submit_flush_wait(struct f2fs_sb_info *sbi)
 +{
 +	int ret = __submit_flush_wait(sbi->sb->s_bdev);
 +	int i;
 +
 +	if (sbi->s_ndevs && !ret) {
 +		for (i = 1; i < sbi->s_ndevs; i++) {
 +			ret = __submit_flush_wait(FDEV(i).bdev);
 +			if (ret)
 +				break;
 +		}
 +	}
 +	return ret;
 +}
 +
  static int issue_flush_thread(void *data)
  {
  	struct f2fs_sb_info *sbi = data;

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2016-07-11  4:52 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2016-07-11  4:52 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim; +Cc: linux-next, linux-kernel, Mike Christie

Hi Jens,

Today's linux-next merge of the block tree got a conflict in:

  fs/f2fs/data.c

between commits:

  19a5f5e2ef37 ("f2fs: drop any block plugging")
  52763a4b7a21 ("f2fs: detect host-managed SMR by feature flag")
  78682f794479 ("f2fs: fix to avoid reading out encrypted data in page cache")

from the f2fs tree and commits:

  4e49ea4a3d27 ("block/fs/drivers: remove rw argument from submit_bio")
  04d328defd06 ("f2fs: use bio op accessors")

from the block tree.

I fixed it up (see below - I am not confident of these fixups, so
please check and let me know if anything else is needed) and can carry
the fix as necessary. This is now fixed as far as linux-next is
concerned, but any non trivial conflicts should be mentioned to your
upstream maintainer when your tree is submitted for merging.  You may
also want to consider cooperating with the maintainer of the
conflicting tree to minimise any particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/data.c
index 20b30162e7b4,8769e8349dff..000000000000
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@@ -100,16 -97,11 +100,16 @@@ static struct bio *__bio_alloc(struct f
  	return bio;
  }
  
- static inline void __submit_bio(struct f2fs_sb_info *sbi, int rw,
- 			struct bio *bio, enum page_type type)
 -static inline void __submit_bio(struct f2fs_sb_info *sbi, struct bio *bio)
++static inline void __submit_bio(struct f2fs_sb_info *sbi, struct bio *bio,
++				enum page_type type)
  {
- 	if (!is_read_io(rw)) {
 -	if (!is_read_io(bio_op(bio)))
++	if (!is_read_io(bio_op(bio))) {
  		atomic_inc(&sbi->nr_wb_bios);
 +		if (f2fs_sb_mounted_hmsmr(sbi->sb) &&
 +			current->plug && (type == DATA || type == NODE))
 +			blk_finish_plug(current->plug);
 +	}
- 	submit_bio(rw, bio);
+ 	submit_bio(bio);
  }
  
  static void __submit_merged_bio(struct f2fs_bio_info *io)
@@@ -124,7 -116,9 +124,9 @@@
  	else
  		trace_f2fs_submit_write_bio(io->sbi->sb, fio, io->bio);
  
- 	__submit_bio(io->sbi, fio->rw, io->bio, fio->type);
+ 	bio_set_op_attrs(io->bio, fio->op, fio->op_flags);
+ 
 -	__submit_bio(io->sbi, io->bio);
++	__submit_bio(io->sbi, io->bio, fio->type);
  	io->bio = NULL;
  }
  
@@@ -241,8 -237,10 +245,10 @@@ int f2fs_submit_page_bio(struct f2fs_io
  		bio_put(bio);
  		return -EFAULT;
  	}
+ 	bio->bi_rw = fio->op_flags;
+ 	bio_set_op_attrs(bio, fio->op, fio->op_flags);
  
- 	__submit_bio(fio->sbi, fio->rw, bio, fio->type);
 -	__submit_bio(fio->sbi, bio);
++	__submit_bio(fio->sbi, bio, fio->type);
  	return 0;
  }
  
@@@ -1080,13 -1057,36 +1087,14 @@@ got_it
  		 */
  		if (bio && (last_block_in_bio != block_nr - 1)) {
  submit_and_realloc:
- 			__submit_bio(F2FS_I_SB(inode), READ, bio, DATA);
 -			__submit_bio(F2FS_I_SB(inode), bio);
++			__submit_bio(F2FS_I_SB(inode), bio, DATA);
  			bio = NULL;
  		}
  		if (bio == NULL) {
 -			struct fscrypt_ctx *ctx = NULL;
 -
 -			if (f2fs_encrypted_inode(inode) &&
 -					S_ISREG(inode->i_mode)) {
 -
 -				ctx = fscrypt_get_ctx(inode, GFP_NOFS);
 -				if (IS_ERR(ctx))
 -					goto set_error_page;
 -
 -				/* wait the page to be moved by cleaning */
 -				f2fs_wait_on_encrypted_page_writeback(
 -						F2FS_I_SB(inode), block_nr);
 -			}
 -
 -			bio = bio_alloc(GFP_KERNEL,
 -				min_t(int, nr_pages, BIO_MAX_PAGES));
 -			if (!bio) {
 -				if (ctx)
 -					fscrypt_release_ctx(ctx);
 +			bio = f2fs_grab_bio(inode, block_nr, nr_pages);
 +			if (IS_ERR(bio))
  				goto set_error_page;
 -			}
 -			bio->bi_bdev = bdev;
 -			bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(block_nr);
 -			bio->bi_end_io = f2fs_read_end_io;
 -			bio->bi_private = ctx;
+ 			bio_set_op_attrs(bio, REQ_OP_READ, 0);
  		}
  
  		if (bio_add_page(bio, page, blocksize, 0) < blocksize)
@@@ -1101,7 -1101,7 +1109,7 @@@ set_error_page
  		goto next_page;
  confused:
  		if (bio) {
- 			__submit_bio(F2FS_I_SB(inode), READ, bio, DATA);
 -			__submit_bio(F2FS_I_SB(inode), bio);
++			__submit_bio(F2FS_I_SB(inode), bio, DATA);
  			bio = NULL;
  		}
  		unlock_page(page);
@@@ -1111,7 -1111,7 +1119,7 @@@ next_page
  	}
  	BUG_ON(pages && !list_empty(pages));
  	if (bio)
- 		__submit_bio(F2FS_I_SB(inode), READ, bio, DATA);
 -		__submit_bio(F2FS_I_SB(inode), bio);
++		__submit_bio(F2FS_I_SB(inode), bio, DATA);
  	return 0;
  }
  
@@@ -1636,23 -1667,25 +1645,24 @@@ repeat
  	if (blkaddr == NEW_ADDR) {
  		zero_user_segment(page, 0, PAGE_SIZE);
  	} else {
 -		struct f2fs_io_info fio = {
 -			.sbi = sbi,
 -			.type = DATA,
 -			.op = REQ_OP_READ,
 -			.op_flags = READ_SYNC,
 -			.old_blkaddr = blkaddr,
 -			.new_blkaddr = blkaddr,
 -			.page = page,
 -			.encrypted_page = NULL,
 -		};
 -		err = f2fs_submit_page_bio(&fio);
 -		if (err)
 +		struct bio *bio;
 +
 +		bio = f2fs_grab_bio(inode, blkaddr, 1);
 +		if (IS_ERR(bio)) {
 +			err = PTR_ERR(bio);
  			goto fail;
 +		}
++		bio_set_op_attrs(bio, REQ_OP_READ, READ_SYNC);
  
 -		lock_page(page);
 -		if (unlikely(!PageUptodate(page))) {
 -			err = -EIO;
 +		if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
 +			bio_put(bio);
 +			err = -EFAULT;
  			goto fail;
  		}
 +
- 		__submit_bio(sbi, READ_SYNC, bio, DATA);
++		__submit_bio(sbi, bio, DATA);
 +
 +		lock_page(page);
  		if (unlikely(page->mapping != mapping)) {
  			f2fs_put_page(page, 1);
  			goto repeat;

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2016-06-20  2:37 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2016-06-20  2:37 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim; +Cc: linux-next, linux-kernel

Hi Jens,

Today's linux-next merge of the block tree got a conflict in:

  fs/f2fs/data.c

between commit:

  6d63ed97a1f2 ("f2fs: detect host-managed SMR by feature flag")

from the f2fs tree and commit:

  04d328defd06 ("f2fs: use bio op accessors")

from the block tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/data.c
index ba4963f51bee,8769e8349dff..000000000000
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@@ -97,16 -97,11 +97,16 @@@ static struct bio *__bio_alloc(struct f
  	return bio;
  }
  
- static inline void __submit_bio(struct f2fs_sb_info *sbi, int rw,
- 			struct bio *bio, enum page_type type)
 -static inline void __submit_bio(struct f2fs_sb_info *sbi, struct bio *bio)
++static inline void __submit_bio(struct f2fs_sb_info *sbi, struct bio *bio,
++				enum page_type type)
  {
- 	if (!is_read_io(rw)) {
 -	if (!is_read_io(bio_op(bio)))
++	if (!is_read_io(bio_op(bio))) {
  		atomic_inc(&sbi->nr_wb_bios);
 +		if (f2fs_sb_mounted_hmsmr(sbi->sb) &&
 +			current->plug && (type == DATA || type == NODE))
 +			blk_finish_plug(current->plug);
 +	}
- 	submit_bio(rw, bio);
+ 	submit_bio(bio);
  }
  
  static void __submit_merged_bio(struct f2fs_bio_info *io)
@@@ -121,7 -116,9 +121,9 @@@
  	else
  		trace_f2fs_submit_write_bio(io->sbi->sb, fio, io->bio);
  
- 	__submit_bio(io->sbi, fio->rw, io->bio, fio->type);
+ 	bio_set_op_attrs(io->bio, fio->op, fio->op_flags);
+ 
 -	__submit_bio(io->sbi, io->bio);
++	__submit_bio(io->sbi, io->bio, fio->type);
  	io->bio = NULL;
  }
  
@@@ -238,8 -237,10 +242,10 @@@ int f2fs_submit_page_bio(struct f2fs_io
  		bio_put(bio);
  		return -EFAULT;
  	}
+ 	bio->bi_rw = fio->op_flags;
+ 	bio_set_op_attrs(bio, fio->op, fio->op_flags);
  
- 	__submit_bio(fio->sbi, fio->rw, bio, fio->type);
 -	__submit_bio(fio->sbi, bio);
++	__submit_bio(fio->sbi, bio, fio->type);
  	return 0;
  }
  
@@@ -1044,7 -1057,7 +1051,7 @@@ got_it
  		 */
  		if (bio && (last_block_in_bio != block_nr - 1)) {
  submit_and_realloc:
- 			__submit_bio(F2FS_I_SB(inode), READ, bio, DATA);
 -			__submit_bio(F2FS_I_SB(inode), bio);
++			__submit_bio(F2FS_I_SB(inode), bio, DATA);
  			bio = NULL;
  		}
  		if (bio == NULL) {
@@@ -1087,7 -1101,7 +1095,7 @@@ set_error_page
  		goto next_page;
  confused:
  		if (bio) {
- 			__submit_bio(F2FS_I_SB(inode), READ, bio, DATA);
 -			__submit_bio(F2FS_I_SB(inode), bio);
++			__submit_bio(F2FS_I_SB(inode), bio, DATA);
  			bio = NULL;
  		}
  		unlock_page(page);
@@@ -1097,7 -1111,7 +1105,7 @@@ next_page
  	}
  	BUG_ON(pages && !list_empty(pages));
  	if (bio)
- 		__submit_bio(F2FS_I_SB(inode), READ, bio, DATA);
 -		__submit_bio(F2FS_I_SB(inode), bio);
++		__submit_bio(F2FS_I_SB(inode), bio, DATA);
  	return 0;
  }
  

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: linux-next: manual merge of the block tree with the f2fs tree
  2016-06-09  3:26 Stephen Rothwell
@ 2016-06-09  3:34 ` Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2016-06-09  3:34 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-next, linux-kernel, Jaegeuk Kim

Hi all,

On Thu, 9 Jun 2016 13:26:09 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the block tree got conflicts in:
> 
>   fs/f2fs/data.c
>   fs/f2fs/segment.c
> 
> between commits:
> 
>   0a87f664d1ad ("f2fs: detect congestion of flush command issues")
>   19a5f5e2ef37 ("f2fs: drop any block plugging")
> 
> from the f2fs tree and commits:
> 
>   4e49ea4a3d27 ("block/fs/drivers: remove rw argument from submit_bio")
>   04d328defd06 ("f2fs: use bio op accessors")
> 
> from the block tree.

Can someone give me a good address for Mike Christie, please - the
address in those block tree commits (Mike Christie
<mchristi@redhat.com>) fails.
-- 
Cheers,
Stephen Rothwell

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2016-06-09  3:26 Stephen Rothwell
  2016-06-09  3:34 ` Stephen Rothwell
  0 siblings, 1 reply; 18+ messages in thread
From: Stephen Rothwell @ 2016-06-09  3:26 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-next, linux-kernel, Mike Christie, Jaegeuk Kim

Hi Jens,

Today's linux-next merge of the block tree got conflicts in:

  fs/f2fs/data.c
  fs/f2fs/segment.c

between commits:

  0a87f664d1ad ("f2fs: detect congestion of flush command issues")
  19a5f5e2ef37 ("f2fs: drop any block plugging")

from the f2fs tree and commits:

  4e49ea4a3d27 ("block/fs/drivers: remove rw argument from submit_bio")
  04d328defd06 ("f2fs: use bio op accessors")

from the block tree.

I fixed it up (I hope - see below) and can carry the fix as necessary.
This is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

23caf71be6500030d4601082e2a6e72d8716573b
diff --cc fs/f2fs/data.c
index 607ef4397330,8769e8349dff..5b3404bb3fb6
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@@ -97,15 -97,11 +97,15 @@@ static struct bio *__bio_alloc(struct f
  	return bio;
  }
  
- static inline void __submit_bio(struct f2fs_sb_info *sbi, int rw,
- 			struct bio *bio, enum page_type type)
 -static inline void __submit_bio(struct f2fs_sb_info *sbi, struct bio *bio)
++static inline void __submit_bio(struct f2fs_sb_info *sbi, struct bio *bio,
++				enum page_type type)
  {
- 	if (!is_read_io(rw)) {
 -	if (!is_read_io(bio_op(bio)))
++	if (!is_read_io(bio_op(bio))) {
  		atomic_inc(&sbi->nr_wb_bios);
 +		if (current->plug && (type == DATA || type == NODE))
 +			blk_finish_plug(current->plug);
 +	}
- 	submit_bio(rw, bio);
+ 	submit_bio(bio);
  }
  
  static void __submit_merged_bio(struct f2fs_bio_info *io)
@@@ -120,7 -116,9 +120,9 @@@
  	else
  		trace_f2fs_submit_write_bio(io->sbi->sb, fio, io->bio);
  
- 	__submit_bio(io->sbi, fio->rw, io->bio, fio->type);
+ 	bio_set_op_attrs(io->bio, fio->op, fio->op_flags);
+ 
 -	__submit_bio(io->sbi, io->bio);
++	__submit_bio(io->sbi, io->bio, fio->type);
  	io->bio = NULL;
  }
  
@@@ -237,8 -237,10 +241,10 @@@ int f2fs_submit_page_bio(struct f2fs_io
  		bio_put(bio);
  		return -EFAULT;
  	}
+ 	bio->bi_rw = fio->op_flags;
+ 	bio_set_op_attrs(bio, fio->op, fio->op_flags);
  
- 	__submit_bio(fio->sbi, fio->rw, bio, fio->type);
 -	__submit_bio(fio->sbi, bio);
++	__submit_bio(fio->sbi, bio, fio->type);
  	return 0;
  }
  
@@@ -1043,7 -1057,7 +1050,7 @@@ got_it
  		 */
  		if (bio && (last_block_in_bio != block_nr - 1)) {
  submit_and_realloc:
- 			__submit_bio(F2FS_I_SB(inode), READ, bio, DATA);
 -			__submit_bio(F2FS_I_SB(inode), bio);
++			__submit_bio(F2FS_I_SB(inode), bio, DATA);
  			bio = NULL;
  		}
  		if (bio == NULL) {
@@@ -1086,7 -1101,7 +1094,7 @@@ set_error_page
  		goto next_page;
  confused:
  		if (bio) {
- 			__submit_bio(F2FS_I_SB(inode), READ, bio, DATA);
 -			__submit_bio(F2FS_I_SB(inode), bio);
++			__submit_bio(F2FS_I_SB(inode), bio, DATA);
  			bio = NULL;
  		}
  		unlock_page(page);
@@@ -1096,7 -1111,7 +1104,7 @@@ next_page
  	}
  	BUG_ON(pages && !list_empty(pages));
  	if (bio)
- 		__submit_bio(F2FS_I_SB(inode), READ, bio, DATA);
 -		__submit_bio(F2FS_I_SB(inode), bio);
++		__submit_bio(F2FS_I_SB(inode), bio, DATA);
  	return 0;
  }
  
diff --cc fs/f2fs/segment.c
index 9ff4e3062777,4c2d1fa1e0e2..99aba0047ee7
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@@ -437,10 -439,9 +439,11 @@@ int f2fs_issue_flush(struct f2fs_sb_inf
  		struct bio *bio = f2fs_bio_alloc(0);
  		int ret;
  
 +		atomic_inc(&fcc->submit_flush);
  		bio->bi_bdev = sbi->sb->s_bdev;
- 		ret = submit_bio_wait(WRITE_FLUSH, bio);
+ 		bio_set_op_attrs(bio, REQ_OP_WRITE, WRITE_FLUSH);
+ 		ret = submit_bio_wait(bio);
 +		atomic_dec(&fcc->submit_flush);
  		bio_put(bio);
  		return ret;
  	}

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2015-07-30  3:19 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2015-07-30  3:19 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim
  Cc: linux-next, linux-kernel, Christoph Hellwig, Chao Yu

Hi Jens,

Today's linux-next merge of the block tree got a conflict in:

  fs/f2fs/data.c

between commit:

  8e5b935bf1ce ("f2fs: maintain extent cache in separated file")

from the f2fs tree and commit:

  4246a0b63bd8 ("block: add a bi_error field to struct bio")

from the block tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/f2fs/data.c
index 111f180fd1d2,8f0baa7ffb50..000000000000
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@@ -27,7 -26,10 +27,7 @@@
  #include "trace.h"
  #include <trace/events/f2fs.h>
  
- static void f2fs_read_end_io(struct bio *bio, int err)
 -static struct kmem_cache *extent_tree_slab;
 -static struct kmem_cache *extent_node_slab;
 -
+ static void f2fs_read_end_io(struct bio *bio)
  {
  	struct bio_vec *bvec;
  	int i;

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2013-12-18  3:57 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2013-12-18  3:57 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim; +Cc: linux-next, linux-kernel, Kent Overstreet

[-- Attachment #1: Type: text/plain, Size: 6577 bytes --]

Hi Jens,

Today's linux-next merge of the block tree got a conflict in
fs/f2fs/data.c between commits from the f2fs tree and commits 2c30c71bd653
("block: Convert various code to bio_for_each_segment()") and
4f024f3797c4 ("block: Abstract out bvec iterator") from the block tree.

I fixed it up (I hope - see below) and can carry the fix as necessary (no
action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/f2fs/data.c
index 9bdacc6f9acc,a2c8de8ba6ce..000000000000
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@@ -25,203 -25,6 +25,200 @@@
  #include <trace/events/f2fs.h>
  
  /*
 + * Low-level block read/write IO operations.
 + */
 +static struct bio *__bio_alloc(struct block_device *bdev, int npages)
 +{
 +	struct bio *bio;
 +
 +	/* No failure on bio allocation */
 +	bio = bio_alloc(GFP_NOIO, npages);
 +	bio->bi_bdev = bdev;
 +	bio->bi_private = NULL;
 +	return bio;
 +}
 +
 +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);
 +}
 +
 +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 | fio->rw_flag;
 +
 +	if (is_read_io(rw)) {
 +		trace_f2fs_submit_read_bio(io->sbi->sb, rw, fio->type, io->bio);
 +		submit_bio(rw, io->bio);
 +		io->bio = NULL;
 +		return;
 +	}
 +	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;
 +	}
 +	__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 block_device *bdev = sbi->sb->s_bdev;
 +	struct bio *bio;
 +
 +	trace_f2fs_submit_page_bio(page, blk_addr, rw);
 +
 +	/* Allocate a new bio */
 +	bio = __bio_alloc(bdev, 1);
 +
 +	/* Initialize the bio */
- 	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_io(rw) ? f2fs_read_end_io : f2fs_write_end_io;
 +
 +	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 block_device *bdev = sbi->sb->s_bdev;
 +	struct f2fs_bio_info *io;
 +	int bio_blocks;
 +
 +	io = is_read_io(fio->rw) ? &sbi->read_io : &sbi->write_io[btype];
 +
 +	verify_block_addr(sbi, blk_addr);
 +
 +	mutex_lock(&io->io_mutex);
 +
 +	if (!is_read_io(fio->rw))
 +		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) {
 +		bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
 +		io->bio = __bio_alloc(bdev, bio_blocks);
- 		io->bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
++		io->bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
 +		io->bio->bi_end_io = is_read_io(fio->rw) ? f2fs_read_end_io :
 +							f2fs_write_end_io;
 +		io->fio = *fio;
 +		/*
 +		 * The end_io will be assigned at the sumbission phase.
 +		 * Until then, let bio_add_page() merge consecutive IOs as much
 +		 * as possible.
 +		 */
 +	}
 +
 +	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
   *  ->node_page

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2013-12-12  2:57 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2013-12-12  2:57 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim; +Cc: linux-next, linux-kernel, Kent Overstreet

[-- Attachment #1: Type: text/plain, Size: 6597 bytes --]

Hi Jens,

Today's linux-next merge of the block tree got a conflict in
fs/f2fs/data.c between commit 8758e549e105 ("f2fs: add unlikely() macro
for compiler more aggressively") from the f2fs tree and commit
2c30c71bd653 ("block: Convert various code to bio_for_each_segment()")
from the block tree.

I fixed it up (I think - see below) and can carry the fix as necessary
(no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/f2fs/data.c
index 15956fa584de,a2c8de8ba6ce..000000000000
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@@ -25,203 -25,6 +25,199 @@@
  #include <trace/events/f2fs.h>
  
  /*
 + * Low-level block read/write IO operations.
 + */
 +static struct bio *__bio_alloc(struct block_device *bdev, int npages)
 +{
 +	struct bio *bio;
 +
 +	/* No failure on bio allocation */
 +	bio = bio_alloc(GFP_NOIO, npages);
 +	bio->bi_bdev = bdev;
 +	bio->bi_private = NULL;
 +	return bio;
 +}
 +
 +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 (unlikely(!uptodate)) {
++		if (!sbi)
++			sbi = F2FS_SB(bvec->bv_page->mapping->host->i_sb);
++		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);
 +}
 +
 +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 | fio->rw_flag;
 +
 +	if (is_read_io(rw)) {
 +		trace_f2fs_submit_read_bio(io->sbi->sb, rw, fio->type, io->bio);
 +		submit_bio(rw, io->bio);
 +		io->bio = NULL;
 +		return;
 +	}
 +	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;
 +	}
 +	__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 block_device *bdev = sbi->sb->s_bdev;
 +	struct bio *bio;
 +
 +	trace_f2fs_submit_page_bio(page, blk_addr, rw);
 +
 +	/* Allocate a new bio */
 +	bio = __bio_alloc(bdev, 1);
 +
 +	/* Initialize the bio */
- 	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_io(rw) ? f2fs_read_end_io : f2fs_write_end_io;
 +
 +	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 block_device *bdev = sbi->sb->s_bdev;
 +	struct f2fs_bio_info *io;
 +	int bio_blocks;
 +
 +	io = is_read_io(fio->rw) ? &sbi->read_io : &sbi->write_io[btype];
 +
 +	verify_block_addr(sbi, blk_addr);
 +
 +	mutex_lock(&io->io_mutex);
 +
 +	if (!is_read_io(fio->rw))
 +		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) {
 +		bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
 +		io->bio = __bio_alloc(bdev, bio_blocks);
- 		io->bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
++		io->bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
 +		io->bio->bi_end_io = is_read_io(fio->rw) ? f2fs_read_end_io :
 +							f2fs_write_end_io;
 +		io->fio = *fio;
 +		/*
 +		 * The end_io will be assigned at the sumbission phase.
 +		 * Until then, let bio_add_page() merge consecutive IOs as much
 +		 * as possible.
 +		 */
 +	}
 +
 +	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
   *  ->node_page

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2013-12-02  4:04 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2013-12-02  4:04 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim; +Cc: linux-next, linux-kernel, Kent Overstreet

[-- Attachment #1: Type: text/plain, Size: 6772 bytes --]

Hi Jens,

Today's linux-next merge of the block tree got conflicts in
fs/f2fs/data.c and fs/f2fs/segment.c between commits 0626804cd9a6 ("f2fs:
remove the own bi_private allocation") and 899d7625d85a ("f2fs: refactor
bio-related operations") from the f2fs tree and commits 2c30c71bd653
("block: Convert various code to bio_for_each_segment()") and  ("block:
Abstract out bvec iterator") from the block tree.

I fixed it up (hopefully - see below - the handling of sbi in
f2fs_end_io_write is not the best) and can carry the fix as necessary (no
action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/f2fs/data.c
index 53e3bbbba7ed,a2c8de8ba6ce..b62a99cf6561
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@@ -25,205 -25,6 +25,201 @@@
  #include <trace/events/f2fs.h>
  
  /*
 + * Low-level block read/write IO operations.
 + */
 +static struct bio *__bio_alloc(struct block_device *bdev, int npages)
 +{
 +	struct bio *bio;
 +
 +	/* No failure on bio allocation */
 +	bio = bio_alloc(GFP_NOIO, npages);
 +	bio->bi_bdev = bdev;
 +	bio->bi_private = NULL;
 +	return bio;
 +}
 +
 +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 (uptodate) {
++		if (!err) {
 +			SetPageUptodate(page);
 +		} else {
 +			ClearPageUptodate(page);
 +			SetPageError(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 (!uptodate) {
++		if (!sbi)
++			sbi = F2FS_SB(bvec->bv_page->mapping->host->i_sb);
++		if (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);
 +}
 +
 +static void __submit_merged_bio(struct f2fs_sb_info *sbi,
 +				struct f2fs_bio_info *io,
 +				enum page_type type, bool sync, int rw)
 +{
 +	enum page_type btype = PAGE_TYPE_OF_BIO(type);
 +
 +	if (!io->bio)
 +		return;
 +
 +	if (btype == META)
 +		rw |= REQ_META;
 +
 +	if (is_read_io(rw)) {
 +		if (sync)
 +			rw |= READ_SYNC;
 +		submit_bio(rw, io->bio);
 +		trace_f2fs_submit_read_bio(sbi->sb, rw, type, io->bio);
 +		io->bio = NULL;
 +		return;
 +	}
 +
 +	if (sync)
 +		rw |= WRITE_SYNC;
 +	if (type >= META_FLUSH)
 +		rw |= WRITE_FLUSH_FUA;
 +
 +	/*
 +	 * META_FLUSH is only from the checkpoint procedure, and we should wait
 +	 * this metadata bio for FS consistency.
 +	 */
 +	if (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);
 +	}
 +	trace_f2fs_submit_write_bio(sbi->sb, rw, btype, io->bio);
 +	io->bio = NULL;
 +}
 +
 +void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi,
 +				enum page_type type, bool sync, 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);
 +	__submit_merged_bio(sbi, io, type, sync, rw);
 +	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 block_device *bdev = sbi->sb->s_bdev;
 +	struct bio *bio;
 +
 +	trace_f2fs_submit_page_bio(page, blk_addr, rw);
 +
 +	/* Allocate a new bio */
 +	bio = __bio_alloc(bdev, 1);
 +
 +	/* Initialize the bio */
- 	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_io(rw) ? f2fs_read_end_io : f2fs_write_end_io;
 +
 +	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, enum page_type type, int rw)
 +{
 +	enum page_type btype = PAGE_TYPE_OF_BIO(type);
 +	struct block_device *bdev = sbi->sb->s_bdev;
 +	struct f2fs_bio_info *io;
 +	int bio_blocks;
 +
 +	io = is_read_io(rw) ? &sbi->read_io : &sbi->write_io[btype];
 +
 +	verify_block_addr(sbi, blk_addr);
 +
 +	mutex_lock(&io->io_mutex);
 +
 +	if (!is_read_io(rw))
 +		inc_page_count(sbi, F2FS_WRITEBACK);
 +
 +	if (io->bio && io->last_block_in_bio != blk_addr - 1)
 +		__submit_merged_bio(sbi, io, type, true, rw);
 +alloc_new:
 +	if (io->bio == NULL) {
 +		bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
 +		io->bio = __bio_alloc(bdev, bio_blocks);
- 		io->bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
++		io->bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
 +		io->bio->bi_end_io = is_read_io(rw) ? f2fs_read_end_io :
 +							f2fs_write_end_io;
 +		/*
 +		 * The end_io will be assigned at the sumbission phase.
 +		 * Until then, let bio_add_page() merge consecutive IOs as much
 +		 * as possible.
 +		 */
 +	}
 +
 +	if (bio_add_page(io->bio, page, PAGE_CACHE_SIZE, 0) <
 +							PAGE_CACHE_SIZE) {
 +		__submit_merged_bio(sbi, io, type, true, rw);
 +		io->bio = NULL;
 +		goto alloc_new;
 +	}
 +
 +	io->last_block_in_bio = blk_addr;
 +
 +	mutex_unlock(&io->io_mutex);
 +	trace_f2fs_submit_page_mbio(page, rw, type, blk_addr);
 +}
 +
 +/*
   * Lock ordering for the change of data block address:
   * ->data_page
   *  ->node_page

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2013-11-26  1:00 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2013-11-26  1:00 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim; +Cc: linux-next, linux-kernel, Chao Yu

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

Hi Jens,

Today's linux-next merge of the block tree got a conflict in
include/trace/events/f2fs.h between commit 4bfc388c73a1 ("f2fs: adds a
tracepoint for f2fs_submit_read_bio") from the  tree and commit
4f024f3797c4 ("block: Abstract out bvec iterator") from the block tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc include/trace/events/f2fs.h
index 204fcc3201b1,bd3ee4fbe7a7..000000000000
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@@ -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)
  );

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2013-11-26  0:56 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2013-11-26  0:56 UTC (permalink / raw)
  To: Jens Axboe, Jaegeuk Kim; +Cc: linux-next, linux-kernel, Kent Overstreet

[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]

Hi Jens,

Today's linux-next merge of the block tree got a conflict in
fs/f2fs/segment.c between commit a79ad49b87f4 ("f2fs: introduce a bio
array for per-page write bios") from the f2fs tree and commit
4f024f3797c4 ("block: Abstract out bvec iterator") from the block tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/f2fs/segment.c
index 1c84b7e15631,36e8afd8e1e4..000000000000
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@@ -908,9 -681,9 +906,9 @@@ retry
  		}
  
  		bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
 -		sbi->bio[type] = f2fs_bio_alloc(bdev, bio_blocks);
 -		sbi->bio[type]->bi_iter.bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
 -		sbi->bio[type]->bi_private = priv;
 +		io->bio = f2fs_bio_alloc(bdev, bio_blocks);
- 		io->bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
++		io->bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
 +		io->bio->bi_private = priv;
  		/*
  		 * The end_io will be assigned at the sumbission phase.
  		 * Until then, let bio_add_page() merge consecutive IOs as much

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* linux-next: manual merge of the block tree with the f2fs tree
@ 2013-11-01  3:29 Stephen Rothwell
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Rothwell @ 2013-11-01  3:29 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-next, linux-kernel, Kent Overstreet, Chao Yu, Jaegeuk Kim

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

Hi Jens,

Today's linux-next merge of the block tree got a conflict in
fs/f2fs/segment.c between commit cc7b1bb17367 ("f2fs: avoid allocating
failure in bio_alloc") from the f2fs tree and commit ed2d2f9a8265
("block: Abstract out bvec iterator") from the block tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/f2fs/segment.c
index 3d4d5fc19e6f,9d77ce168676..000000000000
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@@ -675,9 -676,8 +675,9 @@@ retry
  			goto retry;
  		}
  
 -		sbi->bio[type] = f2fs_bio_alloc(bdev, max_hw_blocks(sbi));
 +		bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
 +		sbi->bio[type] = f2fs_bio_alloc(bdev, bio_blocks);
- 		sbi->bio[type]->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
+ 		sbi->bio[type]->bi_iter.bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
  		sbi->bio[type]->bi_private = priv;
  		/*
  		 * The end_io will be assigned at the sumbission phase.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-12-17  1:51 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-06  6:03 linux-next: manual merge of the block tree with the f2fs tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2020-12-03  3:43 Stephen Rothwell
2020-12-03  3:47 ` Chao Yu
2020-12-03  3:57 ` Stephen Rothwell
2020-12-14 20:12 ` Stephen Rothwell
2020-12-17  1:50   ` Stephen Rothwell
2016-11-22  3:42 Stephen Rothwell
2016-07-11  4:52 Stephen Rothwell
2016-06-20  2:37 Stephen Rothwell
2016-06-09  3:26 Stephen Rothwell
2016-06-09  3:34 ` Stephen Rothwell
2015-07-30  3:19 Stephen Rothwell
2013-12-18  3:57 Stephen Rothwell
2013-12-12  2:57 Stephen Rothwell
2013-12-02  4:04 Stephen Rothwell
2013-11-26  1:00 Stephen Rothwell
2013-11-26  0:56 Stephen Rothwell
2013-11-01  3:29 Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).