Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91815
b: refs/heads/master
c: 456390d
h: refs/heads/master
i:
  91813: d70f2dd
  91811: 238ffa8
  91807: 388594e
v: v3
  • Loading branch information
marcin.slusarz@gmail.com authored and Jan Kara committed Apr 17, 2008
1 parent 0bf57d1 commit c547838
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9de90b76eb96e7cdeac8b8dbe7d3db948b070f4d
refs/heads/master: 456390de465e5a19c84bca5d78e2550971ab5a96
56 changes: 23 additions & 33 deletions trunk/fs/udf/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,31 @@ void udf_discard_prealloc(struct inode *inode)
brelse(epos.bh);
}

static void udf_update_alloc_ext_desc(struct inode *inode,
struct extent_position *epos,
u32 lenalloc)
{
struct super_block *sb = inode->i_sb;
struct udf_sb_info *sbi = UDF_SB(sb);

struct allocExtDesc *aed = (struct allocExtDesc *) (epos->bh->b_data);
int len = sizeof(struct allocExtDesc);

aed->lengthAllocDescs = cpu_to_le32(lenalloc);
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) || sbi->s_udfrev >= 0x0201)
len += lenalloc;

udf_update_tag(epos->bh->b_data, len);
mark_buffer_dirty_inode(epos->bh, inode);
}

void udf_truncate_extents(struct inode *inode)
{
struct extent_position epos;
kernel_lb_addr eloc, neloc = {};
uint32_t elen, nelen = 0, indirect_ext_len = 0, lenalloc;
int8_t etype;
struct super_block *sb = inode->i_sb;
struct udf_sb_info *sbi = UDF_SB(sb);
sector_t first_block = inode->i_size >> sb->s_blocksize_bits, offset;
loff_t byte_offset;
int adsize;
Expand Down Expand Up @@ -229,24 +246,9 @@ void udf_truncate_extents(struct inode *inode)
} else if (!epos.bh) {
iinfo->i_lenAlloc = lenalloc;
mark_inode_dirty(inode);
} else {
struct allocExtDesc *aed =
(struct allocExtDesc *)
(epos.bh->b_data);
int len = sizeof(struct allocExtDesc);

aed->lengthAllocDescs =
cpu_to_le32(lenalloc);
if (!UDF_QUERY_FLAG(sb,
UDF_FLAG_STRICT) ||
sbi->s_udfrev >= 0x0201)
len += lenalloc;

udf_update_tag(epos.bh->b_data,
len);
mark_buffer_dirty_inode(
epos.bh, inode);
}
} else
udf_update_alloc_ext_desc(inode,
&epos, lenalloc);
brelse(epos.bh);
epos.offset = sizeof(struct allocExtDesc);
epos.block = eloc;
Expand All @@ -272,20 +274,8 @@ void udf_truncate_extents(struct inode *inode)
} else if (!epos.bh) {
iinfo->i_lenAlloc = lenalloc;
mark_inode_dirty(inode);
} else {
struct allocExtDesc *aed =
(struct allocExtDesc *)(epos.bh->b_data);
aed->lengthAllocDescs = cpu_to_le32(lenalloc);
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) ||
sbi->s_udfrev >= 0x0201)
udf_update_tag(epos.bh->b_data,
lenalloc +
sizeof(struct allocExtDesc));
else
udf_update_tag(epos.bh->b_data,
sizeof(struct allocExtDesc));
mark_buffer_dirty_inode(epos.bh, inode);
}
} else
udf_update_alloc_ext_desc(inode, &epos, lenalloc);
} else if (inode->i_size) {
if (byte_offset) {
kernel_long_ad extent;
Expand Down

0 comments on commit c547838

Please sign in to comment.