- off = page_offset(pp);
- i_size = i_size_read(ip);
- ASSERT3S(off, <, i_size);
-
- cr = (cred_t *)get_current_cred();
- len = MIN(PAGE_CACHE_SIZE, i_size - off);
-
- pb = kmap(pp);
-
- /* O_DIRECT is passed to bypass the page cache and avoid deadlock. */
- wrote = zpl_read_common(ip, pb, len, off, UIO_SYSSPACE, O_DIRECT, cr);
- if (wrote != len)
- error = -EIO;
-
- if (!error && (len < PAGE_CACHE_SIZE))
- memset(pb + len, 0, PAGE_CACHE_SIZE - len);