mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-04 16:41:42 +07:00
ceph: fix short synchronous reads
Zeroing of holes was not done correctly: page_off was miscalculated and zeroing the tail didn't not adjust the 'read' value to include the zeroed portion. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
02f90c6109
commit
972f0d3ab1
@ -395,23 +395,22 @@ static void zero_page_vector_range(int off, int len, struct page **pages)
|
|||||||
{
|
{
|
||||||
int i = off >> PAGE_CACHE_SHIFT;
|
int i = off >> PAGE_CACHE_SHIFT;
|
||||||
|
|
||||||
|
off &= ~PAGE_CACHE_MASK;
|
||||||
|
|
||||||
dout("zero_page_vector_page %u~%u\n", off, len);
|
dout("zero_page_vector_page %u~%u\n", off, len);
|
||||||
BUG_ON(len < PAGE_CACHE_SIZE);
|
|
||||||
|
|
||||||
/* leading partial page? */
|
/* leading partial page? */
|
||||||
if (off & ~PAGE_CACHE_MASK) {
|
if (off) {
|
||||||
|
int end = min((int)PAGE_CACHE_SIZE, off + len);
|
||||||
dout("zeroing %d %p head from %d\n", i, pages[i],
|
dout("zeroing %d %p head from %d\n", i, pages[i],
|
||||||
(int)(off & ~PAGE_CACHE_MASK));
|
(int)off);
|
||||||
zero_user_segment(pages[i], off & ~PAGE_CACHE_MASK,
|
zero_user_segment(pages[i], off, end);
|
||||||
PAGE_CACHE_SIZE);
|
len -= (end - off);
|
||||||
off += PAGE_CACHE_SIZE;
|
|
||||||
off &= PAGE_CACHE_MASK;
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
while (len >= PAGE_CACHE_SIZE) {
|
while (len >= PAGE_CACHE_SIZE) {
|
||||||
dout("zeroing %d %p\n", i, pages[i]);
|
dout("zeroing %d %p\n", i, pages[i]);
|
||||||
zero_user_segment(pages[i], 0, PAGE_CACHE_SIZE);
|
zero_user_segment(pages[i], 0, PAGE_CACHE_SIZE);
|
||||||
off += PAGE_CACHE_SIZE;
|
|
||||||
len -= PAGE_CACHE_SIZE;
|
len -= PAGE_CACHE_SIZE;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -437,7 +436,7 @@ static int striped_read(struct inode *inode,
|
|||||||
struct ceph_client *client = ceph_inode_to_client(inode);
|
struct ceph_client *client = ceph_inode_to_client(inode);
|
||||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||||
u64 pos, this_len;
|
u64 pos, this_len;
|
||||||
int page_off = off & ~PAGE_CACHE_SIZE; /* first byte's offset in page */
|
int page_off = off & ~PAGE_CACHE_MASK; /* first byte's offset in page */
|
||||||
int left, pages_left;
|
int left, pages_left;
|
||||||
int read;
|
int read;
|
||||||
struct page **page_pos;
|
struct page **page_pos;
|
||||||
@ -493,6 +492,7 @@ static int striped_read(struct inode *inode,
|
|||||||
dout("zero tail\n");
|
dout("zero tail\n");
|
||||||
zero_page_vector_range(page_off + read, len - read,
|
zero_page_vector_range(page_off + read, len - read,
|
||||||
pages);
|
pages);
|
||||||
|
read = len;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user