lkml.org 
[lkml]   [2018]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 10/10] afs: Don't invoke the server to read data beyond EOF
    From
    Date
    When writing a new page, clear space in the page rather than attempting to
    load it from the server if the space is beyond the EOF.

    Signed-off-by: David Howells <dhowells@redhat.com>
    ---

    fs/afs/write.c | 11 +++++++++++
    1 file changed, 11 insertions(+)

    diff --git a/fs/afs/write.c b/fs/afs/write.c
    index 1dfca4b722da..05e6bc620384 100644
    --- a/fs/afs/write.c
    +++ b/fs/afs/write.c
    @@ -33,10 +33,21 @@ static int afs_fill_page(struct afs_vnode *vnode, struct key *key,
    loff_t pos, unsigned int len, struct page *page)
    {
    struct afs_read *req;
    + size_t p;
    + void *data;
    int ret;

    _enter(",,%llu", (unsigned long long)pos);

    + if (pos >= vnode->vfs_inode.i_size) {
    + p = pos & ~PAGE_MASK;
    + ASSERTCMP(p + len, <=, PAGE_SIZE);
    + data = kmap(page);
    + memset(data + p, 0, len);
    + kunmap(page);
    + return 0;
    + }
    +
    req = kzalloc(sizeof(struct afs_read), GFP_KERNEL);
    if (!req)
    return -ENOMEM;
    \
     
     \ /
      Last update: 2018-09-13 17:53    [W:5.581 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site