* [PATCH 0/7 linux-next] coda: fs clean-up
@ 2018-10-19 8:19 Fabian Frederick
2018-10-19 8:19 ` [PATCH 1/7 linux-next] coda: remove CODA_FREE Fabian Frederick
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Fabian Frederick @ 2018-10-19 8:19 UTC (permalink / raw)
To: akpm; +Cc: jaharkes, coda, linux-fsdevel, linux-kernel, fabf
This small patchset applies some sparse clean-up / optimizations
Fabian Frederick (7):
coda: remove CODA_FREE
coda: destroy mutex in put_super()
coda: use SIZE() for stat
coda: add __init to init_coda_psdev()
coda: remove sysctl object from module when unused
coda: remove sb test in coda_fid_to_inode()
coda: ftoc validity check integration
fs/coda/Makefile | 3 ++-
fs/coda/cnode.c | 15 ++++++++++-----
fs/coda/coda_fs_i.h | 3 +--
fs/coda/coda_int.h | 10 ++++++++++
fs/coda/coda_linux.h | 6 ------
fs/coda/dir.c | 6 ++----
fs/coda/file.c | 17 +++++------------
fs/coda/inode.c | 1 +
fs/coda/psdev.c | 10 +++++-----
fs/coda/sysctl.c | 11 -----------
fs/coda/upcall.c | 38 +++++++++++++++++++-------------------
11 files changed, 55 insertions(+), 65 deletions(-)
--
2.4.11
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/7 linux-next] coda: remove CODA_FREE
2018-10-19 8:19 [PATCH 0/7 linux-next] coda: fs clean-up Fabian Frederick
@ 2018-10-19 8:19 ` Fabian Frederick
2018-10-19 8:19 ` [PATCH 2/7 linux-next] coda: destroy mutex in put_super() Fabian Frederick
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Fabian Frederick @ 2018-10-19 8:19 UTC (permalink / raw)
To: akpm; +Cc: jaharkes, coda, linux-fsdevel, linux-kernel, fabf
Since commit 1d5cfdb07628
("tree wide: use kvfree() than conditional kfree()/vfree()")
size in CODA_FREE is no longer used and that macro
hides nothing more than kvfree()
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/coda/coda_linux.h | 2 --
fs/coda/psdev.c | 8 ++++----
fs/coda/upcall.c | 36 ++++++++++++++++++------------------
3 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h
index 126155c..903f2a3 100644
--- a/fs/coda/coda_linux.h
+++ b/fs/coda/coda_linux.h
@@ -73,8 +73,6 @@ void coda_sysctl_clean(void);
} while (0)
-#define CODA_FREE(ptr, size) kvfree((ptr))
-
/* inode to cnode access functions */
static inline struct coda_inode_info *ITOC(struct inode *inode)
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index c5234c2..cbdddf4 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -126,7 +126,7 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf,
}
CODA_ALLOC(dcbuf, union outputArgs *, nbytes);
if (copy_from_user(dcbuf, buf, nbytes)) {
- CODA_FREE(dcbuf, nbytes);
+ kvfree(dcbuf);
retval = -EFAULT;
goto out;
}
@@ -134,7 +134,7 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf,
/* what downcall errors does Venus handle ? */
error = coda_downcall(vcp, hdr.opcode, dcbuf);
- CODA_FREE(dcbuf, nbytes);
+ kvfree(dcbuf);
if (error) {
pr_warn("%s: coda_downcall error: %d\n",
__func__, error);
@@ -257,7 +257,7 @@ static ssize_t coda_psdev_read(struct file * file, char __user * buf,
goto out;
}
- CODA_FREE(req->uc_data, sizeof(struct coda_in_hdr));
+ kvfree(req->uc_data);
kfree(req);
out:
mutex_unlock(&vcp->vc_mutex);
@@ -319,7 +319,7 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
/* Async requests need to be freed here */
if (req->uc_flags & CODA_REQ_ASYNC) {
- CODA_FREE(req->uc_data, sizeof(struct coda_in_hdr));
+ kvfree(req->uc_data);
kfree(req);
continue;
}
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index 1175a17..d0d0fed 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -85,7 +85,7 @@ int venus_rootfid(struct super_block *sb, struct CodaFid *fidp)
if (!error)
*fidp = outp->coda_root.VFid;
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -104,7 +104,7 @@ int venus_getattr(struct super_block *sb, struct CodaFid *fid,
if (!error)
*attr = outp->coda_getattr.attr;
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -123,7 +123,7 @@ int venus_setattr(struct super_block *sb, struct CodaFid *fid,
error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -153,7 +153,7 @@ int venus_lookup(struct super_block *sb, struct CodaFid *fid,
*type = outp->coda_lookup.vtype;
}
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -173,7 +173,7 @@ int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -194,7 +194,7 @@ int venus_open(struct super_block *sb, struct CodaFid *fid,
if (!error)
*fh = outp->coda_open_by_fd.fh;
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -224,7 +224,7 @@ int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid,
*newfid = outp->coda_mkdir.VFid;
}
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -262,7 +262,7 @@ int venus_rename(struct super_block *sb, struct CodaFid *old_fid,
error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -295,7 +295,7 @@ int venus_create(struct super_block *sb, struct CodaFid *dirfid,
*newfid = outp->coda_create.VFid;
}
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -318,7 +318,7 @@ int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid,
error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -340,7 +340,7 @@ int venus_remove(struct super_block *sb, struct CodaFid *dirfid,
error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -370,7 +370,7 @@ int venus_readlink(struct super_block *sb, struct CodaFid *fid,
*(buffer + retlen) = '\0';
}
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -398,7 +398,7 @@ int venus_link(struct super_block *sb, struct CodaFid *fid,
error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -433,7 +433,7 @@ int venus_symlink(struct super_block *sb, struct CodaFid *fid,
error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -449,7 +449,7 @@ int venus_fsync(struct super_block *sb, struct CodaFid *fid)
inp->coda_fsync.VFid = *fid;
error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -467,7 +467,7 @@ int venus_access(struct super_block *sb, struct CodaFid *fid, int mask)
error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -543,7 +543,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
}
exit:
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
@@ -565,7 +565,7 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs)
sfs->f_ffree = outp->coda_statfs.stat.f_ffree;
}
- CODA_FREE(inp, insize);
+ kvfree(inp);
return error;
}
--
2.4.11
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/7 linux-next] coda: destroy mutex in put_super()
2018-10-19 8:19 [PATCH 0/7 linux-next] coda: fs clean-up Fabian Frederick
2018-10-19 8:19 ` [PATCH 1/7 linux-next] coda: remove CODA_FREE Fabian Frederick
@ 2018-10-19 8:19 ` Fabian Frederick
2018-10-19 8:19 ` [PATCH 3/7 linux-next] coda: use SIZE() for stat Fabian Frederick
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Fabian Frederick @ 2018-10-19 8:19 UTC (permalink / raw)
To: akpm; +Cc: jaharkes, coda, linux-fsdevel, linux-kernel, fabf
we can safely destroy vc_mutex at the end of umount process.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/coda/inode.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index dd819c1..69bb64d 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -244,6 +244,7 @@ static void coda_put_super(struct super_block *sb)
vcp->vc_sb = NULL;
sb->s_fs_info = NULL;
mutex_unlock(&vcp->vc_mutex);
+ mutex_destroy(&vcp->vc_mutex);
pr_info("Bye bye.\n");
}
--
2.4.11
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/7 linux-next] coda: use SIZE() for stat
2018-10-19 8:19 [PATCH 0/7 linux-next] coda: fs clean-up Fabian Frederick
2018-10-19 8:19 ` [PATCH 1/7 linux-next] coda: remove CODA_FREE Fabian Frederick
2018-10-19 8:19 ` [PATCH 2/7 linux-next] coda: destroy mutex in put_super() Fabian Frederick
@ 2018-10-19 8:19 ` Fabian Frederick
2018-10-19 8:19 ` [PATCH 4/7 linux-next] coda: add __init to init_coda_psdev() Fabian Frederick
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Fabian Frederick @ 2018-10-19 8:19 UTC (permalink / raw)
To: akpm; +Cc: jaharkes, coda, linux-fsdevel, linux-kernel, fabf
max_t expression was already defined in coda sources
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/coda/upcall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index d0d0fed..1323793 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -553,7 +553,7 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs)
union outputArgs *outp;
int insize, outsize, error;
- insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs));
+ insize = SIZE(statfs);
UPARG(CODA_STATFS);
error = coda_upcall(coda_vcp(dentry->d_sb), insize, &outsize, inp);
--
2.4.11
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/7 linux-next] coda: add __init to init_coda_psdev()
2018-10-19 8:19 [PATCH 0/7 linux-next] coda: fs clean-up Fabian Frederick
` (2 preceding siblings ...)
2018-10-19 8:19 ` [PATCH 3/7 linux-next] coda: use SIZE() for stat Fabian Frederick
@ 2018-10-19 8:19 ` Fabian Frederick
2018-10-19 8:19 ` [PATCH 5/7 linux-next] coda: remove sysctl object from module when unused Fabian Frederick
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Fabian Frederick @ 2018-10-19 8:19 UTC (permalink / raw)
To: akpm; +Cc: jaharkes, coda, linux-fsdevel, linux-kernel, fabf
init_coda_psdev() was only called by __init function.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/coda/psdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index cbdddf4..6d1c95f 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -352,7 +352,7 @@ static const struct file_operations coda_psdev_fops = {
.llseek = noop_llseek,
};
-static int init_coda_psdev(void)
+static int __init init_coda_psdev(void)
{
int i, err = 0;
if (register_chrdev(CODA_PSDEV_MAJOR, "coda", &coda_psdev_fops)) {
--
2.4.11
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/7 linux-next] coda: remove sysctl object from module when unused
2018-10-19 8:19 [PATCH 0/7 linux-next] coda: fs clean-up Fabian Frederick
` (3 preceding siblings ...)
2018-10-19 8:19 ` [PATCH 4/7 linux-next] coda: add __init to init_coda_psdev() Fabian Frederick
@ 2018-10-19 8:19 ` Fabian Frederick
2018-10-19 8:19 ` [PATCH 6/7 linux-next] coda: remove sb test in coda_fid_to_inode() Fabian Frederick
2018-10-19 8:19 ` [PATCH 7/7 linux-next] coda: ftoc validity check integration Fabian Frederick
6 siblings, 0 replies; 8+ messages in thread
From: Fabian Frederick @ 2018-10-19 8:19 UTC (permalink / raw)
To: akpm; +Cc: jaharkes, coda, linux-fsdevel, linux-kernel, fabf
Inspired by NFS sysctl process
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/coda/Makefile | 3 ++-
fs/coda/coda_int.h | 10 ++++++++++
fs/coda/coda_linux.h | 4 ----
fs/coda/sysctl.c | 11 -----------
4 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/fs/coda/Makefile b/fs/coda/Makefile
index 1bab69a..30e4e1b 100644
--- a/fs/coda/Makefile
+++ b/fs/coda/Makefile
@@ -5,7 +5,8 @@
obj-$(CONFIG_CODA_FS) += coda.o
coda-objs := psdev.o cache.o cnode.o inode.o dir.o file.o upcall.o \
- coda_linux.o symlink.o pioctl.o sysctl.o
+ coda_linux.o symlink.o pioctl.o
+coda-$(CONFIG_SYSCTL) += sysctl.o
# If you want debugging output, please uncomment the following line.
diff --git a/fs/coda/coda_int.h b/fs/coda/coda_int.h
index bb0b3e0..f82b59c 100644
--- a/fs/coda/coda_int.h
+++ b/fs/coda/coda_int.h
@@ -13,9 +13,19 @@ extern int coda_fake_statfs;
void coda_destroy_inodecache(void);
int __init coda_init_inodecache(void);
int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync);
+
+#ifdef CONFIG_SYSCTL
void coda_sysctl_init(void);
void coda_sysctl_clean(void);
+#else
+static inline void coda_sysctl_init(void)
+{
+}
+static inline void coda_sysctl_clean(void)
+{
+}
+#endif
#endif /* _CODA_INT_ */
diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h
index 903f2a3..4087264 100644
--- a/fs/coda/coda_linux.h
+++ b/fs/coda/coda_linux.h
@@ -59,10 +59,6 @@ void coda_vattr_to_iattr(struct inode *, struct coda_vattr *);
void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *);
unsigned short coda_flags_to_cflags(unsigned short);
-/* sysctl.h */
-void coda_sysctl_init(void);
-void coda_sysctl_clean(void);
-
#define CODA_ALLOC(ptr, cast, size) do { \
if (size < PAGE_SIZE) \
ptr = kzalloc((unsigned long) size, GFP_KERNEL); \
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
index 0301d45..fda3b70 100644
--- a/fs/coda/sysctl.c
+++ b/fs/coda/sysctl.c
@@ -12,7 +12,6 @@
#include "coda_int.h"
-#ifdef CONFIG_SYSCTL
static struct ctl_table_header *fs_table_header;
static struct ctl_table coda_table[] = {
@@ -62,13 +61,3 @@ void coda_sysctl_clean(void)
fs_table_header = NULL;
}
}
-
-#else
-void coda_sysctl_init(void)
-{
-}
-
-void coda_sysctl_clean(void)
-{
-}
-#endif
--
2.4.11
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/7 linux-next] coda: remove sb test in coda_fid_to_inode()
2018-10-19 8:19 [PATCH 0/7 linux-next] coda: fs clean-up Fabian Frederick
` (4 preceding siblings ...)
2018-10-19 8:19 ` [PATCH 5/7 linux-next] coda: remove sysctl object from module when unused Fabian Frederick
@ 2018-10-19 8:19 ` Fabian Frederick
2018-10-19 8:19 ` [PATCH 7/7 linux-next] coda: ftoc validity check integration Fabian Frederick
6 siblings, 0 replies; 8+ messages in thread
From: Fabian Frederick @ 2018-10-19 8:19 UTC (permalink / raw)
To: akpm; +Cc: jaharkes, coda, linux-fsdevel, linux-kernel, fabf
coda_fid_to_inode() is only called by coda_downcall() where
sb is already being tested.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/coda/cnode.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c
index 845b5a6..c42d340 100644
--- a/fs/coda/cnode.c
+++ b/fs/coda/cnode.c
@@ -137,11 +137,6 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb)
struct inode *inode;
unsigned long hash = coda_f2i(fid);
- if ( !sb ) {
- pr_warn("%s: no sb!\n", __func__);
- return NULL;
- }
-
inode = ilookup5(sb, hash, coda_test_inode, fid);
if ( !inode )
return NULL;
--
2.4.11
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 7/7 linux-next] coda: ftoc validity check integration
2018-10-19 8:19 [PATCH 0/7 linux-next] coda: fs clean-up Fabian Frederick
` (5 preceding siblings ...)
2018-10-19 8:19 ` [PATCH 6/7 linux-next] coda: remove sb test in coda_fid_to_inode() Fabian Frederick
@ 2018-10-19 8:19 ` Fabian Frederick
6 siblings, 0 replies; 8+ messages in thread
From: Fabian Frederick @ 2018-10-19 8:19 UTC (permalink / raw)
To: akpm; +Cc: jaharkes, coda, linux-fsdevel, linux-kernel, fabf
This patch moves cfi check in coda_ftoc() instead of repeating
it in the wild.
Module size
text data bss dec hex filename
28297 1040 700 30037 7555 fs/coda/coda.ko.before
28263 980 700 29943 74f7 fs/coda/coda.ko.after
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/coda/cnode.c | 10 ++++++++++
fs/coda/coda_fs_i.h | 3 +--
fs/coda/dir.c | 6 ++----
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 c42d340..36414438 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)
return inode;
}
+struct coda_file_info *coda_ftoc(struct file *file)
+{
+ struct coda_file_info *cfi = file->private_data;
+
+ BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
+
+ return cfi;
+
+}
+
/* the CONTROL inode is made without asking attributes from Venus */
struct inode *coda_cnode_makectl(struct super_block *sb)
{
diff --git a/fs/coda/coda_fs_i.h b/fs/coda/coda_fs_i.h
index d702ba1a..c99d574 100644
--- a/fs/coda/coda_fs_i.h
+++ b/fs/coda/coda_fs_i.h
@@ -42,8 +42,6 @@ struct coda_file_info {
unsigned int cfi_mapcount; /* nr of times this file is mapped */
};
-#define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data))
-
/* flags */
#define C_VATTR 0x1 /* Validity of vattr in inode */
#define C_FLUSH 0x2 /* used after a flush */
@@ -54,6 +52,7 @@ struct inode *coda_cnode_make(struct CodaFid *, struct super_block *);
struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr);
struct inode *coda_cnode_makectl(struct super_block *sb);
struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb);
+struct coda_file_info *coda_ftoc(struct file *file);
void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *);
#endif
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 00876dd..3e80770 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)
ino_t ino;
int ret;
- cfi = CODA_FTOC(coda_file);
- BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
+ cfi = coda_ftoc(coda_file);
host_file = cfi->cfi_container;
cii = ITOC(file_inode(coda_file));
@@ -426,8 +425,7 @@ static int coda_readdir(struct file *coda_file, struct dir_context *ctx)
struct file *host_file;
int ret;
- cfi = CODA_FTOC(coda_file);
- BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
+ cfi = coda_ftoc(coda_file);
host_file = cfi->cfi_container;
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 1cbc1f2..55c22e2 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -31,9 +31,7 @@ static ssize_t
coda_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
{
struct file *coda_file = iocb->ki_filp;
- struct coda_file_info *cfi = CODA_FTOC(coda_file);
-
- BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
+ struct coda_file_info *cfi = coda_ftoc(coda_file);
return vfs_iter_read(cfi->cfi_container, to, &iocb->ki_pos, 0);
}
@@ -43,12 +41,10 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to)
{
struct file *coda_file = iocb->ki_filp;
struct inode *coda_inode = file_inode(coda_file);
- struct coda_file_info *cfi = CODA_FTOC(coda_file);
+ struct coda_file_info *cfi = coda_ftoc(coda_file);
struct file *host_file;
ssize_t ret;
- BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
-
host_file = cfi->cfi_container;
file_start_write(host_file);
inode_lock(coda_inode);
@@ -69,8 +65,7 @@ coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma)
struct file *host_file;
struct inode *coda_inode, *host_inode;
- cfi = CODA_FTOC(coda_file);
- BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
+ cfi = coda_ftoc(coda_file);
host_file = cfi->cfi_container;
if (!host_file->f_op->mmap)
@@ -142,8 +137,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file)
struct inode *host_inode;
int err;
- cfi = CODA_FTOC(coda_file);
- BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
+ cfi = coda_ftoc(coda_file);
err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode),
coda_flags, coda_file->f_cred->fsuid);
@@ -185,8 +179,7 @@ int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync)
return err;
inode_lock(coda_inode);
- cfi = CODA_FTOC(coda_file);
- BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
+ cfi = coda_ftoc(coda_file);
host_file = cfi->cfi_container;
err = vfs_fsync(host_file, datasync);
--
2.4.11
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-10-19 8:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-19 8:19 [PATCH 0/7 linux-next] coda: fs clean-up Fabian Frederick
2018-10-19 8:19 ` [PATCH 1/7 linux-next] coda: remove CODA_FREE Fabian Frederick
2018-10-19 8:19 ` [PATCH 2/7 linux-next] coda: destroy mutex in put_super() Fabian Frederick
2018-10-19 8:19 ` [PATCH 3/7 linux-next] coda: use SIZE() for stat Fabian Frederick
2018-10-19 8:19 ` [PATCH 4/7 linux-next] coda: add __init to init_coda_psdev() Fabian Frederick
2018-10-19 8:19 ` [PATCH 5/7 linux-next] coda: remove sysctl object from module when unused Fabian Frederick
2018-10-19 8:19 ` [PATCH 6/7 linux-next] coda: remove sb test in coda_fid_to_inode() Fabian Frederick
2018-10-19 8:19 ` [PATCH 7/7 linux-next] coda: ftoc validity check integration Fabian Frederick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).