All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC ONLY 0/8] btrfs: introduce raid-stripe-tree
@ 2022-05-16 14:31 Johannes Thumshirn
  2022-05-16 14:31 ` [RFC ONLY 1/8] btrfs: add raid stripe tree definitions Johannes Thumshirn
                   ` (10 more replies)
  0 siblings, 11 replies; 89+ messages in thread
From: Johannes Thumshirn @ 2022-05-16 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Johannes Thumshirn

Introduce a raid-stripe-tree to record writes in a RAID environment.

In essence this adds another address translation layer between the logical
and the physical addresses in btrfs and is designed to close two gaps. The
first is the ominous RAID-write-hole we suffer from with RAID5/6 and the
second one is the inability of doing RAID with zoned block devices due to the
constraints we have with REQ_OP_ZONE_APPEND writes.

Thsi is an RFC/PoC only which just shows how the code will look like for a
zoned RAID1. Its sole purpose is to facilitate design reviews and is not
intended to be merged yet. Or if merged to be used on an actual file-system.

Johannes Thumshirn (8):
  btrfs: add raid stripe tree definitions
  btrfs: move btrfs_io_context to volumes.h
  btrfs: read raid-stripe-tree from disk
  btrfs: add boilerplate code to insert raid extent
  btrfs: add code to delete raid extent
  btrfs: add code to read raid extent
  btrfs: zoned: allow zoned RAID1
  btrfs: add raid stripe tree pretty printer

 fs/btrfs/Makefile               |   2 +-
 fs/btrfs/ctree.c                |   1 +
 fs/btrfs/ctree.h                |  29 ++++
 fs/btrfs/disk-io.c              |  12 ++
 fs/btrfs/extent-tree.c          |   9 ++
 fs/btrfs/file.c                 |   1 -
 fs/btrfs/print-tree.c           |  21 +++
 fs/btrfs/raid-stripe-tree.c     | 251 ++++++++++++++++++++++++++++++++
 fs/btrfs/raid-stripe-tree.h     |  39 +++++
 fs/btrfs/volumes.c              |  44 +++++-
 fs/btrfs/volumes.h              |  93 ++++++------
 fs/btrfs/zoned.c                |  39 +++++
 include/uapi/linux/btrfs.h      |   1 +
 include/uapi/linux/btrfs_tree.h |  17 +++
 14 files changed, 509 insertions(+), 50 deletions(-)
 create mode 100644 fs/btrfs/raid-stripe-tree.c
 create mode 100644 fs/btrfs/raid-stripe-tree.h

-- 
2.35.1


^ permalink raw reply	[flat|nested] 89+ messages in thread
* Re: [RFC ONLY 4/8] btrfs: add boilerplate code to insert raid extent
@ 2022-05-18  0:54 kernel test robot
  0 siblings, 0 replies; 89+ messages in thread
From: kernel test robot @ 2022-05-18  0:54 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <35ea1d22a55d8dd30bc9f9dfcd4a48890bf7feaf.1652711187.git.johannes.thumshirn@wdc.com>
References: <35ea1d22a55d8dd30bc9f9dfcd4a48890bf7feaf.1652711187.git.johannes.thumshirn@wdc.com>
TO: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Hi Johannes,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on kdave/for-next]
[also build test WARNING on v5.18-rc7 next-20220517]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Johannes-Thumshirn/btrfs-introduce-raid-stripe-tree/20220516-223524
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
:::::: branch date: 34 hours ago
:::::: commit date: 34 hours ago
config: i386-randconfig-c001-20220516 (https://download.01.org/0day-ci/archive/20220518/202205180858.FMv6zofy-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> fs/btrfs/volumes.c:6675:5-24: atomic_dec_and_test variation before object free at line 6697.

vim +6675 fs/btrfs/volumes.c

8408c716d7a4ddd Miao Xie           2014-06-19  6634  
4246a0b63bd8f56 Christoph Hellwig  2015-07-20  6635  static void btrfs_end_bio(struct bio *bio)
8790d502e4401a4 Chris Mason        2008-04-03  6636  {
4c6646117912397 Qu Wenruo          2021-09-15  6637  	struct btrfs_io_context *bioc = bio->bi_private;
7d2b4daa6737996 Chris Mason        2008-08-05  6638  	int is_orig_bio = 0;
8790d502e4401a4 Chris Mason        2008-04-03  6639  
4e4cbee93d56137 Christoph Hellwig  2017-06-03  6640  	if (bio->bi_status) {
4c6646117912397 Qu Wenruo          2021-09-15  6641  		atomic_inc(&bioc->error);
4e4cbee93d56137 Christoph Hellwig  2017-06-03  6642  		if (bio->bi_status == BLK_STS_IOERR ||
4e4cbee93d56137 Christoph Hellwig  2017-06-03  6643  		    bio->bi_status == BLK_STS_TARGET) {
c3a3b19baceee1c Qu Wenruo          2021-09-15  6644  			struct btrfs_device *dev = btrfs_bio(bio)->device;
442a4f6308e694e Stefan Behrens     2012-05-25  6645  
3eee86c8fd9a9cd Nikolay Borisov    2020-07-02  6646  			ASSERT(dev->bdev);
cfe94440d174044 Naohiro Aota       2021-02-04  6647  			if (btrfs_op(bio) == BTRFS_MAP_WRITE)
1cb34c8ecd46239 Anand Jain         2017-10-21  6648  				btrfs_dev_stat_inc_and_print(dev,
442a4f6308e694e Stefan Behrens     2012-05-25  6649  						BTRFS_DEV_STAT_WRITE_ERRS);
0cc068e6ee59c1f David Sterba       2019-03-07  6650  			else if (!(bio->bi_opf & REQ_RAHEAD))
1cb34c8ecd46239 Anand Jain         2017-10-21  6651  				btrfs_dev_stat_inc_and_print(dev,
442a4f6308e694e Stefan Behrens     2012-05-25  6652  						BTRFS_DEV_STAT_READ_ERRS);
70fd76140a6cb63 Christoph Hellwig  2016-11-01  6653  			if (bio->bi_opf & REQ_PREFLUSH)
1cb34c8ecd46239 Anand Jain         2017-10-21  6654  				btrfs_dev_stat_inc_and_print(dev,
442a4f6308e694e Stefan Behrens     2012-05-25  6655  						BTRFS_DEV_STAT_FLUSH_ERRS);
442a4f6308e694e Stefan Behrens     2012-05-25  6656  		}
442a4f6308e694e Stefan Behrens     2012-05-25  6657  	}
8790d502e4401a4 Chris Mason        2008-04-03  6658  
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6659  	if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6660  		int i;
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6661  
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6662  		for (i = 0; i < bioc->num_stripes; i++) {
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6663  			if (bioc->stripes[i].dev->bdev != bio->bi_bdev)
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6664  				continue;
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6665  			bioc->stripes[i].physical = bio->bi_iter.bi_sector << SECTOR_SHIFT;
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6666  		}
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6667  	}
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6668  
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6669  
4c6646117912397 Qu Wenruo          2021-09-15  6670  	if (bio == bioc->orig_bio)
7d2b4daa6737996 Chris Mason        2008-08-05  6671  		is_orig_bio = 1;
7d2b4daa6737996 Chris Mason        2008-08-05  6672  
4c6646117912397 Qu Wenruo          2021-09-15  6673  	btrfs_bio_counter_dec(bioc->fs_info);
c404e0dc2c843b1 Miao Xie           2014-01-30  6674  
4c6646117912397 Qu Wenruo          2021-09-15 @6675  	if (atomic_dec_and_test(&bioc->stripes_pending)) {
7d2b4daa6737996 Chris Mason        2008-08-05  6676  		if (!is_orig_bio) {
7d2b4daa6737996 Chris Mason        2008-08-05  6677  			bio_put(bio);
4c6646117912397 Qu Wenruo          2021-09-15  6678  			bio = bioc->orig_bio;
7d2b4daa6737996 Chris Mason        2008-08-05  6679  		}
c7b22bb19a24fef Muthu Kumar        2014-01-08  6680  
c3a3b19baceee1c Qu Wenruo          2021-09-15  6681  		btrfs_bio(bio)->mirror_num = bioc->mirror_num;
a236aed14ccb066 Chris Mason        2008-04-29  6682  		/* only send an error to the higher layers if it is
53b381b3abeb86f David Woodhouse    2013-01-29  6683  		 * beyond the tolerance of the btrfs bio
a236aed14ccb066 Chris Mason        2008-04-29  6684  		 */
4c6646117912397 Qu Wenruo          2021-09-15  6685  		if (atomic_read(&bioc->error) > bioc->max_errors) {
4e4cbee93d56137 Christoph Hellwig  2017-06-03  6686  			bio->bi_status = BLK_STS_IOERR;
5dbc8fca8ef5d71 Chris Mason        2011-12-09  6687  		} else {
1259ab75c62462b Chris Mason        2008-05-12  6688  			/*
1259ab75c62462b Chris Mason        2008-05-12  6689  			 * this bio is actually up to date, we didn't
1259ab75c62462b Chris Mason        2008-05-12  6690  			 * go over the max number of errors
1259ab75c62462b Chris Mason        2008-05-12  6691  			 */
2dbe0c77186c691 Anand Jain         2017-10-14  6692  			bio->bi_status = BLK_STS_OK;
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6693  
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6694  			if (btrfs_op(bio) == BTRFS_MAP_WRITE &&
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6695  			    btrfs_need_stripe_tree_update(bioc)) {
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6696  				btrfs_get_bioc(bioc);
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16 @6697  				schedule_work(&bioc->stripe_update_work);
9f3dc6ab67cbdb8 Johannes Thumshirn 2022-05-16  6698  			}
1259ab75c62462b Chris Mason        2008-05-12  6699  		}
c55f13964008bfe Miao Xie           2014-06-19  6700  
4c6646117912397 Qu Wenruo          2021-09-15  6701  		btrfs_end_bioc(bioc, bio);
7d2b4daa6737996 Chris Mason        2008-08-05  6702  	} else if (!is_orig_bio) {
8790d502e4401a4 Chris Mason        2008-04-03  6703  		bio_put(bio);
8790d502e4401a4 Chris Mason        2008-04-03  6704  	}
8790d502e4401a4 Chris Mason        2008-04-03  6705  }
8790d502e4401a4 Chris Mason        2008-04-03  6706  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

end of thread, other threads:[~2022-07-25 21:33 UTC | newest]

Thread overview: 89+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 14:31 [RFC ONLY 0/8] btrfs: introduce raid-stripe-tree Johannes Thumshirn
2022-05-16 14:31 ` [RFC ONLY 1/8] btrfs: add raid stripe tree definitions Johannes Thumshirn
2022-05-17  7:39   ` Qu Wenruo
2022-05-17  7:45     ` Johannes Thumshirn
2022-05-17  7:56       ` Qu Wenruo
2022-05-16 14:31 ` [RFC ONLY 2/8] btrfs: move btrfs_io_context to volumes.h Johannes Thumshirn
2022-05-17  7:42   ` Qu Wenruo
2022-05-17  7:51     ` Johannes Thumshirn
2022-05-17  7:58       ` Qu Wenruo
2022-05-17  8:01         ` Johannes Thumshirn
2022-05-16 14:31 ` [RFC ONLY 3/8] btrfs: read raid-stripe-tree from disk Johannes Thumshirn
2022-05-17  8:09   ` Qu Wenruo
2022-05-17  8:13     ` Johannes Thumshirn
2022-05-17  8:28       ` Qu Wenruo
2022-05-18 11:29         ` Johannes Thumshirn
2022-05-19  8:36           ` Qu Wenruo
2022-05-19  8:39             ` Johannes Thumshirn
2022-05-19 10:37               ` Qu Wenruo
2022-05-19 11:44                 ` Johannes Thumshirn
2022-05-19 11:48                   ` Qu Wenruo
2022-05-19 11:53                     ` Johannes Thumshirn
2022-05-19 13:26                       ` Qu Wenruo
2022-05-19 13:49                         ` Johannes Thumshirn
2022-05-19 22:56                           ` Qu Wenruo
2022-05-20  8:27                             ` Johannes Thumshirn
2022-05-16 14:31 ` [RFC ONLY 4/8] btrfs: add boilerplate code to insert raid extent Johannes Thumshirn
2022-05-17  7:53   ` Qu Wenruo
2022-05-17  8:00   ` Qu Wenruo
2022-05-17  8:05     ` Johannes Thumshirn
2022-05-17  8:09       ` Qu Wenruo
2022-05-16 14:31 ` [RFC ONLY 5/8] btrfs: add code to delete " Johannes Thumshirn
2022-05-17  8:06   ` Qu Wenruo
2022-05-17  8:10     ` Johannes Thumshirn
2022-05-17  8:14       ` Qu Wenruo
2022-05-17  8:20         ` Johannes Thumshirn
2022-05-17  8:31           ` Qu Wenruo
2022-05-16 14:31 ` [RFC ONLY 6/8] btrfs: add code to read " Johannes Thumshirn
2022-05-16 14:55   ` Josef Bacik
2022-05-16 14:31 ` [RFC ONLY 7/8] btrfs: zoned: allow zoned RAID1 Johannes Thumshirn
2022-05-16 14:31 ` [RFC ONLY 8/8] btrfs: add raid stripe tree pretty printer Johannes Thumshirn
2022-05-16 14:58 ` [RFC ONLY 0/8] btrfs: introduce raid-stripe-tree Josef Bacik
2022-05-16 15:04   ` Johannes Thumshirn
2022-05-16 15:10     ` Josef Bacik
2022-05-16 15:47       ` Johannes Thumshirn
2022-05-17  7:23 ` Nikolay Borisov
2022-05-17  7:31   ` Qu Wenruo
2022-05-17  7:41     ` Johannes Thumshirn
2022-05-17  7:32   ` Johannes Thumshirn
2022-07-13 10:54 ` RAID56 discussion related to RST. (Was "Re: [RFC ONLY 0/8] btrfs: introduce raid-stripe-tree") Qu Wenruo
2022-07-13 11:43   ` Johannes Thumshirn
2022-07-13 12:01     ` Qu Wenruo
2022-07-13 12:42       ` Johannes Thumshirn
2022-07-13 13:47         ` Qu Wenruo
2022-07-13 14:01           ` Johannes Thumshirn
2022-07-13 15:24             ` Lukas Straub
2022-07-13 15:28               ` Johannes Thumshirn
2022-07-14  1:08             ` Qu Wenruo
2022-07-14  7:08               ` Johannes Thumshirn
2022-07-14  7:32                 ` Qu Wenruo
2022-07-14  7:46                   ` Johannes Thumshirn
2022-07-14  7:53                     ` Qu Wenruo
2022-07-15 17:54                     ` Goffredo Baroncelli
2022-07-15 19:08                       ` Thiago Ramon
2022-07-16  0:34                         ` Qu Wenruo
2022-07-16 11:11                           ` Qu Wenruo
2022-07-16 13:52                             ` Thiago Ramon
2022-07-16 14:26                               ` Goffredo Baroncelli
2022-07-17 17:58                                 ` Goffredo Baroncelli
2022-07-17  0:30                               ` Qu Wenruo
2022-07-17 15:18                                 ` Thiago Ramon
2022-07-17 22:01                                   ` Qu Wenruo
2022-07-17 23:00                           ` Zygo Blaxell
2022-07-18  1:04                             ` Qu Wenruo
2022-07-15 20:14                       ` Chris Murphy
2022-07-18  7:33                         ` Johannes Thumshirn
2022-07-18  8:03                           ` Qu Wenruo
2022-07-18 21:49                         ` Forza
2022-07-19  1:19                           ` Qu Wenruo
2022-07-21 14:51                             ` Forza
2022-07-24 11:27                               ` Qu Wenruo
2022-07-25  0:00                             ` Zygo Blaxell
2022-07-25  0:25                               ` Qu Wenruo
2022-07-25  5:41                                 ` Zygo Blaxell
2022-07-25  7:49                                   ` Qu Wenruo
2022-07-25 19:58                               ` Goffredo Baroncelli
2022-07-25 21:29                                 ` Qu Wenruo
2022-07-18  7:30                       ` Johannes Thumshirn
2022-07-19 18:58                         ` Goffredo Baroncelli
2022-05-18  0:54 [RFC ONLY 4/8] btrfs: add boilerplate code to insert raid extent kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.