diff options
author | David Howells <dhowells@redhat.com> | 2007-04-26 18:55:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-04-26 18:55:03 -0400 |
commit | 08e0e7c82eeadec6f4871a386b86bf0f0fbcb4eb (patch) | |
tree | 1c4f7e91e20e56ff2ec755e988a6ee828b1a21c0 /fs/afs/file.c | |
parent | 651350d10f93bed7003c9a66e24cf25e0f8eed3d (diff) |
[AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.
Make the in-kernel AFS filesystem use AF_RXRPC instead of the old RxRPC code.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/afs/file.c')
-rw-r--r-- | fs/afs/file.c | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/fs/afs/file.c b/fs/afs/file.c index 01df30d256b..6990327e75d 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* file.c: AFS filesystem file handling | 1 | /* AFS filesystem file handling |
2 | * | 2 | * |
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
@@ -15,9 +15,6 @@ | |||
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/pagemap.h> | 17 | #include <linux/pagemap.h> |
18 | #include "volume.h" | ||
19 | #include "vnode.h" | ||
20 | #include <rxrpc/call.h> | ||
21 | #include "internal.h" | 18 | #include "internal.h" |
22 | 19 | ||
23 | #if 0 | 20 | #if 0 |
@@ -80,12 +77,10 @@ static void afs_file_readpage_write_complete(void *cookie_data, | |||
80 | */ | 77 | */ |
81 | static int afs_file_readpage(struct file *file, struct page *page) | 78 | static int afs_file_readpage(struct file *file, struct page *page) |
82 | { | 79 | { |
83 | struct afs_rxfs_fetch_descriptor desc; | ||
84 | #ifdef AFS_CACHING_SUPPORT | ||
85 | struct cachefs_page *pageio; | ||
86 | #endif | ||
87 | struct afs_vnode *vnode; | 80 | struct afs_vnode *vnode; |
88 | struct inode *inode; | 81 | struct inode *inode; |
82 | size_t len; | ||
83 | off_t offset; | ||
89 | int ret; | 84 | int ret; |
90 | 85 | ||
91 | inode = page->mapping->host; | 86 | inode = page->mapping->host; |
@@ -97,14 +92,10 @@ static int afs_file_readpage(struct file *file, struct page *page) | |||
97 | BUG_ON(!PageLocked(page)); | 92 | BUG_ON(!PageLocked(page)); |
98 | 93 | ||
99 | ret = -ESTALE; | 94 | ret = -ESTALE; |
100 | if (vnode->flags & AFS_VNODE_DELETED) | 95 | if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) |
101 | goto error; | 96 | goto error; |
102 | 97 | ||
103 | #ifdef AFS_CACHING_SUPPORT | 98 | #ifdef AFS_CACHING_SUPPORT |
104 | ret = cachefs_page_get_private(page, &pageio, GFP_NOIO); | ||
105 | if (ret < 0) | ||
106 | goto error; | ||
107 | |||
108 | /* is it cached? */ | 99 | /* is it cached? */ |
109 | ret = cachefs_read_or_alloc_page(vnode->cache, | 100 | ret = cachefs_read_or_alloc_page(vnode->cache, |
110 | page, | 101 | page, |
@@ -128,26 +119,19 @@ static int afs_file_readpage(struct file *file, struct page *page) | |||
128 | case -ENOBUFS: | 119 | case -ENOBUFS: |
129 | case -ENODATA: | 120 | case -ENODATA: |
130 | default: | 121 | default: |
131 | desc.fid = vnode->fid; | 122 | offset = page->index << PAGE_CACHE_SHIFT; |
132 | desc.offset = page->index << PAGE_CACHE_SHIFT; | 123 | len = min_t(size_t, i_size_read(inode) - offset, PAGE_SIZE); |
133 | desc.size = min((size_t) (inode->i_size - desc.offset), | ||
134 | (size_t) PAGE_SIZE); | ||
135 | desc.buffer = kmap(page); | ||
136 | |||
137 | clear_page(desc.buffer); | ||
138 | 124 | ||
139 | /* read the contents of the file from the server into the | 125 | /* read the contents of the file from the server into the |
140 | * page */ | 126 | * page */ |
141 | ret = afs_vnode_fetch_data(vnode, &desc); | 127 | ret = afs_vnode_fetch_data(vnode, offset, len, page); |
142 | kunmap(page); | ||
143 | if (ret < 0) { | 128 | if (ret < 0) { |
144 | if (ret==-ENOENT) { | 129 | if (ret == -ENOENT) { |
145 | _debug("got NOENT from server" | 130 | _debug("got NOENT from server" |
146 | " - marking file deleted and stale"); | 131 | " - marking file deleted and stale"); |
147 | vnode->flags |= AFS_VNODE_DELETED; | 132 | set_bit(AFS_VNODE_DELETED, &vnode->flags); |
148 | ret = -ESTALE; | 133 | ret = -ESTALE; |
149 | } | 134 | } |
150 | |||
151 | #ifdef AFS_CACHING_SUPPORT | 135 | #ifdef AFS_CACHING_SUPPORT |
152 | cachefs_uncache_page(vnode->cache, page); | 136 | cachefs_uncache_page(vnode->cache, page); |
153 | #endif | 137 | #endif |
@@ -174,10 +158,9 @@ static int afs_file_readpage(struct file *file, struct page *page) | |||
174 | _leave(" = 0"); | 158 | _leave(" = 0"); |
175 | return 0; | 159 | return 0; |
176 | 160 | ||
177 | error: | 161 | error: |
178 | SetPageError(page); | 162 | SetPageError(page); |
179 | unlock_page(page); | 163 | unlock_page(page); |
180 | |||
181 | _leave(" = %d", ret); | 164 | _leave(" = %d", ret); |
182 | return ret; | 165 | return ret; |
183 | } | 166 | } |