Re: linux-next: manual merge of the block tree with the f2fs tree
Hi all, On Tue, 15 Dec 2020 07:12:12 +1100 Stephen Rothwell wrote: > > On Thu, 3 Dec 2020 14:43:48 +1100 Stephen Rothwell > 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.. > > --- 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.. > > --- a/fs/f2fs/f2fs.h > > +++ b/fs/f2fs/f2fs.h > > diff --cc fs/f2fs/super.c > > index 47858e0c5e95,af9f449da64b.. > > --- 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 pgpqHrCAFyQTe.pgp Description: OpenPGP digital signature
Re: linux-next: manual merge of the block tree with the f2fs tree
Hi all, On Thu, 3 Dec 2020 14:43:48 +1100 Stephen Rothwell 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.. > --- 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.. > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > diff --cc fs/f2fs/super.c > index 47858e0c5e95,af9f449da64b.. > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c Just a reminder that the above conflict still exists. -- Cheers, Stephen Rothwell pgpB8sIJh3BGq.pgp Description: OpenPGP digital signature
Re: linux-next: manual merge of the block tree with the f2fs tree
Hi all, On Thu, 3 Dec 2020 14:43:48 +1100 Stephen Rothwell wrote: > > diff --cc fs/f2fs/checkpoint.c > index 14ba1519639e,54a1905af052.. > --- 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 pgpn7Vfp6VGPI.pgp Description: OpenPGP digital signature
Re: linux-next: manual merge of the block tree with the f2fs tree
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,
linux-next: manual merge of the block tree with the f2fs tree
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.. --- 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.. --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h diff --cc fs/f2fs/super.c index 47858e0c5e95,af9f449da64b.. --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c pgpU9ifFjHd3P.pgp Description: OpenPGP digital signature
linux-next: manual merge of the block tree with the f2fs tree
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.. --- 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;
linux-next: manual merge of the block tree with the f2fs tree
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.. --- 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;
linux-next: manual merge of the block tree with the f2fs tree
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.. --- 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(>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);
linux-next: manual merge of the block tree with the f2fs tree
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.. --- 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(>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);
linux-next: manual merge of the block tree with the f2fs tree
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.. --- 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(>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 -,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; }
linux-next: manual merge of the block tree with the f2fs tree
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.. --- 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(>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 -,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; }
Re: linux-next: manual merge of the block tree with the f2fs tree
Hi all, On Thu, 9 Jun 2016 13:26:09 +1000 Stephen Rothwellwrote: > > 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 ) fails. -- Cheers, Stephen Rothwell
Re: linux-next: manual merge of the block tree with the f2fs tree
Hi all, On Thu, 9 Jun 2016 13:26:09 +1000 Stephen Rothwell 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 ) fails. -- Cheers, Stephen Rothwell
linux-next: manual merge of the block tree with the f2fs tree
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(>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 -,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(>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(>submit_flush); bio_put(bio); return ret; }
linux-next: manual merge of the block tree with the f2fs tree
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(>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 -,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(>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(>submit_flush); bio_put(bio); return ret; }
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/data.c index 111f180fd1d2,8f0baa7ffb50.. --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@@ -27,7 -26,10 +27,7 @@@ #include "trace.h" #include - 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; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/data.c index 111f180fd1d2,8f0baa7ffb50.. --- 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; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/data.c index 63d190264a36,a2c8de8ba6ce.. --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@@ -24,195 -24,6 +24,192 @@@ #include "segment.h" #include +static void f2fs_read_end_io(struct bio *bio, int err) +{ - const int uptodate = test_bit(BIO_UPTODATE, >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(>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, >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(>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, >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(>cp_wait.task_list)) + wake_up(>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 = >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 = + submit_bio(rw, io->bio); + wait_for_completion(); + } else { + submit_bio(rw, io->bio); + } + } +
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/data.c index 63d190264a36,a2c8de8ba6ce.. --- 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); + } + } + +
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/data.c index 9bdacc6f9acc,a2c8de8ba6ce.. --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@@ -25,203 -25,6 +25,200 @@@ #include /* + * 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, >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(>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, >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(>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, >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(>cp_wait.task_list)) + wake_up(>cp_wait); + + bio_put(bio); +} + +static void __submit_merged_bio(struct f2fs_bio_info *io) +{ + struct f2fs_io_info *fio = >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 = + submit_bio(rw, io->bio); + wait_for_completion(); + } 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) ? >read_io : >write_io[btype]; + + mutex_lock(>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_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
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/data.c index 9bdacc6f9acc,a2c8de8ba6ce.. --- 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
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/data.c index 15956fa584de,a2c8de8ba6ce.. --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@@ -25,203 -25,6 +25,199 @@@ #include /* + * 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, >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(>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, >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(>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, >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(>cp_wait.task_list)) + wake_up(>cp_wait); + + bio_put(bio); +} + +static void __submit_merged_bio(struct f2fs_bio_info *io) +{ + struct f2fs_io_info *fio = >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 = + submit_bio(rw, io->bio); + wait_for_completion(); + } 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) ? >read_io : >write_io[btype]; + + mutex_lock(>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_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) +{ +
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/data.c index 15956fa584de,a2c8de8ba6ce.. --- 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) +{ +
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/data.c index 53e3a7ed,a2c8de8ba6ce..b62a99cf6561 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@@ -25,205 -25,6 +25,201 @@@ #include /* + * 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, >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(>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, >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(>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, >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(>cp_wait.task_list)) + wake_up(>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 = + submit_bio(rw, io->bio); + wait_for_completion(); + } 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) ? >read_io : >write_io[btype]; + + mutex_lock(>io_mutex); + __submit_merged_bio(sbi, io, type, sync, rw); +
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/data.c index 53e3a7ed,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); +
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc include/trace/events/f2fs.h index 204fcc3201b1,bd3ee4fbe7a7.. --- 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) ); pgp9xScaHpFNp.pgp Description: PGP signature
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/segment.c index 1c84b7e15631,36e8afd8e1e4.. --- 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 pgpOJXDnm4p7g.pgp Description: PGP signature
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/segment.c index 1c84b7e15631,36e8afd8e1e4.. --- 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 pgpOJXDnm4p7g.pgp Description: PGP signature
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc include/trace/events/f2fs.h index 204fcc3201b1,bd3ee4fbe7a7.. --- 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) ); pgp9xScaHpFNp.pgp Description: PGP signature
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/segment.c index 3d4d5fc19e6f,9d77ce168676.. --- 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. pgplxjUNqOcte.pgp Description: PGP signature
linux-next: manual merge of the block tree with the f2fs tree
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 Rothwells...@canb.auug.org.au diff --cc fs/f2fs/segment.c index 3d4d5fc19e6f,9d77ce168676.. --- 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. pgplxjUNqOcte.pgp Description: PGP signature