05 Apr, 2016

2 commits

  • Mostly direct substitution with occasional adjustment or removing
    outdated comments.

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     
  • PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
    ago with promise that one day it will be possible to implement page
    cache with bigger chunks than PAGE_SIZE.

    This promise never materialized. And unlikely will.

    We have many places where PAGE_CACHE_SIZE assumed to be equal to
    PAGE_SIZE. And it's constant source of confusion on whether
    PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
    especially on the border between fs and mm.

    Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
    breakage to be doable.

    Let's stop pretending that pages in page cache are special. They are
    not.

    The changes are pretty straight-forward:

    - << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};

    - page_cache_get() -> get_page();

    - page_cache_release() -> put_page();

    This patch contains automated changes generated with coccinelle using
    script below. For some reason, coccinelle doesn't patch header files.
    I've called spatch for them manually.

    The only adjustment after coccinelle is revert of changes to
    PAGE_CAHCE_ALIGN definition: we are going to drop it later.

    There are few places in the code where coccinelle didn't reach. I'll
    fix them manually in a separate patch. Comments and documentation also
    will be addressed with the separate patch.

    virtual patch

    @@
    expression E;
    @@
    - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    expression E;
    @@
    - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    @@
    - PAGE_CACHE_SHIFT
    + PAGE_SHIFT

    @@
    @@
    - PAGE_CACHE_SIZE
    + PAGE_SIZE

    @@
    @@
    - PAGE_CACHE_MASK
    + PAGE_MASK

    @@
    expression E;
    @@
    - PAGE_CACHE_ALIGN(E)
    + PAGE_ALIGN(E)

    @@
    expression E;
    @@
    - page_cache_get(E)
    + get_page(E)

    @@
    expression E;
    @@
    - page_cache_release(E)
    + put_page(E)

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     

11 Jun, 2015

1 commit


04 Feb, 2015

3 commits


23 Aug, 2014

1 commit

  • This handles the 'nonblock=false' case in nfs_lock_and_join_requests.
    If the group is already locked and blocking is allowed, drop the inode lock
    and wait for the group lock to be cleared before trying it all again.
    This should fix warnings found in peterz's tree (sched/wait branch), where
    might_sleep() checks are added to wait.[ch].

    Reported-by: Fengguang Wu
    Signed-off-by: Weston Andros Adamson
    Reviewed-by: Peng Tao
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     

04 Aug, 2014

2 commits


25 Jun, 2014

3 commits

  • Clean up pnfs_read_done_resend_to_mds and pnfs_write_done_resend_to_mds:
    - instead of passing all arguments from a nfs_pgio_header, just pass the header
    - share the common code

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     
  • struct nfs_pgio_data only exists as a member of nfs_pgio_header, but is
    passed around everywhere, because there used to be multiple _data structs
    per _header. Many of these functions then use the _data to find a pointer
    to the _header. This patch cleans this up by merging the nfs_pgio_data
    structure into nfs_pgio_header and passing nfs_pgio_header around instead.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     
  • nfs_rw_header was used to allocate an nfs_pgio_header along with an
    nfs_pgio_data, because a _header would need at least one _data.

    Now there is only ever one nfs_pgio_data for each nfs_pgio_header -- move
    it to nfs_pgio_header and get rid of nfs_rw_header.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     

29 May, 2014

10 commits

  • Operations that modify state for a whole page must be syncronized across
    all requests within a page group. In the write path, this is calling
    end_page_writeback and removing the head request from an inode.
    Both of these operations should not be called until all requests
    in a page group have reached the point where they would call them.

    This patch should have no effect yet since all page groups currently
    have one request, but will come into play when pg_test functions are
    modified to split pages into sub-page regions.

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     
  • Operations that modify state for a whole page must be syncronized across
    all requests within a page group. In the read path, this is calling
    unlock_page and SetPageUptodate. Both of these functions should not be
    called until all requests in a page group have reached the point where
    they would call them.

    This patch should have no effect yet since all page groups currently
    have one request, but will come into play when pg_test functions are
    modified to split pages into sub-page regions.

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     
  • Add "page groups" - a circular list of nfs requests (struct nfs_page)
    that all reference the same page. This gives nfs read and write paths
    the ability to account for sub-page regions independently. This
    somewhat follows the design of struct buffer_head's sub-page
    accounting.

    Only "head" requests are ever added/removed from the inode list in
    the buffered write path. "head" and "sub" requests are treated the
    same through the read path and the rest of the write/commit path.
    Requests are given an extra reference across the life of the list.

    Page groups are never rejoined after being split. If the read/write
    request fails and the client falls back to another path (ie revert
    to MDS in PNFS case), the already split requests are pushed through
    the recoalescing code again, which may split them further and then
    coalesce them into properly sized requests on the wire. Fragmentation
    shouldn't be a problem with the current design, because we flush all
    requests in page group when a non-contiguous request is added, so
    the only time resplitting should occur is on a resend of a read or
    write.

    This patch lays the groundwork for sub-page splitting, but does not
    actually do any splitting. For now all page groups have one request
    as pg_test functions don't yet split pages. There are several related
    patches that are needed support multiple requests per page group.

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     
  • This is a step toward allowing pg_test to inform the the
    coalescing code to reduce the size of requests so they may fit in
    whatever scheme the pg_test callback wants to define.

    For now, just return the size of the request if there is space, or 0
    if there is not. This shouldn't change any behavior as it acts
    the same as when the pg_test functions returned bool.

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     
  • @inode is passed but not used.

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     
  • Remove unused flags PG_NEED_COMMIT and PG_NEED_RESCHED.
    Add comments describing how each flag is used.

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Weston Andros Adamson
     
  • Most of this code is the same for both the read and write paths, so
    combine everything and use the rw_ops when necessary.

    Signed-off-by: Anna Schumaker
    Signed-off-by: Trond Myklebust

    Anna Schumaker
     
  • Combining these functions will let me make a single nfs_rw_common_ops
    struct (see the next patch).

    Signed-off-by: Anna Schumaker
    Signed-off-by: Trond Myklebust

    Anna Schumaker
     
  • The read and write paths do exactly the same thing for the rpc_prepare
    rpc_op. This patch combines them together into a single function.

    Signed-off-by: Anna Schumaker
    Signed-off-by: Trond Myklebust

    Anna Schumaker
     
  • I create a new struct nfs_rw_ops to decide the differences between reads
    and writes. This struct will be set when initializing a new
    nfs_pgio_descriptor, and then passed on to the nfs_rw_header when a new
    header is allocated.

    Signed-off-by: Anna Schumaker
    Signed-off-by: Trond Myklebust

    Anna Schumaker
     

03 Aug, 2012

1 commit


29 Jun, 2012

1 commit


10 May, 2012

3 commits

  • Function rename to ensure that the functionality of nfs_unlock_request()
    mirrors that of nfs_lock_request(). Then let nfs_unlock_and_release_request()
    do the work of what used to be called nfs_unlock_request()...

    Signed-off-by: Trond Myklebust
    Cc: Fred Isaman

    Trond Myklebust
     
  • We only have two places where we need to grab a reference when trying
    to lock the nfs_page. We're better off making that explicit.

    Signed-off-by: Trond Myklebust
    Cc: Fred Isaman

    Trond Myklebust
     
  • We have to unlock the nfs_page before we call nfs_end_page_writeback
    to avoid races with functions that expect the page to be unlocked
    when PG_locked and PG_writeback are not set.
    The problem is that nfs_unlock_request also releases the nfs_page,
    causing a deadlock if the release of the nfs_open_context
    triggers an iput() while the PG_writeback flag is still set...

    The solution is to separate the unlocking and release of the nfs_page,
    so that we can do the former before nfs_end_page_writeback and the
    latter after.

    Signed-off-by: Trond Myklebust
    Cc: Fred Isaman

    Trond Myklebust
     

28 Apr, 2012

4 commits


17 Mar, 2012

1 commit

  • Move more pnfs-isms out of the generic commit code.

    Bugfixes:

    - filelayout_scan_commit_lists doesn't need to get/put the lseg.
    In fact since it is run under the inode->i_lock, the lseg_put()
    can deadlock.

    - Ensure that we distinguish between what needs to be done for
    commit-to-data server and what needs to be done for commit-to-MDS
    using the new flag PG_COMMIT_TO_DS. Otherwise we may end up calling
    put_lseg() on a bucket for a struct nfs_page that got written
    through the MDS.

    - Fix a case where we were using list_del() on an nfs_page->wb_list
    instead of list_del_init().

    - filelayout_initiate_commit needs to call filelayout_commit_release
    on error instead of the mds_ops->rpc_release(). Otherwise it won't
    clear the commit lock.

    Cleanups:

    - Let the files layout manage the commit lists for the pNFS case.
    Don't expose stuff like pnfs_choose_commit_list, and the fact
    that the commit buckets hold references to the layout segment
    in common code.

    - Cast out the put_lseg() calls for the struct nfs_read/write_data->lseg
    into the pNFS layer from whence they came.

    - Let the pNFS layer manage the NFS_INO_PNFS_COMMIT bit.

    Signed-off-by: Trond Myklebust
    Cc: Fred Isaman

    Trond Myklebust
     

11 Mar, 2012

2 commits


20 Oct, 2011

1 commit


15 Jul, 2011

4 commits


13 Jul, 2011

1 commit