aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/namei.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2007-05-08 03:35:16 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:21 -0400
commit3bf25cb40d899eeb5a471f497e56ddfe2c96c019 (patch)
tree98d425edd6392d3037218851084dde6736e7ba32 /fs/udf/namei.c
parentff116fc8d1d43927c7651b91d5aec41eb30c4429 (diff)
udf: use get_bh()
Make UDF use get_bh() instead of directly accessing b_count and use brelse() instead of udf_release_data() which does just brelse()... Signed-off-by: Jan Kara <jack@suse.cz> Acked-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/namei.c')
-rw-r--r--fs/udf/namei.c136
1 files changed, 68 insertions, 68 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index f85ad13b3dff..91df4928651c 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -182,13 +182,13 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
182 182
183 if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block))) 183 if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block)))
184 { 184 {
185 udf_release_data(epos.bh); 185 brelse(epos.bh);
186 return NULL; 186 return NULL;
187 } 187 }
188 } 188 }
189 else 189 else
190 { 190 {
191 udf_release_data(epos.bh); 191 brelse(epos.bh);
192 return NULL; 192 return NULL;
193 } 193 }
194 194
@@ -199,9 +199,9 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
199 if (!fi) 199 if (!fi)
200 { 200 {
201 if (fibh->sbh != fibh->ebh) 201 if (fibh->sbh != fibh->ebh)
202 udf_release_data(fibh->ebh); 202 brelse(fibh->ebh);
203 udf_release_data(fibh->sbh); 203 brelse(fibh->sbh);
204 udf_release_data(epos.bh); 204 brelse(epos.bh);
205 return NULL; 205 return NULL;
206 } 206 }
207 207
@@ -247,15 +247,15 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
247 { 247 {
248 if (udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name)) 248 if (udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name))
249 { 249 {
250 udf_release_data(epos.bh); 250 brelse(epos.bh);
251 return fi; 251 return fi;
252 } 252 }
253 } 253 }
254 } 254 }
255 if (fibh->sbh != fibh->ebh) 255 if (fibh->sbh != fibh->ebh)
256 udf_release_data(fibh->ebh); 256 brelse(fibh->ebh);
257 udf_release_data(fibh->sbh); 257 brelse(fibh->sbh);
258 udf_release_data(epos.bh); 258 brelse(epos.bh);
259 return NULL; 259 return NULL;
260} 260}
261 261
@@ -321,8 +321,8 @@ udf_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
321 if (udf_find_entry(dir, dentry, &fibh, &cfi)) 321 if (udf_find_entry(dir, dentry, &fibh, &cfi))
322 { 322 {
323 if (fibh.sbh != fibh.ebh) 323 if (fibh.sbh != fibh.ebh)
324 udf_release_data(fibh.ebh); 324 brelse(fibh.ebh);
325 udf_release_data(fibh.sbh); 325 brelse(fibh.sbh);
326 326
327 inode = udf_iget(dir->i_sb, lelb_to_cpu(cfi.icb.extLocation)); 327 inode = udf_iget(dir->i_sb, lelb_to_cpu(cfi.icb.extLocation));
328 if ( !inode ) 328 if ( !inode )
@@ -400,7 +400,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
400 400
401 if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block))) 401 if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block)))
402 { 402 {
403 udf_release_data(epos.bh); 403 brelse(epos.bh);
404 *err = -EIO; 404 *err = -EIO;
405 return NULL; 405 return NULL;
406 } 406 }
@@ -423,9 +423,9 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
423 if (!fi) 423 if (!fi)
424 { 424 {
425 if (fibh->sbh != fibh->ebh) 425 if (fibh->sbh != fibh->ebh)
426 udf_release_data(fibh->ebh); 426 brelse(fibh->ebh);
427 udf_release_data(fibh->sbh); 427 brelse(fibh->sbh);
428 udf_release_data(epos.bh); 428 brelse(epos.bh);
429 *err = -EIO; 429 *err = -EIO;
430 return NULL; 430 return NULL;
431 } 431 }
@@ -455,7 +455,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
455 { 455 {
456 if (((sizeof(struct fileIdentDesc) + liu + lfi + 3) & ~3) == nfidlen) 456 if (((sizeof(struct fileIdentDesc) + liu + lfi + 3) & ~3) == nfidlen)
457 { 457 {
458 udf_release_data(epos.bh); 458 brelse(epos.bh);
459 cfi->descTag.tagSerialNum = cpu_to_le16(1); 459 cfi->descTag.tagSerialNum = cpu_to_le16(1);
460 cfi->fileVersionNum = cpu_to_le16(1); 460 cfi->fileVersionNum = cpu_to_le16(1);
461 cfi->fileCharacteristics = 0; 461 cfi->fileCharacteristics = 0;
@@ -478,9 +478,9 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
478 udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name)) 478 udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name))
479 { 479 {
480 if (fibh->sbh != fibh->ebh) 480 if (fibh->sbh != fibh->ebh)
481 udf_release_data(fibh->ebh); 481 brelse(fibh->ebh);
482 udf_release_data(fibh->sbh); 482 brelse(fibh->sbh);
483 udf_release_data(epos.bh); 483 brelse(epos.bh);
484 *err = -EEXIST; 484 *err = -EEXIST;
485 return NULL; 485 return NULL;
486 } 486 }
@@ -492,14 +492,14 @@ add:
492 if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB && 492 if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB &&
493 sb->s_blocksize - fibh->eoffset < nfidlen) 493 sb->s_blocksize - fibh->eoffset < nfidlen)
494 { 494 {
495 udf_release_data(epos.bh); 495 brelse(epos.bh);
496 epos.bh = NULL; 496 epos.bh = NULL;
497 fibh->soffset -= udf_ext0_offset(dir); 497 fibh->soffset -= udf_ext0_offset(dir);
498 fibh->eoffset -= udf_ext0_offset(dir); 498 fibh->eoffset -= udf_ext0_offset(dir);
499 f_pos -= (udf_ext0_offset(dir) >> 2); 499 f_pos -= (udf_ext0_offset(dir) >> 2);
500 if (fibh->sbh != fibh->ebh) 500 if (fibh->sbh != fibh->ebh)
501 udf_release_data(fibh->ebh); 501 brelse(fibh->ebh);
502 udf_release_data(fibh->sbh); 502 brelse(fibh->sbh);
503 if (!(fibh->sbh = fibh->ebh = udf_expand_dir_adinicb(dir, &block, err))) 503 if (!(fibh->sbh = fibh->ebh = udf_expand_dir_adinicb(dir, &block, err)))
504 return NULL; 504 return NULL;
505 epos.block = UDF_I_LOCATION(dir); 505 epos.block = UDF_I_LOCATION(dir);
@@ -519,7 +519,7 @@ add:
519 fibh->eoffset += nfidlen; 519 fibh->eoffset += nfidlen;
520 if (fibh->sbh != fibh->ebh) 520 if (fibh->sbh != fibh->ebh)
521 { 521 {
522 udf_release_data(fibh->sbh); 522 brelse(fibh->sbh);
523 fibh->sbh = fibh->ebh; 523 fibh->sbh = fibh->ebh;
524 } 524 }
525 525
@@ -541,7 +541,7 @@ add:
541 fibh->eoffset += nfidlen - sb->s_blocksize; 541 fibh->eoffset += nfidlen - sb->s_blocksize;
542 if (fibh->sbh != fibh->ebh) 542 if (fibh->sbh != fibh->ebh)
543 { 543 {
544 udf_release_data(fibh->sbh); 544 brelse(fibh->sbh);
545 fibh->sbh = fibh->ebh; 545 fibh->sbh = fibh->ebh;
546 } 546 }
547 547
@@ -550,8 +550,8 @@ add:
550 550
551 if (!(fibh->ebh = udf_bread(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), 1, err))) 551 if (!(fibh->ebh = udf_bread(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), 1, err)))
552 { 552 {
553 udf_release_data(epos.bh); 553 brelse(epos.bh);
554 udf_release_data(fibh->sbh); 554 brelse(fibh->sbh);
555 return NULL; 555 return NULL;
556 } 556 }
557 557
@@ -566,7 +566,7 @@ add:
566 else 566 else
567 block ++; 567 block ++;
568 568
569 udf_release_data(fibh->sbh); 569 brelse(fibh->sbh);
570 fibh->sbh = fibh->ebh; 570 fibh->sbh = fibh->ebh;
571 fi = (struct fileIdentDesc *)(fibh->sbh->b_data); 571 fi = (struct fileIdentDesc *)(fibh->sbh->b_data);
572 } 572 }
@@ -587,7 +587,7 @@ add:
587 cfi->lengthOfImpUse = cpu_to_le16(0); 587 cfi->lengthOfImpUse = cpu_to_le16(0);
588 if (!udf_write_fi(dir, cfi, fi, fibh, NULL, name)) 588 if (!udf_write_fi(dir, cfi, fi, fibh, NULL, name))
589 { 589 {
590 udf_release_data(epos.bh); 590 brelse(epos.bh);
591 dir->i_size += nfidlen; 591 dir->i_size += nfidlen;
592 if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) 592 if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
593 UDF_I_LENALLOC(dir) += nfidlen; 593 UDF_I_LENALLOC(dir) += nfidlen;
@@ -596,10 +596,10 @@ add:
596 } 596 }
597 else 597 else
598 { 598 {
599 udf_release_data(epos.bh); 599 brelse(epos.bh);
600 if (fibh->sbh != fibh->ebh) 600 if (fibh->sbh != fibh->ebh)
601 udf_release_data(fibh->ebh); 601 brelse(fibh->ebh);
602 udf_release_data(fibh->sbh); 602 brelse(fibh->sbh);
603 *err = -EIO; 603 *err = -EIO;
604 return NULL; 604 return NULL;
605 } 605 }
@@ -656,8 +656,8 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, struct
656 mark_inode_dirty(dir); 656 mark_inode_dirty(dir);
657 } 657 }
658 if (fibh.sbh != fibh.ebh) 658 if (fibh.sbh != fibh.ebh)
659 udf_release_data(fibh.ebh); 659 brelse(fibh.ebh);
660 udf_release_data(fibh.sbh); 660 brelse(fibh.sbh);
661 unlock_kernel(); 661 unlock_kernel();
662 d_instantiate(dentry, inode); 662 d_instantiate(dentry, inode);
663 return 0; 663 return 0;
@@ -701,8 +701,8 @@ static int udf_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t
701 mark_inode_dirty(inode); 701 mark_inode_dirty(inode);
702 702
703 if (fibh.sbh != fibh.ebh) 703 if (fibh.sbh != fibh.ebh)
704 udf_release_data(fibh.ebh); 704 brelse(fibh.ebh);
705 udf_release_data(fibh.sbh); 705 brelse(fibh.sbh);
706 d_instantiate(dentry, inode); 706 d_instantiate(dentry, inode);
707 err = 0; 707 err = 0;
708out: 708out:
@@ -743,7 +743,7 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode)
743 cpu_to_le32(UDF_I_UNIQUE(dir) & 0x00000000FFFFFFFFUL); 743 cpu_to_le32(UDF_I_UNIQUE(dir) & 0x00000000FFFFFFFFUL);
744 cfi.fileCharacteristics = FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT; 744 cfi.fileCharacteristics = FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT;
745 udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL); 745 udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL);
746 udf_release_data(fibh.sbh); 746 brelse(fibh.sbh);
747 inode->i_mode = S_IFDIR | mode; 747 inode->i_mode = S_IFDIR | mode;
748 if (dir->i_mode & S_ISGID) 748 if (dir->i_mode & S_ISGID)
749 inode->i_mode |= S_ISGID; 749 inode->i_mode |= S_ISGID;
@@ -766,8 +766,8 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode)
766 mark_inode_dirty(dir); 766 mark_inode_dirty(dir);
767 d_instantiate(dentry, inode); 767 d_instantiate(dentry, inode);
768 if (fibh.sbh != fibh.ebh) 768 if (fibh.sbh != fibh.ebh)
769 udf_release_data(fibh.ebh); 769 brelse(fibh.ebh);
770 udf_release_data(fibh.sbh); 770 brelse(fibh.sbh);
771 err = 0; 771 err = 0;
772out: 772out:
773 unlock_kernel(); 773 unlock_kernel();
@@ -808,13 +808,13 @@ static int empty_dir(struct inode *dir)
808 808
809 if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block))) 809 if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block)))
810 { 810 {
811 udf_release_data(epos.bh); 811 brelse(epos.bh);
812 return 0; 812 return 0;
813 } 813 }
814 } 814 }
815 else 815 else
816 { 816 {
817 udf_release_data(epos.bh); 817 brelse(epos.bh);
818 return 0; 818 return 0;
819 } 819 }
820 820
@@ -826,25 +826,25 @@ static int empty_dir(struct inode *dir)
826 if (!fi) 826 if (!fi)
827 { 827 {
828 if (fibh.sbh != fibh.ebh) 828 if (fibh.sbh != fibh.ebh)
829 udf_release_data(fibh.ebh); 829 brelse(fibh.ebh);
830 udf_release_data(fibh.sbh); 830 brelse(fibh.sbh);
831 udf_release_data(epos.bh); 831 brelse(epos.bh);
832 return 0; 832 return 0;
833 } 833 }
834 834
835 if (cfi.lengthFileIdent && (cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) == 0) 835 if (cfi.lengthFileIdent && (cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) == 0)
836 { 836 {
837 if (fibh.sbh != fibh.ebh) 837 if (fibh.sbh != fibh.ebh)
838 udf_release_data(fibh.ebh); 838 brelse(fibh.ebh);
839 udf_release_data(fibh.sbh); 839 brelse(fibh.sbh);
840 udf_release_data(epos.bh); 840 brelse(epos.bh);
841 return 0; 841 return 0;
842 } 842 }
843 } 843 }
844 if (fibh.sbh != fibh.ebh) 844 if (fibh.sbh != fibh.ebh)
845 udf_release_data(fibh.ebh); 845 brelse(fibh.ebh);
846 udf_release_data(fibh.sbh); 846 brelse(fibh.sbh);
847 udf_release_data(epos.bh); 847 brelse(epos.bh);
848 return 1; 848 return 1;
849} 849}
850 850
@@ -884,8 +884,8 @@ static int udf_rmdir(struct inode * dir, struct dentry * dentry)
884 884
885end_rmdir: 885end_rmdir:
886 if (fibh.sbh != fibh.ebh) 886 if (fibh.sbh != fibh.ebh)
887 udf_release_data(fibh.ebh); 887 brelse(fibh.ebh);
888 udf_release_data(fibh.sbh); 888 brelse(fibh.sbh);
889out: 889out:
890 unlock_kernel(); 890 unlock_kernel();
891 return retval; 891 return retval;
@@ -928,8 +928,8 @@ static int udf_unlink(struct inode * dir, struct dentry * dentry)
928 928
929end_unlink: 929end_unlink:
930 if (fibh.sbh != fibh.ebh) 930 if (fibh.sbh != fibh.ebh)
931 udf_release_data(fibh.ebh); 931 brelse(fibh.ebh);
932 udf_release_data(fibh.sbh); 932 brelse(fibh.sbh);
933out: 933out:
934 unlock_kernel(); 934 unlock_kernel();
935 return retval; 935 return retval;
@@ -977,7 +977,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
977 elen = inode->i_sb->s_blocksize; 977 elen = inode->i_sb->s_blocksize;
978 UDF_I_LENEXTENTS(inode) = elen; 978 UDF_I_LENEXTENTS(inode) = elen;
979 udf_add_aext(inode, &epos, eloc, elen, 0); 979 udf_add_aext(inode, &epos, eloc, elen, 0);
980 udf_release_data(epos.bh); 980 brelse(epos.bh);
981 981
982 block = udf_get_pblock(inode->i_sb, block, 982 block = udf_get_pblock(inode->i_sb, block,
983 UDF_I_LOCATION(inode).partitionReferenceNum, 0); 983 UDF_I_LOCATION(inode).partitionReferenceNum, 0);
@@ -1060,7 +1060,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
1060 } 1060 }
1061 } 1061 }
1062 1062
1063 udf_release_data(epos.bh); 1063 brelse(epos.bh);
1064 inode->i_size = elen; 1064 inode->i_size = elen;
1065 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) 1065 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
1066 UDF_I_LENALLOC(inode) = inode->i_size; 1066 UDF_I_LENALLOC(inode) = inode->i_size;
@@ -1089,8 +1089,8 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
1089 mark_inode_dirty(dir); 1089 mark_inode_dirty(dir);
1090 } 1090 }
1091 if (fibh.sbh != fibh.ebh) 1091 if (fibh.sbh != fibh.ebh)
1092 udf_release_data(fibh.ebh); 1092 brelse(fibh.ebh);
1093 udf_release_data(fibh.sbh); 1093 brelse(fibh.sbh);
1094 d_instantiate(dentry, inode); 1094 d_instantiate(dentry, inode);
1095 err = 0; 1095 err = 0;
1096 1096
@@ -1145,8 +1145,8 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir,
1145 mark_inode_dirty(dir); 1145 mark_inode_dirty(dir);
1146 } 1146 }
1147 if (fibh.sbh != fibh.ebh) 1147 if (fibh.sbh != fibh.ebh)
1148 udf_release_data(fibh.ebh); 1148 brelse(fibh.ebh);
1149 udf_release_data(fibh.sbh); 1149 brelse(fibh.sbh);
1150 inc_nlink(inode); 1150 inc_nlink(inode);
1151 inode->i_ctime = current_fs_time(inode->i_sb); 1151 inode->i_ctime = current_fs_time(inode->i_sb);
1152 mark_inode_dirty(inode); 1152 mark_inode_dirty(inode);
@@ -1174,8 +1174,8 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
1174 if ((ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi))) 1174 if ((ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi)))
1175 { 1175 {
1176 if (ofibh.sbh != ofibh.ebh) 1176 if (ofibh.sbh != ofibh.ebh)
1177 udf_release_data(ofibh.ebh); 1177 brelse(ofibh.ebh);
1178 udf_release_data(ofibh.sbh); 1178 brelse(ofibh.sbh);
1179 } 1179 }
1180 tloc = lelb_to_cpu(ocfi.icb.extLocation); 1180 tloc = lelb_to_cpu(ocfi.icb.extLocation);
1181 if (!ofi || udf_get_lb_pblock(old_dir->i_sb, tloc, 0) 1181 if (!ofi || udf_get_lb_pblock(old_dir->i_sb, tloc, 0)
@@ -1188,8 +1188,8 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
1188 if (!new_inode) 1188 if (!new_inode)
1189 { 1189 {
1190 if (nfibh.sbh != nfibh.ebh) 1190 if (nfibh.sbh != nfibh.ebh)
1191 udf_release_data(nfibh.ebh); 1191 brelse(nfibh.ebh);
1192 udf_release_data(nfibh.sbh); 1192 brelse(nfibh.sbh);
1193 nfi = NULL; 1193 nfi = NULL;
1194 } 1194 }
1195 } 1195 }
@@ -1290,19 +1290,19 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
1290 if (ofi) 1290 if (ofi)
1291 { 1291 {
1292 if (ofibh.sbh != ofibh.ebh) 1292 if (ofibh.sbh != ofibh.ebh)
1293 udf_release_data(ofibh.ebh); 1293 brelse(ofibh.ebh);
1294 udf_release_data(ofibh.sbh); 1294 brelse(ofibh.sbh);
1295 } 1295 }
1296 1296
1297 retval = 0; 1297 retval = 0;
1298 1298
1299end_rename: 1299end_rename:
1300 udf_release_data(dir_bh); 1300 brelse(dir_bh);
1301 if (nfi) 1301 if (nfi)
1302 { 1302 {
1303 if (nfibh.sbh != nfibh.ebh) 1303 if (nfibh.sbh != nfibh.ebh)
1304 udf_release_data(nfibh.ebh); 1304 brelse(nfibh.ebh);
1305 udf_release_data(nfibh.sbh); 1305 brelse(nfibh.sbh);
1306 } 1306 }
1307 unlock_kernel(); 1307 unlock_kernel();
1308 return retval; 1308 return retval;