On 09/05/2012 03:59 AM, Shentino wrote:
>  I am not sure that doing "sed</dev/sdX>/dev/sdX ..." is the right thing to
>  do, because it rewrites the full disk. This means that:
>  - it takes a lot of time
>  - you don't have any control about which part of the disk you change: what
>  happens if sed write a block which is update in parallel by BTRFS ?
Which is one reason I used a sha1 hash of a random read as the search key :P

This doesn't change. The race would be the following:

1- kernel read a sector from the disk
2- sed read a sector from the disk
3- sed write a sector to the disk (the same data or an update one doesn't matter)
4- kernel write an update sector to the disk

If 3 and 4 are different data the results are unpredictable. Yes it is a very unlikely case, but it could happens.


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to