diff options
-rw-r--r-- | fs/coda/cnode.c | 10 | ||||
-rw-r--r-- | fs/coda/coda_fs_i.h | 3 | ||||
-rw-r--r-- | fs/coda/dir.c | 6 | ||||
-rw-r--r-- | fs/coda/file.c | 17 |
4 files changed, 18 insertions, 18 deletions
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c index e2dcf2addf3f..06855f6c7902 100644 --- a/fs/coda/cnode.c +++ b/fs/coda/cnode.c | |||
@@ -148,6 +148,16 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb) | |||
148 | return inode; | 148 | return inode; |
149 | } | 149 | } |
150 | 150 | ||
151 | struct coda_file_info *coda_ftoc(struct file *file) | ||
152 | { | ||
153 | struct coda_file_info *cfi = file->private_data; | ||
154 | |||
155 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
156 | |||
157 | return cfi; | ||
158 | |||
159 | } | ||
160 | |||
151 | /* the CONTROL inode is made without asking attributes from Venus */ | 161 | /* the CONTROL inode is made without asking attributes from Venus */ |
152 | struct inode *coda_cnode_makectl(struct super_block *sb) | 162 | struct inode *coda_cnode_makectl(struct super_block *sb) |
153 | { | 163 | { |
diff --git a/fs/coda/coda_fs_i.h b/fs/coda/coda_fs_i.h index d702ba1a2bf9..c99d574d1c43 100644 --- a/fs/coda/coda_fs_i.h +++ b/fs/coda/coda_fs_i.h | |||
@@ -42,8 +42,6 @@ struct coda_file_info { | |||
42 | unsigned int cfi_mapcount; /* nr of times this file is mapped */ | 42 | unsigned int cfi_mapcount; /* nr of times this file is mapped */ |
43 | }; | 43 | }; |
44 | 44 | ||
45 | #define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data)) | ||
46 | |||
47 | /* flags */ | 45 | /* flags */ |
48 | #define C_VATTR 0x1 /* Validity of vattr in inode */ | 46 | #define C_VATTR 0x1 /* Validity of vattr in inode */ |
49 | #define C_FLUSH 0x2 /* used after a flush */ | 47 | #define C_FLUSH 0x2 /* used after a flush */ |
@@ -54,6 +52,7 @@ struct inode *coda_cnode_make(struct CodaFid *, struct super_block *); | |||
54 | struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); | 52 | struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); |
55 | struct inode *coda_cnode_makectl(struct super_block *sb); | 53 | struct inode *coda_cnode_makectl(struct super_block *sb); |
56 | struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); | 54 | struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); |
55 | struct coda_file_info *coda_ftoc(struct file *file); | ||
57 | void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); | 56 | void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); |
58 | 57 | ||
59 | #endif | 58 | #endif |
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 716a0b932ec0..ca40c2556ba6 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -356,8 +356,7 @@ static int coda_venus_readdir(struct file *coda_file, struct dir_context *ctx) | |||
356 | ino_t ino; | 356 | ino_t ino; |
357 | int ret; | 357 | int ret; |
358 | 358 | ||
359 | cfi = CODA_FTOC(coda_file); | 359 | cfi = coda_ftoc(coda_file); |
360 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
361 | host_file = cfi->cfi_container; | 360 | host_file = cfi->cfi_container; |
362 | 361 | ||
363 | cii = ITOC(file_inode(coda_file)); | 362 | cii = ITOC(file_inode(coda_file)); |
@@ -426,8 +425,7 @@ static int coda_readdir(struct file *coda_file, struct dir_context *ctx) | |||
426 | struct file *host_file; | 425 | struct file *host_file; |
427 | int ret; | 426 | int ret; |
428 | 427 | ||
429 | cfi = CODA_FTOC(coda_file); | 428 | cfi = coda_ftoc(coda_file); |
430 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
431 | host_file = cfi->cfi_container; | 429 | host_file = cfi->cfi_container; |
432 | 430 | ||
433 | if (host_file->f_op->iterate || host_file->f_op->iterate_shared) { | 431 | if (host_file->f_op->iterate || host_file->f_op->iterate_shared) { |
diff --git a/fs/coda/file.c b/fs/coda/file.c index a6b32c883a50..0dbd13ab72e3 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
@@ -37,9 +37,7 @@ static ssize_t | |||
37 | coda_file_read_iter(struct kiocb *iocb, struct iov_iter *to) | 37 | coda_file_read_iter(struct kiocb *iocb, struct iov_iter *to) |
38 | { | 38 | { |
39 | struct file *coda_file = iocb->ki_filp; | 39 | struct file *coda_file = iocb->ki_filp; |
40 | struct coda_file_info *cfi = CODA_FTOC(coda_file); | 40 | struct coda_file_info *cfi = coda_ftoc(coda_file); |
41 | |||
42 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
43 | 41 | ||
44 | return vfs_iter_read(cfi->cfi_container, to, &iocb->ki_pos, 0); | 42 | return vfs_iter_read(cfi->cfi_container, to, &iocb->ki_pos, 0); |
45 | } | 43 | } |
@@ -49,12 +47,10 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to) | |||
49 | { | 47 | { |
50 | struct file *coda_file = iocb->ki_filp; | 48 | struct file *coda_file = iocb->ki_filp; |
51 | struct inode *coda_inode = file_inode(coda_file); | 49 | struct inode *coda_inode = file_inode(coda_file); |
52 | struct coda_file_info *cfi = CODA_FTOC(coda_file); | 50 | struct coda_file_info *cfi = coda_ftoc(coda_file); |
53 | struct file *host_file; | 51 | struct file *host_file; |
54 | ssize_t ret; | 52 | ssize_t ret; |
55 | 53 | ||
56 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
57 | |||
58 | host_file = cfi->cfi_container; | 54 | host_file = cfi->cfi_container; |
59 | file_start_write(host_file); | 55 | file_start_write(host_file); |
60 | inode_lock(coda_inode); | 56 | inode_lock(coda_inode); |
@@ -105,8 +101,7 @@ coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma) | |||
105 | struct coda_vm_ops *cvm_ops; | 101 | struct coda_vm_ops *cvm_ops; |
106 | int ret; | 102 | int ret; |
107 | 103 | ||
108 | cfi = CODA_FTOC(coda_file); | 104 | cfi = coda_ftoc(coda_file); |
109 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
110 | host_file = cfi->cfi_container; | 105 | host_file = cfi->cfi_container; |
111 | 106 | ||
112 | if (!host_file->f_op->mmap) | 107 | if (!host_file->f_op->mmap) |
@@ -208,8 +203,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file) | |||
208 | struct inode *host_inode; | 203 | struct inode *host_inode; |
209 | int err; | 204 | int err; |
210 | 205 | ||
211 | cfi = CODA_FTOC(coda_file); | 206 | cfi = coda_ftoc(coda_file); |
212 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
213 | 207 | ||
214 | err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode), | 208 | err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode), |
215 | coda_flags, coda_file->f_cred->fsuid); | 209 | coda_flags, coda_file->f_cred->fsuid); |
@@ -251,8 +245,7 @@ int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync) | |||
251 | return err; | 245 | return err; |
252 | inode_lock(coda_inode); | 246 | inode_lock(coda_inode); |
253 | 247 | ||
254 | cfi = CODA_FTOC(coda_file); | 248 | cfi = coda_ftoc(coda_file); |
255 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
256 | host_file = cfi->cfi_container; | 249 | host_file = cfi->cfi_container; |
257 | 250 | ||
258 | err = vfs_fsync(host_file, datasync); | 251 | err = vfs_fsync(host_file, datasync); |