aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/truncate.c
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-02-08 07:20:36 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:35 -0500
commit4b11111aba6c80cc2969fd1806d2a869bfc9f357 (patch)
tree57b72a1ca58859dc6a9e47d647f29cebb9bcf7e0 /fs/udf/truncate.c
parentbd45a420f93d18c91115f3f0568dd6a2555aa15a (diff)
udf: fix coding style
fix coding style errors found by checkpatch: - assignments in if conditions - braces {} around single statement blocks - no spaces after commas - printks without KERN_* - lines longer than 80 characters - spaces between "type *" and variable name before: 192 errors, 561 warnings, 8987 lines checked after: 1 errors, 38 warnings, 9468 lines checked Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Jan Kara <jack@suse.cz> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/truncate.c')
-rw-r--r--fs/udf/truncate.c58
1 files changed, 37 insertions, 21 deletions
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
index 6931f6bfa1ae..5c1bf921f400 100644
--- a/fs/udf/truncate.c
+++ b/fs/udf/truncate.c
@@ -154,7 +154,8 @@ void udf_discard_prealloc(struct inode *inode)
154 extent_trunc(inode, &epos, eloc, etype, elen, 0); 154 extent_trunc(inode, &epos, eloc, etype, elen, 0);
155 if (!epos.bh) { 155 if (!epos.bh) {
156 UDF_I_LENALLOC(inode) = 156 UDF_I_LENALLOC(inode) =
157 epos.offset - udf_file_entry_alloc_offset(inode); 157 epos.offset -
158 udf_file_entry_alloc_offset(inode);
158 mark_inode_dirty(inode); 159 mark_inode_dirty(inode);
159 } else { 160 } else {
160 struct allocExtDesc *aed = 161 struct allocExtDesc *aed =
@@ -213,7 +214,8 @@ void udf_truncate_extents(struct inode *inode)
213 else 214 else
214 lenalloc -= sizeof(struct allocExtDesc); 215 lenalloc -= sizeof(struct allocExtDesc);
215 216
216 while ((etype = udf_current_aext(inode, &epos, &eloc, &elen, 0)) != -1) { 217 while ((etype = udf_current_aext(inode, &epos, &eloc,
218 &elen, 0)) != -1) {
217 if (etype == (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) { 219 if (etype == (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) {
218 udf_write_aext(inode, &epos, neloc, nelen, 0); 220 udf_write_aext(inode, &epos, neloc, nelen, 0);
219 if (indirect_ext_len) { 221 if (indirect_ext_len) {
@@ -225,35 +227,43 @@ void udf_truncate_extents(struct inode *inode)
225 0, indirect_ext_len); 227 0, indirect_ext_len);
226 } else { 228 } else {
227 if (!epos.bh) { 229 if (!epos.bh) {
228 UDF_I_LENALLOC(inode) = lenalloc; 230 UDF_I_LENALLOC(inode) =
231 lenalloc;
229 mark_inode_dirty(inode); 232 mark_inode_dirty(inode);
230 } else { 233 } else {
231 struct allocExtDesc *aed = 234 struct allocExtDesc *aed =
232 (struct allocExtDesc *)(epos.bh->b_data); 235 (struct allocExtDesc *)
236 (epos.bh->b_data);
237 int len =
238 sizeof(struct allocExtDesc);
239
233 aed->lengthAllocDescs = 240 aed->lengthAllocDescs =
234 cpu_to_le32(lenalloc); 241 cpu_to_le32(lenalloc);
235 if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) || 242 if (!UDF_QUERY_FLAG(sb,
243 UDF_FLAG_STRICT) ||
236 sbi->s_udfrev >= 0x0201) 244 sbi->s_udfrev >= 0x0201)
237 udf_update_tag(epos.bh->b_data, 245 len += lenalloc;
238 lenalloc + 246
239 sizeof(struct allocExtDesc)); 247 udf_update_tag(epos.bh->b_data,
240 else 248 len);
241 udf_update_tag(epos.bh->b_data, 249 mark_buffer_dirty_inode(
242 sizeof(struct allocExtDesc)); 250 epos.bh, inode);
243 mark_buffer_dirty_inode(epos.bh, inode);
244 } 251 }
245 } 252 }
246 brelse(epos.bh); 253 brelse(epos.bh);
247 epos.offset = sizeof(struct allocExtDesc); 254 epos.offset = sizeof(struct allocExtDesc);
248 epos.block = eloc; 255 epos.block = eloc;
249 epos.bh = udf_tread(sb, udf_get_lb_pblock(sb, eloc, 0)); 256 epos.bh = udf_tread(sb,
257 udf_get_lb_pblock(sb, eloc, 0));
250 if (elen) 258 if (elen)
251 indirect_ext_len = (elen + sb->s_blocksize -1) >> 259 indirect_ext_len =
260 (elen + sb->s_blocksize - 1) >>
252 sb->s_blocksize_bits; 261 sb->s_blocksize_bits;
253 else 262 else
254 indirect_ext_len = 1; 263 indirect_ext_len = 1;
255 } else { 264 } else {
256 extent_trunc(inode, &epos, eloc, etype, elen, 0); 265 extent_trunc(inode, &epos, eloc, etype,
266 elen, 0);
257 epos.offset += adsize; 267 epos.offset += adsize;
258 } 268 }
259 } 269 }
@@ -274,10 +284,11 @@ void udf_truncate_extents(struct inode *inode)
274 if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) || 284 if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) ||
275 sbi->s_udfrev >= 0x0201) 285 sbi->s_udfrev >= 0x0201)
276 udf_update_tag(epos.bh->b_data, 286 udf_update_tag(epos.bh->b_data,
277 lenalloc + sizeof(struct allocExtDesc)); 287 lenalloc +
288 sizeof(struct allocExtDesc));
278 else 289 else
279 udf_update_tag(epos.bh->b_data, 290 udf_update_tag(epos.bh->b_data,
280 sizeof(struct allocExtDesc)); 291 sizeof(struct allocExtDesc));
281 mark_buffer_dirty_inode(epos.bh, inode); 292 mark_buffer_dirty_inode(epos.bh, inode);
282 } 293 }
283 } 294 }
@@ -291,13 +302,16 @@ void udf_truncate_extents(struct inode *inode)
291 * extending the file by 'offset' blocks. 302 * extending the file by 'offset' blocks.
292 */ 303 */
293 if ((!epos.bh && 304 if ((!epos.bh &&
294 epos.offset == udf_file_entry_alloc_offset(inode)) || 305 epos.offset ==
295 (epos.bh && epos.offset == sizeof(struct allocExtDesc))) { 306 udf_file_entry_alloc_offset(inode)) ||
307 (epos.bh && epos.offset ==
308 sizeof(struct allocExtDesc))) {
296 /* File has no extents at all or has empty last 309 /* File has no extents at all or has empty last
297 * indirect extent! Create a fake extent... */ 310 * indirect extent! Create a fake extent... */
298 extent.extLocation.logicalBlockNum = 0; 311 extent.extLocation.logicalBlockNum = 0;
299 extent.extLocation.partitionReferenceNum = 0; 312 extent.extLocation.partitionReferenceNum = 0;
300 extent.extLength = EXT_NOT_RECORDED_NOT_ALLOCATED; 313 extent.extLength =
314 EXT_NOT_RECORDED_NOT_ALLOCATED;
301 } else { 315 } else {
302 epos.offset -= adsize; 316 epos.offset -= adsize;
303 etype = udf_next_aext(inode, &epos, 317 etype = udf_next_aext(inode, &epos,
@@ -306,7 +320,9 @@ void udf_truncate_extents(struct inode *inode)
306 extent.extLength |= etype << 30; 320 extent.extLength |= etype << 30;
307 } 321 }
308 udf_extend_file(inode, &epos, &extent, 322 udf_extend_file(inode, &epos, &extent,
309 offset + ((inode->i_size & (sb->s_blocksize - 1)) != 0)); 323 offset +
324 ((inode->i_size &
325 (sb->s_blocksize - 1)) != 0));
310 } 326 }
311 } 327 }
312 UDF_I_LENEXTENTS(inode) = inode->i_size; 328 UDF_I_LENEXTENTS(inode) = inode->i_size;