35 int last_block = (elen + inode->
i_sb->s_blocksize - 1) >>
36 inode->
i_sb->s_blocksize_bits;
37 int first_block = (nelen + inode->
i_sb->s_blocksize - 1) >>
38 inode->
i_sb->s_blocksize_bits;
47 nelen = (etype << 30) | nelen;
52 if (last_block - first_block > 0) {
54 mark_inode_dirty(inode);
59 last_block - first_block);
88 adsize =
sizeof(
struct long_ad);
93 while ((netype =
udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) {
96 if (lbcount > inode->
i_size) {
97 if (lbcount - inode->
i_size >= inode->
i_sb->s_blocksize)
99 "Too long extent after EOF in inode %u: i_size: %lld lbcount: %lld extent %u+%u\n",
100 (
unsigned)inode->
i_ino,
105 nelen = elen - (lbcount - inode->
i_size);
107 extent_trunc(inode, &epos, &eloc, etype, elen, nelen);
111 "Extent after EOF in inode %u\n",
112 (
unsigned)inode->
i_ino);
128 int8_t etype = -1, netype;
139 adsize =
sizeof(
struct long_ad);
146 while ((netype =
udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) {
153 extent_trunc(inode, &epos, &eloc, etype, elen, 0);
157 udf_file_entry_alloc_offset(inode);
158 mark_inode_dirty(inode);
166 UDF_SB(inode->
i_sb)->s_udfrev >= 0x0201)
180 static void udf_update_alloc_ext_desc(
struct inode *inode,
207 uint32_t elen, nelen = 0, indirect_ext_len = 0, lenalloc;
218 adsize =
sizeof(
struct long_ad);
231 extent_trunc(inode, &epos, &eloc, etype, elen, byte_offset);
236 lenalloc = epos.
offset - adsize;
239 lenalloc -= udf_file_entry_alloc_offset(inode);
247 if (indirect_ext_len) {
252 0, indirect_ext_len);
253 }
else if (!epos.
bh) {
255 mark_inode_dirty(inode);
257 udf_update_alloc_ext_desc(inode,
263 udf_get_lb_pblock(sb, &eloc, 0));
269 indirect_ext_len = 1;
271 extent_trunc(inode, &epos, &eloc, etype, elen, 0);
276 if (indirect_ext_len) {
279 }
else if (!epos.
bh) {
281 mark_inode_dirty(inode);
283 udf_update_alloc_ext_desc(inode, &epos, lenalloc);