file.c (2a267e7c41aa88215de2b542de797d03d16ecdfd) file.c (a1b879eefc2b34cd3f17187ef6fc1cf3960e9518)
1/* AFS filesystem file handling
2 *
3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 156 unchanged lines hidden (view full) ---

165
166/*
167 * release an AFS file or directory and discard its key
168 */
169int afs_release(struct inode *inode, struct file *file)
170{
171 struct afs_vnode *vnode = AFS_FS_I(inode);
172 struct afs_file *af = file->private_data;
1/* AFS filesystem file handling
2 *
3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 156 unchanged lines hidden (view full) ---

165
166/*
167 * release an AFS file or directory and discard its key
168 */
169int afs_release(struct inode *inode, struct file *file)
170{
171 struct afs_vnode *vnode = AFS_FS_I(inode);
172 struct afs_file *af = file->private_data;
173 int ret = 0;
173
174 _enter("{%llx:%llu},", vnode->fid.vid, vnode->fid.vnode);
175
176 if ((file->f_mode & FMODE_WRITE))
174
175 _enter("{%llx:%llu},", vnode->fid.vid, vnode->fid.vnode);
176
177 if ((file->f_mode & FMODE_WRITE))
177 return vfs_fsync(file, 0);
178 ret = vfs_fsync(file, 0);
178
179 file->private_data = NULL;
180 if (af->wb)
181 afs_put_wb_key(af->wb);
182 key_put(af->key);
183 kfree(af);
184 afs_prune_wb_keys(vnode);
179
180 file->private_data = NULL;
181 if (af->wb)
182 afs_put_wb_key(af->wb);
183 key_put(af->key);
184 kfree(af);
185 afs_prune_wb_keys(vnode);
185 _leave(" = 0");
186 return 0;
186 _leave(" = %d", ret);
187 return ret;
187}
188
189/*
190 * Dispose of a ref to a read record.
191 */
192void afs_put_read(struct afs_read *req)
193{
194 int i;

--- 100 unchanged lines hidden (view full) ---

295 /* page not yet cached */
296 case -ENODATA:
297 _debug("cache said ENODATA");
298 goto go_on;
299
300 /* page will not be cached */
301 case -ENOBUFS:
302 _debug("cache said ENOBUFS");
188}
189
190/*
191 * Dispose of a ref to a read record.
192 */
193void afs_put_read(struct afs_read *req)
194{
195 int i;

--- 100 unchanged lines hidden (view full) ---

296 /* page not yet cached */
297 case -ENODATA:
298 _debug("cache said ENODATA");
299 goto go_on;
300
301 /* page will not be cached */
302 case -ENOBUFS:
303 _debug("cache said ENOBUFS");
304
305 /* fall through */
303 default:
304 go_on:
305 req = kzalloc(sizeof(struct afs_read) + sizeof(struct page *),
306 GFP_KERNEL);
307 if (!req)
308 goto enomem;
309
310 /* We request a full page. If the page is a partial one at the

--- 365 unchanged lines hidden ---
306 default:
307 go_on:
308 req = kzalloc(sizeof(struct afs_read) + sizeof(struct page *),
309 GFP_KERNEL);
310 if (!req)
311 goto enomem;
312
313 /* We request a full page. If the page is a partial one at the

--- 365 unchanged lines hidden ---