inode.c (6a3b37e0ea20bcb50e519c75fae3387199f35400) inode.c (2d532616c768c7473b7ebcf39aa16c824c73b7fc)
1/*
2 * inode.c
3 *
4 * PURPOSE
5 * Inode handling routines for the OSTA-UDF(tm) filesystem.
6 *
7 * COPYRIGHT
8 * This file is distributed under the terms of the GNU General Public

--- 541 unchanged lines hidden (view full) ---

550
551 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
552 adsize = sizeof(struct short_ad);
553 else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG)
554 adsize = sizeof(struct long_ad);
555 else
556 BUG();
557
1/*
2 * inode.c
3 *
4 * PURPOSE
5 * Inode handling routines for the OSTA-UDF(tm) filesystem.
6 *
7 * COPYRIGHT
8 * This file is distributed under the terms of the GNU General Public

--- 541 unchanged lines hidden (view full) ---

550
551 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
552 adsize = sizeof(struct short_ad);
553 else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG)
554 adsize = sizeof(struct long_ad);
555 else
556 BUG();
557
558 down_write(&iinfo->i_data_sem);
558 /*
559 * When creating hole in file, just don't bother with preserving
560 * preallocation. It likely won't be very useful anyway.
561 */
562 udf_discard_prealloc(inode);
563
564 etype = inode_bmap(inode, first_block, &epos, &eloc, &elen, &offset);
565 within_last_ext = (etype != -1);

--- 28 unchanged lines hidden (view full) ---

594 err = udf_do_extend_file(inode, &epos, &extent, new_elen);
595 }
596
597 if (err < 0)
598 goto out;
599 err = 0;
600out:
601 brelse(epos.bh);
559 /*
560 * When creating hole in file, just don't bother with preserving
561 * preallocation. It likely won't be very useful anyway.
562 */
563 udf_discard_prealloc(inode);
564
565 etype = inode_bmap(inode, first_block, &epos, &eloc, &elen, &offset);
566 within_last_ext = (etype != -1);

--- 28 unchanged lines hidden (view full) ---

595 err = udf_do_extend_file(inode, &epos, &extent, new_elen);
596 }
597
598 if (err < 0)
599 goto out;
600 err = 0;
601out:
602 brelse(epos.bh);
603 up_write(&iinfo->i_data_sem);
602 return err;
603}
604
605static int inode_getblk(struct inode *inode, struct udf_map_rq *map)
606{
607 struct kernel_long_ad laarr[EXTENT_MERGE_SIZE];
608 struct extent_position prev_epos, cur_epos, next_epos;
609 int count = 0, startnum = 0, endnum = 0;

--- 545 unchanged lines hidden (view full) ---

1155
1156 iinfo = UDF_I(inode);
1157 if (newsize > inode->i_size) {
1158 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
1159 if (bsize >=
1160 (udf_file_entry_alloc_offset(inode) + newsize)) {
1161 down_write(&iinfo->i_data_sem);
1162 iinfo->i_lenAlloc = newsize;
604 return err;
605}
606
607static int inode_getblk(struct inode *inode, struct udf_map_rq *map)
608{
609 struct kernel_long_ad laarr[EXTENT_MERGE_SIZE];
610 struct extent_position prev_epos, cur_epos, next_epos;
611 int count = 0, startnum = 0, endnum = 0;

--- 545 unchanged lines hidden (view full) ---

1157
1158 iinfo = UDF_I(inode);
1159 if (newsize > inode->i_size) {
1160 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
1161 if (bsize >=
1162 (udf_file_entry_alloc_offset(inode) + newsize)) {
1163 down_write(&iinfo->i_data_sem);
1164 iinfo->i_lenAlloc = newsize;
1165 up_write(&iinfo->i_data_sem);
1163 goto set_size;
1164 }
1165 err = udf_expand_file_adinicb(inode);
1166 if (err)
1167 return err;
1168 }
1166 goto set_size;
1167 }
1168 err = udf_expand_file_adinicb(inode);
1169 if (err)
1170 return err;
1171 }
1169 down_write(&iinfo->i_data_sem);
1170 err = udf_extend_file(inode, newsize);
1172 err = udf_extend_file(inode, newsize);
1171 if (err) {
1172 up_write(&iinfo->i_data_sem);
1173 if (err)
1173 return err;
1174 return err;
1174 }
1175set_size:
1175set_size:
1176 up_write(&iinfo->i_data_sem);
1177 truncate_setsize(inode, newsize);
1178 } else {
1179 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
1180 down_write(&iinfo->i_data_sem);
1181 udf_clear_extent_cache(inode);
1182 memset(iinfo->i_data + iinfo->i_lenEAttr + newsize,
1183 0x00, bsize - newsize -
1184 udf_file_entry_alloc_offset(inode));

--- 1104 unchanged lines hidden ---
1176 truncate_setsize(inode, newsize);
1177 } else {
1178 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
1179 down_write(&iinfo->i_data_sem);
1180 udf_clear_extent_cache(inode);
1181 memset(iinfo->i_data + iinfo->i_lenEAttr + newsize,
1182 0x00, bsize - newsize -
1183 udf_file_entry_alloc_offset(inode));

--- 1104 unchanged lines hidden ---