Wang, Zhiye posted on Mon, 12 Oct 2015 04:37:55 +0000 as excerpted: > I guess we cannot write to block device directly after get block list > using FIEMAP. This is because: > > 1. COW feature of btrfs (but this can be disabled using NOCOW) I'm a user not a dev and many of the specifics of this discussion will with little doubt be above my head, but a warning on this assumption, just in case you overlooked it... Btrfs' snapshot feature conflicts with nocow, because a snapshot locks in place existing extents, relying on cow for any rewrite, to write the new blocks elsewhere. So what happens when a nocow file is snapshotted and then written into? Simple enough, it's effectively cow1. That is, the first write to a particular block of a nocow file after a snapshot will still cow it, but the file retains its nocow attribute, and further writes to the same block will rewrite the block in its now existing new location... until the next snapshot locks that too in place, of course. Bottom line, in the presence of snapshotting, particularly scheduled snapshotting that the admin may have forgotten about and/or doesn't know the consequences of, you can't rely on nocow actually being absolute rewrite-in-place nocow. So just in case you weren't aware, don't assume what can't be assumed. =:^) -- Duncan - List replies preferred. No HTML msgs. "Every nonfree program has a lord, a master -- and if you use the program, he is your master." Richard Stallman -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
