]> www.infradead.org Git - users/jedix/linux-maple.git/commit
Btrfs: simplfy calculation of stripe length for discard operation
authorLi Zefan <lizf@cn.fujitsu.com>
Thu, 1 Dec 2011 06:06:42 +0000 (14:06 +0800)
committerGuru Anbalagane <guru.anbalagane@oracle.com>
Fri, 27 Jan 2012 01:20:48 +0000 (17:20 -0800)
commit9ec6aca633d955fc4c2336aec3a68c30055481c5
tree9e681ae5c5e146a4749c122945ab896874c97c18
parentd8ce5a452221748545a5e78e0c5b1e1f661a6cdf
Btrfs: simplfy calculation of stripe length for discard operation

For btrfs raid, while discarding a range of space, we'll need to know
the start offset and length to discard for each device, and it's done
in btrfs_map_block().

However the calculation is a bit complex for raid0 and raid10, so I
reimplement it based on a fact that:

        dev1          dev2           dev3    (raid0)
        -----------------------------------
        s0 s3 s6      s1 s4 s7       s2 s5

Each device has (total_stripes / nr_dev) stripes, or plus one.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
(cherry picked from commit ec9ef7a13be4dcce964c8503e8999087945e5b9e)
fs/btrfs/volumes.c