indirect.c (f1e0477a7b7a541f51eea279910eed4ddd010033) indirect.c (189e868fa8fdca702eb9db9d8afc46b5cb9144c9)
1/*
2 * linux/fs/ext4/indirect.c
3 *
4 * from
5 *
6 * linux/fs/ext4/inode.c
7 *
8 * Copyright (C) 1992, 1993, 1994, 1995

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

1338 int addr_per_block = EXT4_ADDR_PER_BLOCK(inode->i_sb);
1339 struct address_space *mapping = inode->i_mapping;
1340 ext4_lblk_t offsets[4];
1341 Indirect chain[4];
1342 Indirect *partial;
1343 __le32 nr = 0;
1344 int n = 0;
1345 ext4_lblk_t last_block, max_block;
1/*
2 * linux/fs/ext4/indirect.c
3 *
4 * from
5 *
6 * linux/fs/ext4/inode.c
7 *
8 * Copyright (C) 1992, 1993, 1994, 1995

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

1338 int addr_per_block = EXT4_ADDR_PER_BLOCK(inode->i_sb);
1339 struct address_space *mapping = inode->i_mapping;
1340 ext4_lblk_t offsets[4];
1341 Indirect chain[4];
1342 Indirect *partial;
1343 __le32 nr = 0;
1344 int n = 0;
1345 ext4_lblk_t last_block, max_block;
1346 loff_t page_len;
1346 unsigned blocksize = inode->i_sb->s_blocksize;
1347 unsigned blocksize = inode->i_sb->s_blocksize;
1348 int err;
1347
1348 handle = start_transaction(inode);
1349 if (IS_ERR(handle))
1350 return; /* AKPM: return what? */
1351
1352 last_block = (inode->i_size + blocksize-1)
1353 >> EXT4_BLOCK_SIZE_BITS(inode->i_sb);
1354 max_block = (EXT4_SB(inode->i_sb)->s_bitmap_maxbytes + blocksize-1)
1355 >> EXT4_BLOCK_SIZE_BITS(inode->i_sb);
1356
1349
1350 handle = start_transaction(inode);
1351 if (IS_ERR(handle))
1352 return; /* AKPM: return what? */
1353
1354 last_block = (inode->i_size + blocksize-1)
1355 >> EXT4_BLOCK_SIZE_BITS(inode->i_sb);
1356 max_block = (EXT4_SB(inode->i_sb)->s_bitmap_maxbytes + blocksize-1)
1357 >> EXT4_BLOCK_SIZE_BITS(inode->i_sb);
1358
1357 if (inode->i_size & (blocksize - 1))
1358 if (ext4_block_truncate_page(handle, mapping, inode->i_size))
1359 if (inode->i_size % PAGE_CACHE_SIZE != 0) {
1360 page_len = PAGE_CACHE_SIZE -
1361 (inode->i_size & (PAGE_CACHE_SIZE - 1));
1362
1363 err = ext4_discard_partial_page_buffers(handle,
1364 mapping, inode->i_size, page_len, 0);
1365
1366 if (err)
1359 goto out_stop;
1367 goto out_stop;
1368 }
1360
1361 if (last_block != max_block) {
1362 n = ext4_block_to_path(inode, last_block, offsets, NULL);
1363 if (n == 0)
1364 goto out_stop; /* error */
1365 }
1366
1367 /*

--- 120 unchanged lines hidden ---
1369
1370 if (last_block != max_block) {
1371 n = ext4_block_to_path(inode, last_block, offsets, NULL);
1372 if (n == 0)
1373 goto out_stop; /* error */
1374 }
1375
1376 /*

--- 120 unchanged lines hidden ---