aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Harkes <jaharkes@cs.cmu.edu>2007-07-19 04:48:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:48 -0400
commita1b0aa87647493c0201821ab884e86298d5da7d6 (patch)
treedf7c97e4ae6469b238f0f507eed86d906a5539b3
parent5fd31e9a67dd6c80e49240514cf854c1f054aca2 (diff)
coda: remove struct coda_sb_info
The sb_info structure only contains a single pointer to the character device, there is no need for the added indirection. Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/coda/cache.c5
-rw-r--r--fs/coda/inode.c32
-rw-r--r--fs/coda/upcall.c79
-rw-r--r--include/linux/coda_psdev.h9
4 files changed, 49 insertions, 76 deletions
diff --git a/fs/coda/cache.c b/fs/coda/cache.c
index 11538a2b542..8a2370341c7 100644
--- a/fs/coda/cache.c
+++ b/fs/coda/cache.c
@@ -49,11 +49,6 @@ void coda_cache_clear_inode(struct inode *inode)
49/* remove all acl caches */ 49/* remove all acl caches */
50void coda_cache_clear_all(struct super_block *sb) 50void coda_cache_clear_all(struct super_block *sb)
51{ 51{
52 struct coda_sb_info *sbi;
53
54 sbi = coda_sbp(sb);
55 BUG_ON(!sbi);
56
57 atomic_inc(&permission_epoch); 52 atomic_inc(&permission_epoch);
58} 53}
59 54
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 29e44176560..6771a4271e3 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -141,11 +141,10 @@ static int get_device_index(struct coda_mount_data *data)
141 141
142static int coda_fill_super(struct super_block *sb, void *data, int silent) 142static int coda_fill_super(struct super_block *sb, void *data, int silent)
143{ 143{
144 struct inode *root = NULL; 144 struct inode *root = NULL;
145 struct coda_sb_info *sbi = NULL;
146 struct venus_comm *vc = NULL; 145 struct venus_comm *vc = NULL;
147 struct CodaFid fid; 146 struct CodaFid fid;
148 int error; 147 int error;
149 int idx; 148 int idx;
150 149
151 idx = get_device_index((struct coda_mount_data *) data); 150 idx = get_device_index((struct coda_mount_data *) data);
@@ -167,16 +166,9 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
167 return -EBUSY; 166 return -EBUSY;
168 } 167 }
169 168
170 sbi = kmalloc(sizeof(struct coda_sb_info), GFP_KERNEL);
171 if(!sbi) {
172 return -ENOMEM;
173 }
174
175 vc->vc_sb = sb; 169 vc->vc_sb = sb;
176 170
177 sbi->sbi_vcomm = vc; 171 sb->s_fs_info = vc;
178
179 sb->s_fs_info = sbi;
180 sb->s_flags |= MS_NOATIME; 172 sb->s_flags |= MS_NOATIME;
181 sb->s_blocksize = 4096; /* XXXXX what do we put here?? */ 173 sb->s_blocksize = 4096; /* XXXXX what do we put here?? */
182 sb->s_blocksize_bits = 12; 174 sb->s_blocksize_bits = 12;
@@ -207,26 +199,20 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
207 return 0; 199 return 0;
208 200
209 error: 201 error:
210 if (sbi) {
211 kfree(sbi);
212 if(vc)
213 vc->vc_sb = NULL;
214 }
215 if (root) 202 if (root)
216 iput(root); 203 iput(root);
204 if (vc)
205 vc->vc_sb = NULL;
217 206
218 return -EINVAL; 207 return -EINVAL;
219} 208}
220 209
221static void coda_put_super(struct super_block *sb) 210static void coda_put_super(struct super_block *sb)
222{ 211{
223 struct coda_sb_info *sbi; 212 coda_vcp(sb)->vc_sb = NULL;
224 213 sb->s_fs_info = NULL;
225 sbi = coda_sbp(sb);
226 sbi->sbi_vcomm->vc_sb = NULL;
227 214
228 printk("Coda: Bye bye.\n"); 215 printk("Coda: Bye bye.\n");
229 kfree(sbi);
230} 216}
231 217
232static void coda_clear_inode(struct inode *inode) 218static void coda_clear_inode(struct inode *inode)
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index 87601e14764..9a20a3b1998 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -37,7 +37,7 @@
37#include <linux/coda_cache.h> 37#include <linux/coda_cache.h>
38#include <linux/coda_proc.h> 38#include <linux/coda_proc.h>
39 39
40static int coda_upcall(struct coda_sb_info *mntinfo, int inSize, int *outSize, 40static int coda_upcall(struct venus_comm *vc, int inSize, int *outSize,
41 union inputArgs *buffer); 41 union inputArgs *buffer);
42 42
43static void *alloc_upcall(int opcode, int size) 43static void *alloc_upcall(int opcode, int size)
@@ -83,7 +83,7 @@ int venus_rootfid(struct super_block *sb, struct CodaFid *fidp)
83 insize = SIZE(root); 83 insize = SIZE(root);
84 UPARG(CODA_ROOT); 84 UPARG(CODA_ROOT);
85 85
86 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 86 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
87 if (!error) 87 if (!error)
88 *fidp = outp->coda_root.VFid; 88 *fidp = outp->coda_root.VFid;
89 89
@@ -102,7 +102,7 @@ int venus_getattr(struct super_block *sb, struct CodaFid *fid,
102 UPARG(CODA_GETATTR); 102 UPARG(CODA_GETATTR);
103 inp->coda_getattr.VFid = *fid; 103 inp->coda_getattr.VFid = *fid;
104 104
105 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 105 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
106 if (!error) 106 if (!error)
107 *attr = outp->coda_getattr.attr; 107 *attr = outp->coda_getattr.attr;
108 108
@@ -123,7 +123,7 @@ int venus_setattr(struct super_block *sb, struct CodaFid *fid,
123 inp->coda_setattr.VFid = *fid; 123 inp->coda_setattr.VFid = *fid;
124 inp->coda_setattr.attr = *vattr; 124 inp->coda_setattr.attr = *vattr;
125 125
126 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 126 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
127 127
128 CODA_FREE(inp, insize); 128 CODA_FREE(inp, insize);
129 return error; 129 return error;
@@ -149,7 +149,7 @@ int venus_lookup(struct super_block *sb, struct CodaFid *fid,
149 memcpy((char *)(inp) + offset, name, length); 149 memcpy((char *)(inp) + offset, name, length);
150 *((char *)inp + offset + length) = '\0'; 150 *((char *)inp + offset + length) = '\0';
151 151
152 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 152 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
153 if (!error) { 153 if (!error) {
154 *resfid = outp->coda_lookup.VFid; 154 *resfid = outp->coda_lookup.VFid;
155 *type = outp->coda_lookup.vtype; 155 *type = outp->coda_lookup.vtype;
@@ -182,7 +182,7 @@ int venus_store(struct super_block *sb, struct CodaFid *fid, int flags,
182 inp->coda_store.VFid = *fid; 182 inp->coda_store.VFid = *fid;
183 inp->coda_store.flags = flags; 183 inp->coda_store.flags = flags;
184 184
185 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 185 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
186 186
187 CODA_FREE(inp, insize); 187 CODA_FREE(inp, insize);
188 return error; 188 return error;
@@ -200,7 +200,7 @@ int venus_release(struct super_block *sb, struct CodaFid *fid, int flags)
200 inp->coda_release.VFid = *fid; 200 inp->coda_release.VFid = *fid;
201 inp->coda_release.flags = flags; 201 inp->coda_release.flags = flags;
202 202
203 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 203 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
204 204
205 CODA_FREE(inp, insize); 205 CODA_FREE(inp, insize);
206 return error; 206 return error;
@@ -229,7 +229,7 @@ int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
229 inp->coda_close.VFid = *fid; 229 inp->coda_close.VFid = *fid;
230 inp->coda_close.flags = flags; 230 inp->coda_close.flags = flags;
231 231
232 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 232 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
233 233
234 CODA_FREE(inp, insize); 234 CODA_FREE(inp, insize);
235 return error; 235 return error;
@@ -248,7 +248,7 @@ int venus_open(struct super_block *sb, struct CodaFid *fid,
248 inp->coda_open_by_fd.VFid = *fid; 248 inp->coda_open_by_fd.VFid = *fid;
249 inp->coda_open_by_fd.flags = flags; 249 inp->coda_open_by_fd.flags = flags;
250 250
251 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 251 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
252 if (!error) 252 if (!error)
253 *fh = outp->coda_open_by_fd.fh; 253 *fh = outp->coda_open_by_fd.fh;
254 254
@@ -276,7 +276,7 @@ int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid,
276 memcpy((char *)(inp) + offset, name, length); 276 memcpy((char *)(inp) + offset, name, length);
277 *((char *)inp + offset + length) = '\0'; 277 *((char *)inp + offset + length) = '\0';
278 278
279 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 279 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
280 if (!error) { 280 if (!error) {
281 *attrs = outp->coda_mkdir.attr; 281 *attrs = outp->coda_mkdir.attr;
282 *newfid = outp->coda_mkdir.VFid; 282 *newfid = outp->coda_mkdir.VFid;
@@ -318,7 +318,7 @@ int venus_rename(struct super_block *sb, struct CodaFid *old_fid,
318 memcpy((char *)(inp) + offset, new_name, new_length); 318 memcpy((char *)(inp) + offset, new_name, new_length);
319 *((char *)inp + offset + new_length) = '\0'; 319 *((char *)inp + offset + new_length) = '\0';
320 320
321 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 321 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
322 322
323 CODA_FREE(inp, insize); 323 CODA_FREE(inp, insize);
324 return error; 324 return error;
@@ -347,7 +347,7 @@ int venus_create(struct super_block *sb, struct CodaFid *dirfid,
347 memcpy((char *)(inp) + offset, name, length); 347 memcpy((char *)(inp) + offset, name, length);
348 *((char *)inp + offset + length) = '\0'; 348 *((char *)inp + offset + length) = '\0';
349 349
350 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 350 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
351 if (!error) { 351 if (!error) {
352 *attrs = outp->coda_create.attr; 352 *attrs = outp->coda_create.attr;
353 *newfid = outp->coda_create.VFid; 353 *newfid = outp->coda_create.VFid;
@@ -373,8 +373,8 @@ int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid,
373 inp->coda_rmdir.name = offset; 373 inp->coda_rmdir.name = offset;
374 memcpy((char *)(inp) + offset, name, length); 374 memcpy((char *)(inp) + offset, name, length);
375 *((char *)inp + offset + length) = '\0'; 375 *((char *)inp + offset + length) = '\0';
376 376
377 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 377 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
378 378
379 CODA_FREE(inp, insize); 379 CODA_FREE(inp, insize);
380 return error; 380 return error;
@@ -395,8 +395,8 @@ int venus_remove(struct super_block *sb, struct CodaFid *dirfid,
395 inp->coda_remove.name = offset; 395 inp->coda_remove.name = offset;
396 memcpy((char *)(inp) + offset, name, length); 396 memcpy((char *)(inp) + offset, name, length);
397 *((char *)inp + offset + length) = '\0'; 397 *((char *)inp + offset + length) = '\0';
398 398
399 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 399 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
400 400
401 CODA_FREE(inp, insize); 401 CODA_FREE(inp, insize);
402 return error; 402 return error;
@@ -417,7 +417,7 @@ int venus_readlink(struct super_block *sb, struct CodaFid *fid,
417 417
418 inp->coda_readlink.VFid = *fid; 418 inp->coda_readlink.VFid = *fid;
419 419
420 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 420 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
421 if (!error) { 421 if (!error) {
422 retlen = outp->coda_readlink.count; 422 retlen = outp->coda_readlink.count;
423 if ( retlen > *length ) 423 if ( retlen > *length )
@@ -453,8 +453,8 @@ int venus_link(struct super_block *sb, struct CodaFid *fid,
453 /* make sure strings are null terminated */ 453 /* make sure strings are null terminated */
454 memcpy((char *)(inp) + offset, name, len); 454 memcpy((char *)(inp) + offset, name, len);
455 *((char *)inp + offset + len) = '\0'; 455 *((char *)inp + offset + len) = '\0';
456 456
457 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 457 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
458 458
459 CODA_FREE(inp, insize); 459 CODA_FREE(inp, insize);
460 return error; 460 return error;
@@ -489,7 +489,7 @@ int venus_symlink(struct super_block *sb, struct CodaFid *fid,
489 memcpy((char *)(inp) + offset, name, len); 489 memcpy((char *)(inp) + offset, name, len);
490 *((char *)inp + offset + len) = '\0'; 490 *((char *)inp + offset + len) = '\0';
491 491
492 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 492 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
493 493
494 CODA_FREE(inp, insize); 494 CODA_FREE(inp, insize);
495 return error; 495 return error;
@@ -504,9 +504,9 @@ int venus_fsync(struct super_block *sb, struct CodaFid *fid)
504 insize=SIZE(fsync); 504 insize=SIZE(fsync);
505 UPARG(CODA_FSYNC); 505 UPARG(CODA_FSYNC);
506 506
507 inp->coda_fsync.VFid = *fid; 507 inp->coda_fsync.VFid = *fid;
508 error = coda_upcall(coda_sbp(sb), sizeof(union inputArgs), 508 error = coda_upcall(coda_vcp(sb), sizeof(union inputArgs),
509 &outsize, inp); 509 &outsize, inp);
510 510
511 CODA_FREE(inp, insize); 511 CODA_FREE(inp, insize);
512 return error; 512 return error;
@@ -524,7 +524,7 @@ int venus_access(struct super_block *sb, struct CodaFid *fid, int mask)
524 inp->coda_access.VFid = *fid; 524 inp->coda_access.VFid = *fid;
525 inp->coda_access.flags = mask; 525 inp->coda_access.flags = mask;
526 526
527 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 527 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
528 528
529 CODA_FREE(inp, insize); 529 CODA_FREE(inp, insize);
530 return error; 530 return error;
@@ -573,9 +573,9 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
573 goto exit; 573 goto exit;
574 } 574 }
575 575
576 error = coda_upcall(coda_sbp(sb), SIZE(ioctl) + data->vi.in_size, 576 error = coda_upcall(coda_vcp(sb), SIZE(ioctl) + data->vi.in_size,
577 &outsize, inp); 577 &outsize, inp);
578 578
579 if (error) { 579 if (error) {
580 printk("coda_pioctl: Venus returns: %d for %s\n", 580 printk("coda_pioctl: Venus returns: %d for %s\n",
581 error, coda_f2s(fid)); 581 error, coda_f2s(fid));
@@ -615,7 +615,7 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs)
615 insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs)); 615 insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs));
616 UPARG(CODA_STATFS); 616 UPARG(CODA_STATFS);
617 617
618 error = coda_upcall(coda_sbp(dentry->d_sb), insize, &outsize, inp); 618 error = coda_upcall(coda_vcp(dentry->d_sb), insize, &outsize, inp);
619 if (!error) { 619 if (!error) {
620 sfs->f_blocks = outp->coda_statfs.stat.f_blocks; 620 sfs->f_blocks = outp->coda_statfs.stat.f_blocks;
621 sfs->f_bfree = outp->coda_statfs.stat.f_bfree; 621 sfs->f_bfree = outp->coda_statfs.stat.f_bfree;
@@ -710,28 +710,25 @@ static inline void coda_waitfor_upcall(struct upc_req *req)
710} 710}
711 711
712 712
713/* 713/*
714 * coda_upcall will return an error in the case of 714 * coda_upcall will return an error in the case of
715 * failed communication with Venus _or_ will peek at Venus 715 * failed communication with Venus _or_ will peek at Venus
716 * reply and return Venus' error. 716 * reply and return Venus' error.
717 * 717 *
718 * As venus has 2 types of errors, normal errors (positive) and internal 718 * As venus has 2 types of errors, normal errors (positive) and internal
719 * errors (negative), normal errors are negated, while internal errors 719 * errors (negative), normal errors are negated, while internal errors
720 * are all mapped to -EINTR, while showing a nice warning message. (jh) 720 * are all mapped to -EINTR, while showing a nice warning message. (jh)
721 *
722 */ 721 */
723static int coda_upcall(struct coda_sb_info *sbi, 722static int coda_upcall(struct venus_comm *vcp,
724 int inSize, int *outSize, 723 int inSize, int *outSize,
725 union inputArgs *buffer) 724 union inputArgs *buffer)
726{ 725{
727 struct venus_comm *vcommp;
728 union outputArgs *out; 726 union outputArgs *out;
729 union inputArgs *sig_inputArgs; 727 union inputArgs *sig_inputArgs;
730 struct upc_req *req, *sig_req; 728 struct upc_req *req, *sig_req;
731 int error = 0; 729 int error = 0;
732 730
733 vcommp = sbi->sbi_vcomm; 731 if (!vcp->vc_inuse) {
734 if (!vcommp->vc_inuse) {
735 printk(KERN_NOTICE "coda: Venus dead, not sending upcall\n"); 732 printk(KERN_NOTICE "coda: Venus dead, not sending upcall\n");
736 return -ENXIO; 733 return -ENXIO;
737 } 734 }
@@ -746,16 +743,16 @@ static int coda_upcall(struct coda_sb_info *sbi,
746 req->uc_inSize = inSize; 743 req->uc_inSize = inSize;
747 req->uc_outSize = *outSize ? *outSize : inSize; 744 req->uc_outSize = *outSize ? *outSize : inSize;
748 req->uc_opcode = ((union inputArgs *)buffer)->ih.opcode; 745 req->uc_opcode = ((union inputArgs *)buffer)->ih.opcode;
749 req->uc_unique = ++vcommp->vc_seq; 746 req->uc_unique = ++vcp->vc_seq;
750 init_waitqueue_head(&req->uc_sleep); 747 init_waitqueue_head(&req->uc_sleep);
751 748
752 /* Fill in the common input args. */ 749 /* Fill in the common input args. */
753 ((union inputArgs *)buffer)->ih.unique = req->uc_unique; 750 ((union inputArgs *)buffer)->ih.unique = req->uc_unique;
754 751
755 /* Append msg to pending queue and poke Venus. */ 752 /* Append msg to pending queue and poke Venus. */
756 list_add_tail(&req->uc_chain, &vcommp->vc_pending); 753 list_add_tail(&req->uc_chain, &vcp->vc_pending);
757 754
758 wake_up_interruptible(&vcommp->vc_waitq); 755 wake_up_interruptible(&vcp->vc_waitq);
759 /* We can be interrupted while we wait for Venus to process 756 /* We can be interrupted while we wait for Venus to process
760 * our request. If the interrupt occurs before Venus has read 757 * our request. If the interrupt occurs before Venus has read
761 * the request, we dequeue and return. If it occurs after the 758 * the request, we dequeue and return. If it occurs after the
@@ -788,7 +785,7 @@ static int coda_upcall(struct coda_sb_info *sbi,
788 goto exit; 785 goto exit;
789 786
790 /* Venus saw the upcall, make sure we can send interrupt signal */ 787 /* Venus saw the upcall, make sure we can send interrupt signal */
791 if (!vcommp->vc_inuse) { 788 if (!vcp->vc_inuse) {
792 printk(KERN_INFO "coda: Venus dead, not sending signal.\n"); 789 printk(KERN_INFO "coda: Venus dead, not sending signal.\n");
793 goto exit; 790 goto exit;
794 } 791 }
@@ -815,8 +812,8 @@ static int coda_upcall(struct coda_sb_info *sbi,
815 sig_req->uc_outSize = sizeof(struct coda_in_hdr); 812 sig_req->uc_outSize = sizeof(struct coda_in_hdr);
816 813
817 /* insert at head of queue! */ 814 /* insert at head of queue! */
818 list_add(&(sig_req->uc_chain), &vcommp->vc_pending); 815 list_add(&(sig_req->uc_chain), &vcp->vc_pending);
819 wake_up_interruptible(&vcommp->vc_waitq); 816 wake_up_interruptible(&vcp->vc_waitq);
820 817
821exit: 818exit:
822 kfree(req); 819 kfree(req);
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index f28c2f7fd45..81b2e4c7d7c 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -8,11 +8,6 @@
8 8
9struct kstatfs; 9struct kstatfs;
10 10
11struct coda_sb_info
12{
13 struct venus_comm *sbi_vcomm;
14};
15
16/* communication pending/processing queues */ 11/* communication pending/processing queues */
17struct venus_comm { 12struct venus_comm {
18 u_long vc_seq; 13 u_long vc_seq;
@@ -24,9 +19,9 @@ struct venus_comm {
24}; 19};
25 20
26 21
27static inline struct coda_sb_info *coda_sbp(struct super_block *sb) 22static inline struct venus_comm *coda_vcp(struct super_block *sb)
28{ 23{
29 return ((struct coda_sb_info *)((sb)->s_fs_info)); 24 return (struct venus_comm *)((sb)->s_fs_info);
30} 25}
31 26
32 27