All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: Add self-tests for btrfs_rmap_block
Date: Fri, 10 Jan 2020 16:46:20 +0200	[thread overview]
Message-ID: <d24de3e2-719f-e656-7d75-e5b258eb449b@suse.com> (raw)
In-Reply-To: <20200102154032.GJ3929@twin.jikos.cz>



On 2.01.20 г. 17:40 ч., David Sterba wrote:
> On Tue, Dec 10, 2019 at 08:00:45PM +0200, Nikolay Borisov wrote:
>> This is enough to exercise out of boundary address exclusion as well as
>> address matching.
>>
>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
>> ---
>> V2:
>>  * Adjusted comments about some members of struct rmap_test_vector
>>  * Fixed inline comments
>>  * Correctly handle error when initialising dummy device
>>  * Other minor cosmetic changes around comments/braces for single statement 'if'
>>  and structure initialization
> 
> I still found issues unfixed from v1 and some that I did not notice
> before
> 
>>  fs/btrfs/tests/extent-map-tests.c | 146 +++++++++++++++++++++++++++++-
>>  1 file changed, 145 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c
>> index 4a7f796c9900..4878904434af 100644
>> --- a/fs/btrfs/tests/extent-map-tests.c
>> +++ b/fs/btrfs/tests/extent-map-tests.c
>> @@ -6,6 +6,10 @@
>>  #include <linux/types.h>
>>  #include "btrfs-tests.h"
>>  #include "../ctree.h"
>> +#include "../volumes.h"
>> +#include "../disk-io.h"
>> +#include "../block-group.h"
>> +
> 
> Extra newline
> 
>>
>>  static void free_extent_map_tree(struct extent_map_tree *em_tree)
>>  {
>> @@ -437,11 +441,144 @@ static int test_case_4(struct btrfs_fs_info *fs_info,
>>  	return ret;
>>  }
>>
>> +struct rmap_test_vector {
>> +	u64 raid_type;
>> +	u64 physical_start;
>> +	u64 data_stripe_size;
>> +	u64 num_data_stripes;
>> +	u64 num_stripes;
>> +	/* Assume we won't have more than 5 physical stripes */
>> +	u64 data_stripe_phys_start[5];
>> +	int expected_mapped_addr;
> 
> This should be bool

Actually the idea here is for expected_mapped_addr to contains the
number of addresses we are expected to map. Currently tests only expect
0 or 1 but if tests are expanded in the future  this might be 2 or 3.

THe body of the test does:

 if (out_ndaddrs != test->expected_mapped_addr) {
                  for (i = 0; i < out_ndaddrs; i++)

                          test_msg("Mapped %llu", logical[i]);


<snip>
>>  int btrfs_test_extent_map(void)
>>  {
>>  	struct btrfs_fs_info *fs_info = NULL;
>>  	struct extent_map_tree *em_tree;
>> -	int ret = 0;
>> +	int ret = 0, i;
>> +	struct rmap_test_vector rmap_tests[] = {
>> +		{
>> +			/*
>> +			 * Tests a chunk with 2 data stripes one of which
>> +			 * interesects the physical address of the super block
>> +			 * is correctly recognised.
>> +			 */
>> +			.raid_type = BTRFS_BLOCK_GROUP_RAID1,
>> +			.physical_start = SZ_64M - SZ_4M,
>> +			.data_stripe_size = SZ_256M,
>> +			.num_data_stripes = 2,
>> +			.num_stripes = 2,
>> +			.data_stripe_phys_start = {SZ_64M - SZ_4M, SZ_64M - SZ_4M + SZ_256M},
> 
> Formatting


What do you mean?

<snip>

  reply	other threads:[~2020-01-10 14:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 12:05 [PATCH 0/6] Cleanup super block stripe exclusion code Nikolay Borisov
2019-11-19 12:05 ` [PATCH 1/6] btrfs: Move and unexport btrfs_rmap_block Nikolay Borisov
2019-11-26 15:53   ` David Sterba
2019-12-10 17:57     ` [PATCH v2] " Nikolay Borisov
2020-01-02 15:21       ` David Sterba
2019-11-19 12:05 ` [PATCH 2/6] btrfs: selftests: Add support for dummy devices Nikolay Borisov
2019-11-19 12:05 ` [PATCH 3/6] btrfs: Add self-tests for btrfs_rmap_block Nikolay Borisov
2019-11-26 16:04   ` David Sterba
2019-12-10 18:00     ` [PATCH v2] " Nikolay Borisov
2020-01-02 15:40       ` David Sterba
2020-01-10 14:46         ` Nikolay Borisov [this message]
2020-01-14 16:51           ` David Sterba
2019-11-19 12:05 ` [PATCH 4/6] btrfs: Refactor btrfs_rmap_block to improve readability Nikolay Borisov
2019-11-19 12:05 ` [PATCH 5/6] btrfs: Read stripe len directly in btrfs_rmap_block Nikolay Borisov
2020-01-14 16:54   ` David Sterba
2020-01-15 10:52     ` Nikolay Borisov
2019-11-19 12:05 ` [PATCH 6/6] btrfs: Remove dead code exclude_super_stripes Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d24de3e2-719f-e656-7d75-e5b258eb449b@suse.com \
    --to=nborisov@suse.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.