Re: [PATCH] reiser4: precise discard - general case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/12/2015 07:14 AM, Ivan Shapovalov wrote:
You mean that sometimes we perform unneeded checks?
I see nothing criminal, as we don't exceed announced (2N_e)
number of checks, where N_e is number of extents in the
discard set.
No, I didn't talk about that.

As to fixup: I think that we need to set up the local variable
head_is_known_dirty properly..
Hmm, head_is_known_dirty is an optimization: either known dirty
(in which case we skip checking and cut the head), or unknown
(in which case we do the check).

I'm talking about a different scenario:
- tail padding of an extent is clean
- head padding of the next extent is clean
- these two paddings overlap in terms of disk blocks

In this case, the head padding check will yield false ("dirty") because
part of it has been already allocated for the tail padding, but in fact
it is clean. Thus a false negative: the head will be cut while it can be
padded.

Ah, you suspect non-preciseness (leak of "garbage")?

If tail padding of the current extent overlaps with the head padding of
the next extent, then the end of the current extent and the beginning
of the next extent are in the same erase unit. Otherwise we'll end with
contradiction. Correct?
Correct, but I'm talking about a different situation where the end of the current extent and the beginning of the next extent are in distinct erase units but in the same disk block. Then we'll end up checking that disk block twice.


You correctly pointed out the possibility of garbage leak
in the case of block_size > erase_unit_size. However, the
current gluing policy prevents such leak.

Indeed, let AB be a current extent, and CD - next extent


----*-----*-----*-----*-----*-----*-----*---> units
--|-----------|-----------|-----------|-----> blocks
  A           B           C           D


Note that since extents are sorted and merged, distance
between any 2 extents are not smaller than block_size.
In particular, |BC| >= block_size.                           (1)

Suppose that tail padding of the current extent and head
padding of the next extent are in the same disk block.
However, in this case, in accordance with the definitions
of tail and head paddings, we have that |BC| <= block_size.   (2)

From (1) and (2) we have that |BC| == block_size, and
p_end + p_tailp == C == start-of-next-extent. Note, that
this satisfies the "gluing condition" (discard.c, line 362).
That is, we'll try to glue the current and the next extent.
It means that we'll check BC only once:

If BC is dirty, than gluing failed, and we don't allocate BC.

If BC is clean, than we allocate BC, jump to the next
extent and don't check its head padding (because it was
"glued" with the previous one).

Did I miss something?

Thanks,
Edward.
--
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux