Btrfs: remove deprecated comments

commit d53ba47484ed6245e640ee4bfe9d21e9bfc15765
(Btrfs: use commit root when loading free space cache) has remove
the deadlock check, and the related comments can be removed as well.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: kill unused arguments of cache_block_group

Argument 'trans' and 'root' are not used any more.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: kill unused argument of update_block_group

Argument 'trans' is not used any more.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: kill unused argument of btrfs_pin_extent_for_log_replay

Argument 'trans' is not used any more.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: use token to avoid times mapping extent buffer

The API in tree log code has done sort of changes, and it proves that
we can benifit from using token, so do the same thing here.

function_graph tracer's timer shows that it costs nearly half time
of before(39.788us -> 22.391us).

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: save us a read_lock

This does not change the logic of code, but can save us a read_lock.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: record first logical byte in memory

This'd save us a rbtree search which may become expensive in large filesystem.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: let allocation start from the right raid type

This'd avoid us empty looping.

Say we have only one disk and the metadata raid type will be defaultly DUP,
and we do not need to start from index=0(RAID10) and get over two empty
loops to index=2(DUP).

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: fix off-by-one in two places

Lock end is inclusive.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: fix a bug when llseek for delalloc bytes behind prealloc extents

xfstests case 285 complains.

It it because btrfs did not try to find unwritten delalloc
bytes(only dirty pages, not yet writeback) behind prealloc
extents, it ends up finding nothing while we're with SEEK_DATA.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: use right range to find checksum for compressed extents

For compressed extents, the range of checksum is covered by disk length,
and the disk length is different with ram length, so we need to use disk
length instead to get us the right checksum.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: add leak debug for extent map

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Btrfs: fix memory leak on extent map after fsync

During fsync, we put the changed parts(i.e. extent map) into the log tree,
and we ship these parts from a list of modified_extents to a local list
to process, of course, we must increment the refs of the extent maps to
avoid it from getting evicted from cache.

The problem is
we don't hold the tree writer lock all the time of iterating the local list,
and it is possible that other threads hack in and delete the extent map from
the local list silently.  So we'll end up with memory leak here.

I hit this when testing xfstest 274 with mount options 'autodefrag,compress=zlib'.

With this fix, the memory leak has gone away.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>