> On Jun 28, 2018, at 7:45 PM, Theodore Y. Ts'o <tytso@xxxxxxx> wrote: > > On Thu, Jun 28, 2018 at 06:07:47PM -0600, Andreas Dilger wrote: >>> But does an RDMA operation actually do a block allocation? Really? >>> And if it is willing to do a block allocation, why is it not willing >>> to bump i_size? >> >> It's not that the RDMA does block allocation, but rather that the RDMA >> always transfers and writes the full PAGE_SIZE of data, even if i_size >> is less than the end of the last block. This simplifies the RDMA code >> so that it can always write the data instead of having to stop at i_size. > > Right. So there are two choices: > > 1) Keep the blocks beyond i_size marked as uninitialized. You > transfer and write the full PAGE_SIZE of data, but it simply will > never be available to the user. > > 2) Zero the page, write it out to the file, and then extend i_size and > mark the extents as uninitialized. The end of the page would already be zeroed before write. > Why is it that Lustre is choosing to keep i_size where it is, but to > mark the blocks beyond it as initialized? This isn't about initialized vs. uninitialized extents. It is only about allocated vs. unallocated blocks, possibly with block-mapped files. There is no way to have uninitialized blocks with a block-mapped file. The code is checking whether there are any blocks allocated beyond i_size, and if there are, without the patch it considers i_size broken and extends it to the end of the last allocated block. The patch allows a small number of blocks to be allocated beyond i_size without triggering this heuristic. The only difference vs. the previous code is that it correctly calculates what the PAGE_SIZE aligned block number is (the old code assumed that lblock was the base-1 block number instead of the base-0 block number that it is). Cheers, Andreas
Attachment:
signature.asc
Description: Message signed with OpenPGP