In osc_brw_fini_request(), page needs decryption only if it
is not empty. To check this, use ZERO_PAGE macro available
for all architectures, and compare with memcmp.
It will likely be faster/more efficient than comparing the
words by hand as may use optimized CPU instructions or ASM code.
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I5e04b72790e8acbceb1989ba3659e170c0b11192
Reviewed-on: https://review.whamcloud.com/38918
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
}
for (idx = 0; idx < aa->aa_page_count; idx++) {
struct brw_page *pg = aa->aa_ppga[idx];
- __u64 *p, *q;
/* do not decrypt if page is all 0s */
- p = q = page_address(pg->pg);
- while (p - q < PAGE_SIZE / sizeof(*p)) {
- if (*p != 0)
- break;
- p++;
- }
- if (p - q == PAGE_SIZE / sizeof(*p)) {
+ if (memcmp(page_address(pg->pg),
+ page_address(ZERO_PAGE(0)),
+ PAGE_SIZE) == 0) {
/* if page is empty forward info to upper layers
* (ll_io_zero_page) by clearing PagePrivate2
*/