All of lore.kernel.org
 help / color / mirror / Atom feed
From: Goffredo Baroncelli <kreijack@inwind.it>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>,
	Qu Wenruo <quwenruo@cn.fujitsu.com>,
	linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz, Chris Mason <clm@fb.com>
Subject: Re: [PATCH 2/5] New btrfs command: "btrfs inspect physical-find"
Date: Fri, 29 Jul 2016 19:14:03 +0200	[thread overview]
Message-ID: <e9474e6a-d738-78e2-9b45-b6d1ba2f806b@inwind.it> (raw)
In-Reply-To: <5cc22a84-e8eb-3ef4-14a9-857430334069@gmx.com>

On 2016-07-29 08:44, Qu Wenruo wrote:
> 
> 
> On 07/29/2016 01:08 PM, Goffredo Baroncelli wrote:
>> On 2016-07-29 03:34, Qu Wenruo wrote:
>>>> I am not against about your proposal; however I have to point
>>>> out that the goal of these command was not to *traverse* the
>>>> file, but only to found the physical location of a file offset.
>>>> My use case was to simulate a corruption of a raid5 stripe
>>>> elements: for me it was sufficient to know the page position.
>>> 
>>> For corruption case, the best practice would be extending 
>>> btrfs-corrupt-block command.
>>> 
>>> And for your original proposal, to locate a page/sector
>>> containing the bytenr/offset, then the returned value should
>>> always be aligned to sectorsize. (And we need to state it clear
>>> in both man page and help string)
>>> 
>>> Unfortunately, that's not the case in current implementation.
>>> (And don't forget future subpage sector size, so in that case, we
>>> need to check sectorsize first.)
>>> 
>>> For example, if user passes a unaligned logical, physical-find
>>> will return the device offset unaligned.
>> 
>> For the other command (physical-dump), there is a check about the 
>> alignment; the reason was to simplify the dump of the content. 
>> However I don't understand to the reason to ask for the alignment 
>> even in the -find tool: why the output have to be aligned ? Which
>> is the difference if I return the first byte address of the file
>> than the 2nd or the 3rd (taking in account all the detail, which
>> for raid5/6 is not very easy....)
> 
> Since it's quite easy for user to assume such find tool will dump
> info for the range [offset, offset + 4K(or whatever)). In that
> unaligned case, user could get confused about if the tool will dump
> the 4K range, including the next stripe.


I am still confused: we are talking about three tools:

1) btrfs insp physical-find
it is definitely not page boundary dependent

2) btrfs insp physical-dump
this implementation is page boundary dependent; and its man-page clear
reported this limit; this constraint might be removed with
further development.

3) a new tool which dumps the physical location of the file contents. It may be 
an extension of 1) or a new development, but at this stage it is too early to talk
about this limit.

am I missing something ?

> 
> Just like map-logical.
> 
> So, if you only mean to dump the stripe info which contains the
> bytenr, then makes the doc more clear about the behavior.
> 
> Thanks, Qu
> 
> 
>> 
>>> 
>>> If only to locate the stripe/sector, at least returning a
>>> aligned number seems more reasonable.
>>> 
>>> IMHO if we only want a simple tool, then make it clear it's a
>>> just simple tool, and add limitation and explain to make it
>>> simple and won't accept any complext/unexpected input.
>>> 
>>> Or, make it handle unexpected and complex input well.
>>> 
>>> 
>>> BTW, long time ago, btrfs-map-logical is under the same
>>> situation, just a simple tool do off-line logical->device offset
>>> mapping. But it since it does provides offset/length pair
>>> options, it can cause wrong or uesless result for unaligned
>>> input. And we spent some time to improve it.
>>> 
>>> So I hope we can avoid such problem which has already happened
>>> in map-logical.
>> 
>> 
> 


-- 
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5

  reply	other threads:[~2016-07-29 17:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 17:43 [BTRFS-PROGS][PATCH][V2] Add two new commands: 'btrfs insp physical-find' and 'btrfs insp physical-dump' Goffredo Baroncelli
2016-07-27 17:43 ` [PATCH 1/5] Add some helper functions Goffredo Baroncelli
2016-07-28  1:03   ` Qu Wenruo
2016-07-27 17:43 ` [PATCH 2/5] New btrfs command: "btrfs inspect physical-find" Goffredo Baroncelli
2016-07-28  1:47   ` Qu Wenruo
2016-07-28 20:25     ` Goffredo Baroncelli
2016-07-29  1:34       ` Qu Wenruo
2016-07-29  5:08         ` Goffredo Baroncelli
2016-07-29  6:44           ` Qu Wenruo
2016-07-29 17:14             ` Goffredo Baroncelli [this message]
2016-07-30  1:04               ` Qu Wenruo
2016-07-27 17:43 ` [PATCH 3/5] new command btrfs inspect physical-dump Goffredo Baroncelli
2016-07-27 17:43 ` [PATCH 4/5] Add man page for command btrfs insp physical-find Goffredo Baroncelli
2016-07-27 17:43 ` [PATCH 5/5] Add new command to man pages: btrfs insp physical-dump Goffredo Baroncelli
2016-07-28 12:03 ` [BTRFS-PROGS][PATCH][V2] Add two new commands: 'btrfs insp physical-find' and 'btrfs insp physical-dump' David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2016-07-24 11:03 [BTRFS-PROGS][PATCH] " Goffredo Baroncelli
2016-07-24 11:03 ` [PATCH 2/5] New btrfs command: "btrfs inspect physical-find" Goffredo Baroncelli

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=e9474e6a-d738-78e2-9b45-b6d1ba2f806b@inwind.it \
    --to=kreijack@inwind.it \
    --cc=clm@fb.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=quwenruo@cn.fujitsu.com \
    /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.