All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: search parity device wisely
@ 2017-08-02 20:32 Liu Bo
  2017-08-03 11:56 ` kbuild test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Liu Bo @ 2017-08-02 20:32 UTC (permalink / raw)
  To: linux-btrfs

After mapping block with BTRFS_MAP_WRITE, parities have been sorted to
the end position, so this search can start from the first parity
stripe.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/raid56.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index d8ea0eb..0c5ed68 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -2225,12 +2225,13 @@ raid56_parity_alloc_scrub_rbio(struct btrfs_fs_info *fs_info, struct bio *bio,
 	ASSERT(!bio->bi_iter.bi_size);
 	rbio->operation = BTRFS_RBIO_PARITY_SCRUB;
 
-	for (i = 0; i < rbio->real_stripes; i++) {
+	for (i = rbio->data_stripes; i < rbio->real_stripes; i++) {
 		if (bbio->stripes[i].dev == scrub_dev) {
 			rbio->scrubp = i;
 			break;
 		}
 	}
+	ASSERT(i < rbio->real_stripes);
 
 	/* Now we just support the sectorsize equals to page size */
 	ASSERT(fs_info->sectorsize == PAGE_SIZE);
-- 
2.9.4


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

* Re: [PATCH] Btrfs: search parity device wisely
  2017-08-02 20:32 [PATCH] Btrfs: search parity device wisely Liu Bo
@ 2017-08-03 11:56 ` kbuild test robot
  2017-08-03 12:02 ` kbuild test robot
  2017-08-03 19:53 ` [PATCH v2] " Liu Bo
  2 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2017-08-03 11:56 UTC (permalink / raw)
  To: Liu Bo; +Cc: kbuild-all, linux-btrfs

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

Hi Liu,

[auto build test ERROR on v4.13-rc3]
[also build test ERROR on next-20170803]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Liu-Bo/Btrfs-search-parity-device-wisely/20170803-193103
config: x86_64-randconfig-x007-201731 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   fs/btrfs/raid56.c: In function 'raid56_parity_alloc_scrub_rbio':
>> fs/btrfs/raid56.c:2232:15: error: 'struct btrfs_raid_bio' has no member named 'data_stripes'; did you mean 'real_stripes'?
     for (i = rbio->data_stripes; i < rbio->real_stripes; i++) {
                  ^~

vim +2232 fs/btrfs/raid56.c

  2201	
  2202	/*
  2203	 * The following code is used to scrub/replace the parity stripe
  2204	 *
  2205	 * Caller must have already increased bio_counter for getting @bbio.
  2206	 *
  2207	 * Note: We need make sure all the pages that add into the scrub/replace
  2208	 * raid bio are correct and not be changed during the scrub/replace. That
  2209	 * is those pages just hold metadata or file data with checksum.
  2210	 */
  2211	
  2212	struct btrfs_raid_bio *
  2213	raid56_parity_alloc_scrub_rbio(struct btrfs_fs_info *fs_info, struct bio *bio,
  2214				       struct btrfs_bio *bbio, u64 stripe_len,
  2215				       struct btrfs_device *scrub_dev,
  2216				       unsigned long *dbitmap, int stripe_nsectors)
  2217	{
  2218		struct btrfs_raid_bio *rbio;
  2219		int i;
  2220	
  2221		rbio = alloc_rbio(fs_info, bbio, stripe_len);
  2222		if (IS_ERR(rbio))
  2223			return NULL;
  2224		bio_list_add(&rbio->bio_list, bio);
  2225		/*
  2226		 * This is a special bio which is used to hold the completion handler
  2227		 * and make the scrub rbio is similar to the other types
  2228		 */
  2229		ASSERT(!bio->bi_iter.bi_size);
  2230		rbio->operation = BTRFS_RBIO_PARITY_SCRUB;
  2231	
> 2232		for (i = rbio->data_stripes; i < rbio->real_stripes; i++) {
  2233			if (bbio->stripes[i].dev == scrub_dev) {
  2234				rbio->scrubp = i;
  2235				break;
  2236			}
  2237		}
  2238		ASSERT(i < rbio->real_stripes);
  2239	
  2240		/* Now we just support the sectorsize equals to page size */
  2241		ASSERT(fs_info->sectorsize == PAGE_SIZE);
  2242		ASSERT(rbio->stripe_npages == stripe_nsectors);
  2243		bitmap_copy(rbio->dbitmap, dbitmap, stripe_nsectors);
  2244	
  2245		/*
  2246		 * We have already increased bio_counter when getting bbio, record it
  2247		 * so we can free it at rbio_orig_end_io().
  2248		 */
  2249		rbio->generic_bio_cnt = 1;
  2250	
  2251		return rbio;
  2252	}
  2253	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 22763 bytes --]

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

* Re: [PATCH] Btrfs: search parity device wisely
  2017-08-02 20:32 [PATCH] Btrfs: search parity device wisely Liu Bo
  2017-08-03 11:56 ` kbuild test robot
@ 2017-08-03 12:02 ` kbuild test robot
  2017-08-03 19:53 ` [PATCH v2] " Liu Bo
  2 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2017-08-03 12:02 UTC (permalink / raw)
  To: Liu Bo; +Cc: kbuild-all, linux-btrfs

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

Hi Liu,

[auto build test ERROR on v4.13-rc3]
[also build test ERROR on next-20170803]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Liu-Bo/Btrfs-search-parity-device-wisely/20170803-193103
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   fs/btrfs/raid56.c: In function 'raid56_parity_alloc_scrub_rbio':
>> fs/btrfs/raid56.c:2232:15: error: 'struct btrfs_raid_bio' has no member named 'data_stripes'
     for (i = rbio->data_stripes; i < rbio->real_stripes; i++) {
                  ^

vim +2232 fs/btrfs/raid56.c

  2201	
  2202	/*
  2203	 * The following code is used to scrub/replace the parity stripe
  2204	 *
  2205	 * Caller must have already increased bio_counter for getting @bbio.
  2206	 *
  2207	 * Note: We need make sure all the pages that add into the scrub/replace
  2208	 * raid bio are correct and not be changed during the scrub/replace. That
  2209	 * is those pages just hold metadata or file data with checksum.
  2210	 */
  2211	
  2212	struct btrfs_raid_bio *
  2213	raid56_parity_alloc_scrub_rbio(struct btrfs_fs_info *fs_info, struct bio *bio,
  2214				       struct btrfs_bio *bbio, u64 stripe_len,
  2215				       struct btrfs_device *scrub_dev,
  2216				       unsigned long *dbitmap, int stripe_nsectors)
  2217	{
  2218		struct btrfs_raid_bio *rbio;
  2219		int i;
  2220	
  2221		rbio = alloc_rbio(fs_info, bbio, stripe_len);
  2222		if (IS_ERR(rbio))
  2223			return NULL;
  2224		bio_list_add(&rbio->bio_list, bio);
  2225		/*
  2226		 * This is a special bio which is used to hold the completion handler
  2227		 * and make the scrub rbio is similar to the other types
  2228		 */
  2229		ASSERT(!bio->bi_iter.bi_size);
  2230		rbio->operation = BTRFS_RBIO_PARITY_SCRUB;
  2231	
> 2232		for (i = rbio->data_stripes; i < rbio->real_stripes; i++) {
  2233			if (bbio->stripes[i].dev == scrub_dev) {
  2234				rbio->scrubp = i;
  2235				break;
  2236			}
  2237		}
  2238		ASSERT(i < rbio->real_stripes);
  2239	
  2240		/* Now we just support the sectorsize equals to page size */
  2241		ASSERT(fs_info->sectorsize == PAGE_SIZE);
  2242		ASSERT(rbio->stripe_npages == stripe_nsectors);
  2243		bitmap_copy(rbio->dbitmap, dbitmap, stripe_nsectors);
  2244	
  2245		/*
  2246		 * We have already increased bio_counter when getting bbio, record it
  2247		 * so we can free it at rbio_orig_end_io().
  2248		 */
  2249		rbio->generic_bio_cnt = 1;
  2250	
  2251		return rbio;
  2252	}
  2253	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 50920 bytes --]

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

* [PATCH v2] Btrfs: search parity device wisely
  2017-08-02 20:32 [PATCH] Btrfs: search parity device wisely Liu Bo
  2017-08-03 11:56 ` kbuild test robot
  2017-08-03 12:02 ` kbuild test robot
@ 2017-08-03 19:53 ` Liu Bo
  2017-09-07 18:39   ` David Sterba
  2 siblings, 1 reply; 5+ messages in thread
From: Liu Bo @ 2017-08-03 19:53 UTC (permalink / raw)
  To: linux-btrfs

After mapping block with BTRFS_MAP_WRITE, parities have been sorted to
the end position, so this search can start from the first parity
stripe.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: fix typo (data_stripes -> nr_data).

 fs/btrfs/raid56.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 2086383..88a5b7b 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -2229,12 +2229,13 @@ raid56_parity_alloc_scrub_rbio(struct btrfs_fs_info *fs_info, struct bio *bio,
 	ASSERT(!bio->bi_iter.bi_size);
 	rbio->operation = BTRFS_RBIO_PARITY_SCRUB;
 
-	for (i = 0; i < rbio->real_stripes; i++) {
+	for (i = rbio->nr_data; i < rbio->real_stripes; i++) {
 		if (bbio->stripes[i].dev == scrub_dev) {
 			rbio->scrubp = i;
 			break;
 		}
 	}
+	ASSERT(i < rbio->real_stripes);
 
 	/* Now we just support the sectorsize equals to page size */
 	ASSERT(fs_info->sectorsize == PAGE_SIZE);
-- 
2.9.4


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

* Re: [PATCH v2] Btrfs: search parity device wisely
  2017-08-03 19:53 ` [PATCH v2] " Liu Bo
@ 2017-09-07 18:39   ` David Sterba
  0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2017-09-07 18:39 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs

On Thu, Aug 03, 2017 at 01:53:31PM -0600, Liu Bo wrote:
> After mapping block with BTRFS_MAP_WRITE, parities have been sorted to
> the end position, so this search can start from the first parity
> stripe.
> 
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>

Reviewed-by: David Sterba <dsterba@suse.com>

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

end of thread, other threads:[~2017-09-07 18:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-02 20:32 [PATCH] Btrfs: search parity device wisely Liu Bo
2017-08-03 11:56 ` kbuild test robot
2017-08-03 12:02 ` kbuild test robot
2017-08-03 19:53 ` [PATCH v2] " Liu Bo
2017-09-07 18:39   ` David Sterba

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.