Re: [PATCH v5 4/6] Btrfs: heuristic add detection of zeroed sample
From: Timofey Titovets <hidden>
Date: 2017-08-23 20:03:44
From: Timofey Titovets <hidden>
Date: 2017-08-23 20:03:44
2017-08-23 20:55 GMT+03:00 Diego Calleja [off-list ref]:
El miércoles, 23 de agosto de 2017 2:26:48 (CEST) Timofey Titovets escribió:quoted
+ for (i = 0; i < workspace->sample_size; i += sizeof(zero)) { + if (memcmp(&workspace->sample[i], &zero, sizeof(zero))) + return false;Instead of just checking for 0, wouldn't it be a better idea to check for any kind of repetitions? As in, iterate over the sample and memcmp() each part of sample with the previous one. The cost would be the same, and it would detect not just zeros, but any kind of repeated data. Is there any reason I'm missing for not doing this?
Thank you, i was not think about that, That approach seems better, i will update the patch. -- Have a nice day, Timofey.