Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fuse: use offset_in_page() for page offset calculations

Replace open-coded (x & ~PAGE_MASK) with offset_in_page().

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Horst Birthelmer <hbirthelmer@ddn.com>
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

authored by

Joanne Koong and committed by
Miklos Szeredi
8d306cbf dcfd95cb

+4 -4
+4 -4
fs/fuse/readdir.c
··· 52 52 } 53 53 version = fi->rdc.version; 54 54 size = fi->rdc.size; 55 - offset = size & ~PAGE_MASK; 55 + offset = offset_in_page(size); 56 56 index = size >> PAGE_SHIFT; 57 57 /* Dirent doesn't fit in current page? Jump to next page. */ 58 58 if (offset + reclen > PAGE_SIZE) { ··· 392 392 void *addr, unsigned int size, 393 393 struct dir_context *ctx) 394 394 { 395 - unsigned int offset = ff->readdir.cache_off & ~PAGE_MASK; 395 + unsigned int offset = offset_in_page(ff->readdir.cache_off); 396 396 enum fuse_parse_result res = FOUND_NONE; 397 397 398 398 WARN_ON(offset >= size); ··· 518 518 index = ff->readdir.cache_off >> PAGE_SHIFT; 519 519 520 520 if (index == (fi->rdc.size >> PAGE_SHIFT)) 521 - size = fi->rdc.size & ~PAGE_MASK; 521 + size = offset_in_page(fi->rdc.size); 522 522 else 523 523 size = PAGE_SIZE; 524 524 spin_unlock(&fi->rdc.lock); 525 525 526 526 /* EOF? */ 527 - if ((ff->readdir.cache_off & ~PAGE_MASK) == size) 527 + if (offset_in_page(ff->readdir.cache_off) == size) 528 528 return 0; 529 529 530 530 page = find_get_page_flags(file->f_mapping, index,