Commit 5fd31e9a67dd6c80e49240514cf854c1f054aca2
Committed by
Linus Torvalds
1 parent
ed36f72367
Exists in
master
and in
7 other branches
coda: cleanup downcall handler
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>
Showing 1 changed file with 54 additions and 65 deletions Side-by-side Diff
fs/coda/upcall.c
... | ... | @@ -859,77 +859,66 @@ |
859 | 859 | |
860 | 860 | int coda_downcall(int opcode, union outputArgs * out, struct super_block *sb) |
861 | 861 | { |
862 | + struct inode *inode = NULL; | |
863 | + struct CodaFid *fid, *newfid; | |
864 | + | |
862 | 865 | /* Handle invalidation requests. */ |
863 | - if ( !sb || !sb->s_root || !sb->s_root->d_inode) | |
864 | - return 0; | |
866 | + if ( !sb || !sb->s_root) | |
867 | + return 0; | |
865 | 868 | |
866 | - switch (opcode) { | |
869 | + switch (opcode) { | |
870 | + case CODA_FLUSH: | |
871 | + coda_cache_clear_all(sb); | |
872 | + shrink_dcache_sb(sb); | |
873 | + if (sb->s_root->d_inode) | |
874 | + coda_flag_inode(sb->s_root->d_inode, C_FLUSH); | |
875 | + break; | |
867 | 876 | |
868 | - case CODA_FLUSH : { | |
869 | - coda_cache_clear_all(sb); | |
870 | - shrink_dcache_sb(sb); | |
871 | - coda_flag_inode(sb->s_root->d_inode, C_FLUSH); | |
872 | - return(0); | |
873 | - } | |
877 | + case CODA_PURGEUSER: | |
878 | + coda_cache_clear_all(sb); | |
879 | + break; | |
874 | 880 | |
875 | - case CODA_PURGEUSER : { | |
876 | - coda_cache_clear_all(sb); | |
877 | - return(0); | |
878 | - } | |
881 | + case CODA_ZAPDIR: | |
882 | + fid = &out->coda_zapdir.CodaFid; | |
883 | + inode = coda_fid_to_inode(fid, sb); | |
884 | + if (inode) { | |
885 | + coda_flag_inode_children(inode, C_PURGE); | |
886 | + coda_flag_inode(inode, C_VATTR); | |
887 | + } | |
888 | + break; | |
879 | 889 | |
880 | - case CODA_ZAPDIR : { | |
881 | - struct inode *inode; | |
882 | - struct CodaFid *fid = &out->coda_zapdir.CodaFid; | |
890 | + case CODA_ZAPFILE: | |
891 | + fid = &out->coda_zapfile.CodaFid; | |
892 | + inode = coda_fid_to_inode(fid, sb); | |
893 | + if (inode) | |
894 | + coda_flag_inode(inode, C_VATTR); | |
895 | + break; | |
883 | 896 | |
884 | - inode = coda_fid_to_inode(fid, sb); | |
885 | - if (inode) { | |
886 | - coda_flag_inode_children(inode, C_PURGE); | |
887 | - coda_flag_inode(inode, C_VATTR); | |
888 | - iput(inode); | |
889 | - } | |
890 | - | |
891 | - return(0); | |
892 | - } | |
893 | - | |
894 | - case CODA_ZAPFILE : { | |
895 | - struct inode *inode; | |
896 | - struct CodaFid *fid = &out->coda_zapfile.CodaFid; | |
897 | - inode = coda_fid_to_inode(fid, sb); | |
898 | - if ( inode ) { | |
899 | - coda_flag_inode(inode, C_VATTR); | |
900 | - iput(inode); | |
901 | - } | |
902 | - return 0; | |
903 | - } | |
904 | - | |
905 | - case CODA_PURGEFID : { | |
906 | - struct inode *inode; | |
907 | - struct CodaFid *fid = &out->coda_purgefid.CodaFid; | |
908 | - inode = coda_fid_to_inode(fid, sb); | |
909 | - if ( inode ) { | |
897 | + case CODA_PURGEFID: | |
898 | + fid = &out->coda_purgefid.CodaFid; | |
899 | + inode = coda_fid_to_inode(fid, sb); | |
900 | + if (inode) { | |
910 | 901 | coda_flag_inode_children(inode, C_PURGE); |
911 | 902 | |
912 | 903 | /* catch the dentries later if some are still busy */ |
913 | 904 | coda_flag_inode(inode, C_PURGE); |
914 | 905 | d_prune_aliases(inode); |
915 | 906 | |
916 | - iput(inode); | |
917 | - } | |
918 | - return 0; | |
919 | - } | |
907 | + } | |
908 | + break; | |
920 | 909 | |
921 | - case CODA_REPLACE : { | |
922 | - struct inode *inode; | |
923 | - struct CodaFid *oldfid = &out->coda_replace.OldFid; | |
924 | - struct CodaFid *newfid = &out->coda_replace.NewFid; | |
925 | - inode = coda_fid_to_inode(oldfid, sb); | |
926 | - if ( inode ) { | |
927 | - coda_replace_fid(inode, oldfid, newfid); | |
928 | - iput(inode); | |
929 | - } | |
930 | - return 0; | |
931 | - } | |
932 | - } | |
933 | - return 0; | |
910 | + case CODA_REPLACE: | |
911 | + fid = &out->coda_replace.OldFid; | |
912 | + newfid = &out->coda_replace.NewFid; | |
913 | + inode = coda_fid_to_inode(fid, sb); | |
914 | + if (inode) | |
915 | + coda_replace_fid(inode, fid, newfid); | |
916 | + break; | |
917 | + } | |
918 | + | |
919 | + if (inode) | |
920 | + iput(inode); | |
921 | + | |
922 | + return 0; | |
934 | 923 | } |