diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2008-10-15 06:29:03 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2009-04-02 06:29:47 -0400 |
commit | 97e961fdbf32488b7386c9f1effa2bee97d47929 (patch) | |
tree | fa006f5e803e532c9781d4f5f6e34cf9d8382814 /fs/udf/truncate.c | |
parent | 5ca4e4be841e389d7d17833fef7be2359f290163 (diff) |
Fix the udf code not to pass structs on stack where possible.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/truncate.c')
-rw-r--r-- | fs/udf/truncate.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c index f2fad30fd145..225527cdc885 100644 --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "udf_sb.h" | 28 | #include "udf_sb.h" |
29 | 29 | ||
30 | static void extent_trunc(struct inode *inode, struct extent_position *epos, | 30 | static void extent_trunc(struct inode *inode, struct extent_position *epos, |
31 | struct kernel_lb_addr eloc, int8_t etype, uint32_t elen, | 31 | struct kernel_lb_addr *eloc, int8_t etype, uint32_t elen, |
32 | uint32_t nelen) | 32 | uint32_t nelen) |
33 | { | 33 | { |
34 | struct kernel_lb_addr neloc = {}; | 34 | struct kernel_lb_addr neloc = {}; |
@@ -43,12 +43,12 @@ static void extent_trunc(struct inode *inode, struct extent_position *epos, | |||
43 | last_block); | 43 | last_block); |
44 | etype = (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30); | 44 | etype = (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30); |
45 | } else | 45 | } else |
46 | neloc = eloc; | 46 | neloc = *eloc; |
47 | nelen = (etype << 30) | nelen; | 47 | nelen = (etype << 30) | nelen; |
48 | } | 48 | } |
49 | 49 | ||
50 | if (elen != nelen) { | 50 | if (elen != nelen) { |
51 | udf_write_aext(inode, epos, neloc, nelen, 0); | 51 | udf_write_aext(inode, epos, &neloc, nelen, 0); |
52 | if (last_block - first_block > 0) { | 52 | if (last_block - first_block > 0) { |
53 | if (etype == (EXT_RECORDED_ALLOCATED >> 30)) | 53 | if (etype == (EXT_RECORDED_ALLOCATED >> 30)) |
54 | mark_inode_dirty(inode); | 54 | mark_inode_dirty(inode); |
@@ -106,7 +106,7 @@ void udf_truncate_tail_extent(struct inode *inode) | |||
106 | (unsigned)elen); | 106 | (unsigned)elen); |
107 | nelen = elen - (lbcount - inode->i_size); | 107 | nelen = elen - (lbcount - inode->i_size); |
108 | epos.offset -= adsize; | 108 | epos.offset -= adsize; |
109 | extent_trunc(inode, &epos, eloc, etype, elen, nelen); | 109 | extent_trunc(inode, &epos, &eloc, etype, elen, nelen); |
110 | epos.offset += adsize; | 110 | epos.offset += adsize; |
111 | if (udf_next_aext(inode, &epos, &eloc, &elen, 1) != -1) | 111 | if (udf_next_aext(inode, &epos, &eloc, &elen, 1) != -1) |
112 | printk(KERN_ERR "udf_truncate_tail_extent(): " | 112 | printk(KERN_ERR "udf_truncate_tail_extent(): " |
@@ -152,7 +152,7 @@ void udf_discard_prealloc(struct inode *inode) | |||
152 | if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) { | 152 | if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) { |
153 | epos.offset -= adsize; | 153 | epos.offset -= adsize; |
154 | lbcount -= elen; | 154 | lbcount -= elen; |
155 | extent_trunc(inode, &epos, eloc, etype, elen, 0); | 155 | extent_trunc(inode, &epos, &eloc, etype, elen, 0); |
156 | if (!epos.bh) { | 156 | if (!epos.bh) { |
157 | iinfo->i_lenAlloc = | 157 | iinfo->i_lenAlloc = |
158 | epos.offset - | 158 | epos.offset - |
@@ -221,7 +221,7 @@ void udf_truncate_extents(struct inode *inode) | |||
221 | (inode->i_size & (sb->s_blocksize - 1)); | 221 | (inode->i_size & (sb->s_blocksize - 1)); |
222 | if (etype != -1) { | 222 | if (etype != -1) { |
223 | epos.offset -= adsize; | 223 | epos.offset -= adsize; |
224 | extent_trunc(inode, &epos, eloc, etype, elen, byte_offset); | 224 | extent_trunc(inode, &epos, &eloc, etype, elen, byte_offset); |
225 | epos.offset += adsize; | 225 | epos.offset += adsize; |
226 | if (byte_offset) | 226 | if (byte_offset) |
227 | lenalloc = epos.offset; | 227 | lenalloc = epos.offset; |
@@ -236,12 +236,12 @@ void udf_truncate_extents(struct inode *inode) | |||
236 | while ((etype = udf_current_aext(inode, &epos, &eloc, | 236 | while ((etype = udf_current_aext(inode, &epos, &eloc, |
237 | &elen, 0)) != -1) { | 237 | &elen, 0)) != -1) { |
238 | if (etype == (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) { | 238 | if (etype == (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) { |
239 | udf_write_aext(inode, &epos, neloc, nelen, 0); | 239 | udf_write_aext(inode, &epos, &neloc, nelen, 0); |
240 | if (indirect_ext_len) { | 240 | if (indirect_ext_len) { |
241 | /* We managed to free all extents in the | 241 | /* We managed to free all extents in the |
242 | * indirect extent - free it too */ | 242 | * indirect extent - free it too */ |
243 | BUG_ON(!epos.bh); | 243 | BUG_ON(!epos.bh); |
244 | udf_free_blocks(sb, inode, epos.block, | 244 | udf_free_blocks(sb, inode, &epos.block, |
245 | 0, indirect_ext_len); | 245 | 0, indirect_ext_len); |
246 | } else if (!epos.bh) { | 246 | } else if (!epos.bh) { |
247 | iinfo->i_lenAlloc = lenalloc; | 247 | iinfo->i_lenAlloc = lenalloc; |
@@ -253,7 +253,7 @@ void udf_truncate_extents(struct inode *inode) | |||
253 | epos.offset = sizeof(struct allocExtDesc); | 253 | epos.offset = sizeof(struct allocExtDesc); |
254 | epos.block = eloc; | 254 | epos.block = eloc; |
255 | epos.bh = udf_tread(sb, | 255 | epos.bh = udf_tread(sb, |
256 | udf_get_lb_pblock(sb, eloc, 0)); | 256 | udf_get_lb_pblock(sb, &eloc, 0)); |
257 | if (elen) | 257 | if (elen) |
258 | indirect_ext_len = | 258 | indirect_ext_len = |
259 | (elen + sb->s_blocksize - 1) >> | 259 | (elen + sb->s_blocksize - 1) >> |
@@ -261,7 +261,7 @@ void udf_truncate_extents(struct inode *inode) | |||
261 | else | 261 | else |
262 | indirect_ext_len = 1; | 262 | indirect_ext_len = 1; |
263 | } else { | 263 | } else { |
264 | extent_trunc(inode, &epos, eloc, etype, | 264 | extent_trunc(inode, &epos, &eloc, etype, |
265 | elen, 0); | 265 | elen, 0); |
266 | epos.offset += adsize; | 266 | epos.offset += adsize; |
267 | } | 267 | } |
@@ -269,7 +269,7 @@ void udf_truncate_extents(struct inode *inode) | |||
269 | 269 | ||
270 | if (indirect_ext_len) { | 270 | if (indirect_ext_len) { |
271 | BUG_ON(!epos.bh); | 271 | BUG_ON(!epos.bh); |
272 | udf_free_blocks(sb, inode, epos.block, 0, | 272 | udf_free_blocks(sb, inode, &epos.block, 0, |
273 | indirect_ext_len); | 273 | indirect_ext_len); |
274 | } else if (!epos.bh) { | 274 | } else if (!epos.bh) { |
275 | iinfo->i_lenAlloc = lenalloc; | 275 | iinfo->i_lenAlloc = lenalloc; |