diff options
author | Jan Kara <jack@suse.cz> | 2007-05-08 03:35:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:21 -0400 |
commit | ff116fc8d1d43927c7651b91d5aec41eb30c4429 (patch) | |
tree | 9b452298e6f070be35b2d366ce4a10e4a1384d17 /fs/udf/namei.c | |
parent | 60448b1d6db4e82946ff9a2ac88df341f5fa87a2 (diff) |
UDF: introduce struct extent_position
Introduce a structure extent_position to store a position of an extent and
the corresponding buffer_head in one place.
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.c | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index b9859ac169c4..f85ad13b3dff 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -155,10 +155,10 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, | |||
155 | uint8_t lfi; | 155 | uint8_t lfi; |
156 | uint16_t liu; | 156 | uint16_t liu; |
157 | loff_t size; | 157 | loff_t size; |
158 | kernel_lb_addr bloc, eloc; | 158 | kernel_lb_addr eloc; |
159 | uint32_t extoffset, elen; | 159 | uint32_t elen; |
160 | sector_t offset; | 160 | sector_t offset; |
161 | struct buffer_head *bh = NULL; | 161 | struct extent_position epos = { NULL, 0, { 0, 0}}; |
162 | 162 | ||
163 | size = (udf_ext0_offset(dir) + dir->i_size) >> 2; | 163 | size = (udf_ext0_offset(dir) + dir->i_size) >> 2; |
164 | f_pos = (udf_ext0_offset(dir) >> 2); | 164 | f_pos = (udf_ext0_offset(dir) >> 2); |
@@ -167,41 +167,41 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, | |||
167 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) | 167 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) |
168 | fibh->sbh = fibh->ebh = NULL; | 168 | fibh->sbh = fibh->ebh = NULL; |
169 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 169 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), |
170 | &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30)) | 170 | &epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) |
171 | { | 171 | { |
172 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 172 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
173 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) | 173 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) |
174 | { | 174 | { |
175 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT) | 175 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT) |
176 | extoffset -= sizeof(short_ad); | 176 | epos.offset -= sizeof(short_ad); |
177 | else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG) | 177 | else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG) |
178 | extoffset -= sizeof(long_ad); | 178 | epos.offset -= sizeof(long_ad); |
179 | } | 179 | } |
180 | else | 180 | else |
181 | offset = 0; | 181 | offset = 0; |
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(bh); | 185 | udf_release_data(epos.bh); |
186 | return NULL; | 186 | return NULL; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | else | 189 | else |
190 | { | 190 | { |
191 | udf_release_data(bh); | 191 | udf_release_data(epos.bh); |
192 | return NULL; | 192 | return NULL; |
193 | } | 193 | } |
194 | 194 | ||
195 | while ( (f_pos < size) ) | 195 | while ( (f_pos < size) ) |
196 | { | 196 | { |
197 | fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &bloc, &extoffset, &eloc, &elen, &offset, &bh); | 197 | fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &epos, &eloc, &elen, &offset); |
198 | 198 | ||
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 | udf_release_data(fibh->ebh); |
203 | udf_release_data(fibh->sbh); | 203 | udf_release_data(fibh->sbh); |
204 | udf_release_data(bh); | 204 | udf_release_data(epos.bh); |
205 | return NULL; | 205 | return NULL; |
206 | } | 206 | } |
207 | 207 | ||
@@ -247,7 +247,7 @@ 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(bh); | 250 | udf_release_data(epos.bh); |
251 | return fi; | 251 | return fi; |
252 | } | 252 | } |
253 | } | 253 | } |
@@ -255,7 +255,7 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, | |||
255 | if (fibh->sbh != fibh->ebh) | 255 | if (fibh->sbh != fibh->ebh) |
256 | udf_release_data(fibh->ebh); | 256 | udf_release_data(fibh->ebh); |
257 | udf_release_data(fibh->sbh); | 257 | udf_release_data(fibh->sbh); |
258 | udf_release_data(bh); | 258 | udf_release_data(epos.bh); |
259 | return NULL; | 259 | return NULL; |
260 | } | 260 | } |
261 | 261 | ||
@@ -353,10 +353,10 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, | |||
353 | uint8_t lfi; | 353 | uint8_t lfi; |
354 | uint16_t liu; | 354 | uint16_t liu; |
355 | int block; | 355 | int block; |
356 | kernel_lb_addr bloc, eloc; | 356 | kernel_lb_addr eloc; |
357 | uint32_t extoffset, elen; | 357 | uint32_t elen; |
358 | sector_t offset; | 358 | sector_t offset; |
359 | struct buffer_head *bh = NULL; | 359 | struct extent_position epos = { NULL, 0, { 0, 0 }}; |
360 | 360 | ||
361 | sb = dir->i_sb; | 361 | sb = dir->i_sb; |
362 | 362 | ||
@@ -385,22 +385,22 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, | |||
385 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) | 385 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) |
386 | fibh->sbh = fibh->ebh = NULL; | 386 | fibh->sbh = fibh->ebh = NULL; |
387 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 387 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), |
388 | &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30)) | 388 | &epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) |
389 | { | 389 | { |
390 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 390 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
391 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) | 391 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) |
392 | { | 392 | { |
393 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT) | 393 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT) |
394 | extoffset -= sizeof(short_ad); | 394 | epos.offset -= sizeof(short_ad); |
395 | else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG) | 395 | else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG) |
396 | extoffset -= sizeof(long_ad); | 396 | epos.offset -= sizeof(long_ad); |
397 | } | 397 | } |
398 | else | 398 | else |
399 | offset = 0; | 399 | offset = 0; |
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(bh); | 403 | udf_release_data(epos.bh); |
404 | *err = -EIO; | 404 | *err = -EIO; |
405 | return NULL; | 405 | return NULL; |
406 | } | 406 | } |
@@ -418,14 +418,14 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, | |||
418 | 418 | ||
419 | while ( (f_pos < size) ) | 419 | while ( (f_pos < size) ) |
420 | { | 420 | { |
421 | fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &bloc, &extoffset, &eloc, &elen, &offset, &bh); | 421 | fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &epos, &eloc, &elen, &offset); |
422 | 422 | ||
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 | udf_release_data(fibh->ebh); |
427 | udf_release_data(fibh->sbh); | 427 | udf_release_data(fibh->sbh); |
428 | udf_release_data(bh); | 428 | udf_release_data(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(bh); | 458 | udf_release_data(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; |
@@ -480,7 +480,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, | |||
480 | if (fibh->sbh != fibh->ebh) | 480 | if (fibh->sbh != fibh->ebh) |
481 | udf_release_data(fibh->ebh); | 481 | udf_release_data(fibh->ebh); |
482 | udf_release_data(fibh->sbh); | 482 | udf_release_data(fibh->sbh); |
483 | udf_release_data(bh); | 483 | udf_release_data(epos.bh); |
484 | *err = -EEXIST; | 484 | *err = -EEXIST; |
485 | return NULL; | 485 | return NULL; |
486 | } | 486 | } |
@@ -492,8 +492,8 @@ 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(bh); | 495 | udf_release_data(epos.bh); |
496 | 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); |
@@ -502,15 +502,15 @@ add: | |||
502 | udf_release_data(fibh->sbh); | 502 | udf_release_data(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 | bloc = UDF_I_LOCATION(dir); | 505 | epos.block = UDF_I_LOCATION(dir); |
506 | eloc.logicalBlockNum = block; | 506 | eloc.logicalBlockNum = block; |
507 | eloc.partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum; | 507 | eloc.partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum; |
508 | elen = dir->i_sb->s_blocksize; | 508 | elen = dir->i_sb->s_blocksize; |
509 | extoffset = udf_file_entry_alloc_offset(dir); | 509 | epos.offset = udf_file_entry_alloc_offset(dir); |
510 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT) | 510 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT) |
511 | extoffset += sizeof(short_ad); | 511 | epos.offset += sizeof(short_ad); |
512 | else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG) | 512 | else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG) |
513 | extoffset += sizeof(long_ad); | 513 | epos.offset += sizeof(long_ad); |
514 | } | 514 | } |
515 | 515 | ||
516 | if (sb->s_blocksize - fibh->eoffset >= nfidlen) | 516 | if (sb->s_blocksize - fibh->eoffset >= nfidlen) |
@@ -550,14 +550,14 @@ 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(bh); | 553 | udf_release_data(epos.bh); |
554 | udf_release_data(fibh->sbh); | 554 | udf_release_data(fibh->sbh); |
555 | return NULL; | 555 | return NULL; |
556 | } | 556 | } |
557 | 557 | ||
558 | if (!(fibh->soffset)) | 558 | if (!(fibh->soffset)) |
559 | { | 559 | { |
560 | if (udf_next_aext(dir, &bloc, &extoffset, &eloc, &elen, &bh, 1) == | 560 | if (udf_next_aext(dir, &epos, &eloc, &elen, 1) == |
561 | (EXT_RECORDED_ALLOCATED >> 30)) | 561 | (EXT_RECORDED_ALLOCATED >> 30)) |
562 | { | 562 | { |
563 | block = eloc.logicalBlockNum + ((elen - 1) >> | 563 | block = eloc.logicalBlockNum + ((elen - 1) >> |
@@ -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(bh); | 590 | udf_release_data(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,7 +596,7 @@ add: | |||
596 | } | 596 | } |
597 | else | 597 | else |
598 | { | 598 | { |
599 | udf_release_data(bh); | 599 | udf_release_data(epos.bh); |
600 | if (fibh->sbh != fibh->ebh) | 600 | if (fibh->sbh != fibh->ebh) |
601 | udf_release_data(fibh->ebh); | 601 | udf_release_data(fibh->ebh); |
602 | udf_release_data(fibh->sbh); | 602 | udf_release_data(fibh->sbh); |
@@ -781,10 +781,10 @@ static int empty_dir(struct inode *dir) | |||
781 | loff_t f_pos; | 781 | loff_t f_pos; |
782 | loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; | 782 | loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; |
783 | int block; | 783 | int block; |
784 | kernel_lb_addr bloc, eloc; | 784 | kernel_lb_addr eloc; |
785 | uint32_t extoffset, elen; | 785 | uint32_t elen; |
786 | sector_t offset; | 786 | sector_t offset; |
787 | struct buffer_head *bh = NULL; | 787 | struct extent_position epos = { NULL, 0, { 0, 0}}; |
788 | 788 | ||
789 | f_pos = (udf_ext0_offset(dir) >> 2); | 789 | f_pos = (udf_ext0_offset(dir) >> 2); |
790 | 790 | ||
@@ -793,42 +793,42 @@ static int empty_dir(struct inode *dir) | |||
793 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) | 793 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) |
794 | fibh.sbh = fibh.ebh = NULL; | 794 | fibh.sbh = fibh.ebh = NULL; |
795 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 795 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), |
796 | &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30)) | 796 | &epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) |
797 | { | 797 | { |
798 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 798 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
799 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) | 799 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) |
800 | { | 800 | { |
801 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT) | 801 | if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT) |
802 | extoffset -= sizeof(short_ad); | 802 | epos.offset -= sizeof(short_ad); |
803 | else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG) | 803 | else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG) |
804 | extoffset -= sizeof(long_ad); | 804 | epos.offset -= sizeof(long_ad); |
805 | } | 805 | } |
806 | else | 806 | else |
807 | offset = 0; | 807 | offset = 0; |
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(bh); | 811 | udf_release_data(epos.bh); |
812 | return 0; | 812 | return 0; |
813 | } | 813 | } |
814 | } | 814 | } |
815 | else | 815 | else |
816 | { | 816 | { |
817 | udf_release_data(bh); | 817 | udf_release_data(epos.bh); |
818 | return 0; | 818 | return 0; |
819 | } | 819 | } |
820 | 820 | ||
821 | 821 | ||
822 | while ( (f_pos < size) ) | 822 | while ( (f_pos < size) ) |
823 | { | 823 | { |
824 | fi = udf_fileident_read(dir, &f_pos, &fibh, &cfi, &bloc, &extoffset, &eloc, &elen, &offset, &bh); | 824 | fi = udf_fileident_read(dir, &f_pos, &fibh, &cfi, &epos, &eloc, &elen, &offset); |
825 | 825 | ||
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 | udf_release_data(fibh.ebh); |
830 | udf_release_data(fibh.sbh); | 830 | udf_release_data(fibh.sbh); |
831 | udf_release_data(bh); | 831 | udf_release_data(epos.bh); |
832 | return 0; | 832 | return 0; |
833 | } | 833 | } |
834 | 834 | ||
@@ -837,14 +837,14 @@ static int empty_dir(struct inode *dir) | |||
837 | if (fibh.sbh != fibh.ebh) | 837 | if (fibh.sbh != fibh.ebh) |
838 | udf_release_data(fibh.ebh); | 838 | udf_release_data(fibh.ebh); |
839 | udf_release_data(fibh.sbh); | 839 | udf_release_data(fibh.sbh); |
840 | udf_release_data(bh); | 840 | udf_release_data(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 | udf_release_data(fibh.ebh); |
846 | udf_release_data(fibh.sbh); | 846 | udf_release_data(fibh.sbh); |
847 | udf_release_data(bh); | 847 | udf_release_data(epos.bh); |
848 | return 1; | 848 | return 1; |
849 | } | 849 | } |
850 | 850 | ||
@@ -941,7 +941,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * | |||
941 | struct pathComponent *pc; | 941 | struct pathComponent *pc; |
942 | char *compstart; | 942 | char *compstart; |
943 | struct udf_fileident_bh fibh; | 943 | struct udf_fileident_bh fibh; |
944 | struct buffer_head *bh = NULL; | 944 | struct extent_position epos = { NULL, 0, {0, 0}}; |
945 | int eoffset, elen = 0; | 945 | int eoffset, elen = 0; |
946 | struct fileIdentDesc *fi; | 946 | struct fileIdentDesc *fi; |
947 | struct fileIdentDesc cfi; | 947 | struct fileIdentDesc cfi; |
@@ -961,33 +961,33 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * | |||
961 | 961 | ||
962 | if (UDF_I_ALLOCTYPE(inode) != ICBTAG_FLAG_AD_IN_ICB) | 962 | if (UDF_I_ALLOCTYPE(inode) != ICBTAG_FLAG_AD_IN_ICB) |
963 | { | 963 | { |
964 | struct buffer_head *bh = NULL; | 964 | kernel_lb_addr eloc; |
965 | kernel_lb_addr bloc, eloc; | 965 | uint32_t elen; |
966 | uint32_t elen, extoffset; | ||
967 | 966 | ||
968 | block = udf_new_block(inode->i_sb, inode, | 967 | block = udf_new_block(inode->i_sb, inode, |
969 | UDF_I_LOCATION(inode).partitionReferenceNum, | 968 | UDF_I_LOCATION(inode).partitionReferenceNum, |
970 | UDF_I_LOCATION(inode).logicalBlockNum, &err); | 969 | UDF_I_LOCATION(inode).logicalBlockNum, &err); |
971 | if (!block) | 970 | if (!block) |
972 | goto out_no_entry; | 971 | goto out_no_entry; |
973 | bloc = UDF_I_LOCATION(inode); | 972 | epos.block = UDF_I_LOCATION(inode); |
973 | epos.offset = udf_file_entry_alloc_offset(inode); | ||
974 | epos.bh = NULL; | ||
974 | eloc.logicalBlockNum = block; | 975 | eloc.logicalBlockNum = block; |
975 | eloc.partitionReferenceNum = UDF_I_LOCATION(inode).partitionReferenceNum; | 976 | eloc.partitionReferenceNum = UDF_I_LOCATION(inode).partitionReferenceNum; |
976 | elen = inode->i_sb->s_blocksize; | 977 | elen = inode->i_sb->s_blocksize; |
977 | UDF_I_LENEXTENTS(inode) = elen; | 978 | UDF_I_LENEXTENTS(inode) = elen; |
978 | extoffset = udf_file_entry_alloc_offset(inode); | 979 | udf_add_aext(inode, &epos, eloc, elen, 0); |
979 | udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 0); | 980 | udf_release_data(epos.bh); |
980 | udf_release_data(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); |
984 | bh = udf_tread(inode->i_sb, block); | 984 | epos.bh = udf_tread(inode->i_sb, block); |
985 | lock_buffer(bh); | 985 | lock_buffer(epos.bh); |
986 | memset(bh->b_data, 0x00, inode->i_sb->s_blocksize); | 986 | memset(epos.bh->b_data, 0x00, inode->i_sb->s_blocksize); |
987 | set_buffer_uptodate(bh); | 987 | set_buffer_uptodate(epos.bh); |
988 | unlock_buffer(bh); | 988 | unlock_buffer(epos.bh); |
989 | mark_buffer_dirty_inode(bh, inode); | 989 | mark_buffer_dirty_inode(epos.bh, inode); |
990 | ea = bh->b_data + udf_ext0_offset(inode); | 990 | ea = epos.bh->b_data + udf_ext0_offset(inode); |
991 | } | 991 | } |
992 | else | 992 | else |
993 | ea = UDF_I_DATA(inode) + UDF_I_LENEATTR(inode); | 993 | ea = UDF_I_DATA(inode) + UDF_I_LENEATTR(inode); |
@@ -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(bh); | 1063 | udf_release_data(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; |