~ubuntu-branches/ubuntu/trusty/linux-linaro-omap/trusty

« back to all changes in this revision

Viewing changes to fs/afs/write.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-57i0gl3v99b3lkfg
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
 * partly or wholly fill a page that's under preparation for writing
85
85
 */
86
86
static int afs_fill_page(struct afs_vnode *vnode, struct key *key,
87
 
                         loff_t pos, unsigned len, struct page *page)
 
87
                         loff_t pos, struct page *page)
88
88
{
89
89
        loff_t i_size;
90
 
        unsigned eof;
91
90
        int ret;
92
 
 
93
 
        _enter(",,%llu,%u", (unsigned long long)pos, len);
94
 
 
95
 
        ASSERTCMP(len, <=, PAGE_CACHE_SIZE);
 
91
        int len;
 
92
 
 
93
        _enter(",,%llu", (unsigned long long)pos);
96
94
 
97
95
        i_size = i_size_read(&vnode->vfs_inode);
98
 
        if (pos + len > i_size)
99
 
                eof = i_size;
 
96
        if (pos + PAGE_CACHE_SIZE > i_size)
 
97
                len = i_size - pos;
100
98
        else
101
 
                eof = PAGE_CACHE_SIZE;
 
99
                len = PAGE_CACHE_SIZE;
102
100
 
103
 
        ret = afs_vnode_fetch_data(vnode, key, 0, eof, page);
 
101
        ret = afs_vnode_fetch_data(vnode, key, pos, len, page);
104
102
        if (ret < 0) {
105
103
                if (ret == -ENOENT) {
106
104
                        _debug("got NOENT from server"
153
151
        *pagep = page;
154
152
        /* page won't leak in error case: it eventually gets cleaned off LRU */
155
153
 
156
 
        if (!PageUptodate(page)) {
157
 
                _debug("not up to date");
158
 
                ret = afs_fill_page(vnode, key, pos, len, page);
 
154
        if (!PageUptodate(page) && len != PAGE_CACHE_SIZE) {
 
155
                ret = afs_fill_page(vnode, key, index << PAGE_CACHE_SHIFT, page);
159
156
                if (ret < 0) {
160
157
                        kfree(candidate);
161
158
                        _leave(" = %d [prep]", ret);