diff options
author | Christoph Lameter <christoph@graphe.net> | 2005-06-23 03:10:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 12:45:33 -0400 |
commit | 45778ca819accab1a4a3378b3566cab0f189164f (patch) | |
tree | 9214491346c8d2d91eb1a11cb6c2e6a9387e4290 | |
parent | 280dedb8d64ccfe1166ae03d3b254fc3b65de6a5 (diff) |
[PATCH] Remove f_error field from struct file
The following patch removes the f_error field and all checks of f_error.
Trond said:
f_error was introduced for NFS, and made sense when we were guaranteed
always to have a file pointer around when write errors occurred. Since
then, we have (for various reasons) had to introduce the nfs_open_context in
order to track the file read/write state, and it made sense to move our
f_error tracking there too.
Signed-off-by: Christoph Lameter <christoph@lameter.com>
Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/nfs/direct.c | 5 | ||||
-rw-r--r-- | fs/open.c | 16 | ||||
-rw-r--r-- | include/linux/fs.h | 1 | ||||
-rw-r--r-- | mm/filemap.c | 6 |
4 files changed, 4 insertions, 24 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index d6a30c844de3..6537f2c4ae44 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -751,11 +751,6 @@ nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count, | |||
751 | retval = -EFAULT; | 751 | retval = -EFAULT; |
752 | if (!access_ok(VERIFY_READ, iov.iov_base, iov.iov_len)) | 752 | if (!access_ok(VERIFY_READ, iov.iov_base, iov.iov_len)) |
753 | goto out; | 753 | goto out; |
754 | if (file->f_error) { | ||
755 | retval = file->f_error; | ||
756 | file->f_error = 0; | ||
757 | goto out; | ||
758 | } | ||
759 | retval = -EFBIG; | 754 | retval = -EFBIG; |
760 | if (limit != RLIM_INFINITY) { | 755 | if (limit != RLIM_INFINITY) { |
761 | if (pos >= limit) { | 756 | if (pos >= limit) { |
@@ -981,23 +981,15 @@ asmlinkage long sys_creat(const char __user * pathname, int mode) | |||
981 | */ | 981 | */ |
982 | int filp_close(struct file *filp, fl_owner_t id) | 982 | int filp_close(struct file *filp, fl_owner_t id) |
983 | { | 983 | { |
984 | int retval; | 984 | int retval = 0; |
985 | |||
986 | /* Report and clear outstanding errors */ | ||
987 | retval = filp->f_error; | ||
988 | if (retval) | ||
989 | filp->f_error = 0; | ||
990 | 985 | ||
991 | if (!file_count(filp)) { | 986 | if (!file_count(filp)) { |
992 | printk(KERN_ERR "VFS: Close: file count is 0\n"); | 987 | printk(KERN_ERR "VFS: Close: file count is 0\n"); |
993 | return retval; | 988 | return 0; |
994 | } | 989 | } |
995 | 990 | ||
996 | if (filp->f_op && filp->f_op->flush) { | 991 | if (filp->f_op && filp->f_op->flush) |
997 | int err = filp->f_op->flush(filp); | 992 | retval = filp->f_op->flush(filp); |
998 | if (!retval) | ||
999 | retval = err; | ||
1000 | } | ||
1001 | 993 | ||
1002 | dnotify_flush(filp, id); | 994 | dnotify_flush(filp, id); |
1003 | locks_remove_posix(filp, id); | 995 | locks_remove_posix(filp, id); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 9b1278e21279..517bf4966bf5 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -581,7 +581,6 @@ struct file { | |||
581 | atomic_t f_count; | 581 | atomic_t f_count; |
582 | unsigned int f_flags; | 582 | unsigned int f_flags; |
583 | mode_t f_mode; | 583 | mode_t f_mode; |
584 | int f_error; | ||
585 | loff_t f_pos; | 584 | loff_t f_pos; |
586 | struct fown_struct f_owner; | 585 | struct fown_struct f_owner; |
587 | unsigned int f_uid, f_gid; | 586 | unsigned int f_uid, f_gid; |
diff --git a/mm/filemap.c b/mm/filemap.c index 4a2fee2cb62b..a3598b542a31 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1827,12 +1827,6 @@ inline int generic_write_checks(struct file *file, loff_t *pos, size_t *count, i | |||
1827 | if (unlikely(*pos < 0)) | 1827 | if (unlikely(*pos < 0)) |
1828 | return -EINVAL; | 1828 | return -EINVAL; |
1829 | 1829 | ||
1830 | if (unlikely(file->f_error)) { | ||
1831 | int err = file->f_error; | ||
1832 | file->f_error = 0; | ||
1833 | return err; | ||
1834 | } | ||
1835 | |||
1836 | if (!isblk) { | 1830 | if (!isblk) { |
1837 | /* FIXME: this is for backwards compatibility with 2.4 */ | 1831 | /* FIXME: this is for backwards compatibility with 2.4 */ |
1838 | if (file->f_flags & O_APPEND) | 1832 | if (file->f_flags & O_APPEND) |