inode.c (c203e45f069af47ca7623e4dcd8c00bfba2722e4) inode.c (91ef4caf800030fa6e5224b8a41f8c74787b303d)
1/*
2 * linux/fs/ext4/inode.c
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *

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

2300 }
2301 } else {
2302 /* We have reached the bottom of the tree. */
2303 BUFFER_TRACE(parent_bh, "free data blocks");
2304 ext4_free_data(handle, inode, parent_bh, first, last);
2305 }
2306}
2307
1/*
2 * linux/fs/ext4/inode.c
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *

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

2300 }
2301 } else {
2302 /* We have reached the bottom of the tree. */
2303 BUFFER_TRACE(parent_bh, "free data blocks");
2304 ext4_free_data(handle, inode, parent_bh, first, last);
2305 }
2306}
2307
2308int ext4_can_truncate(struct inode *inode)
2309{
2310 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
2311 return 0;
2312 if (S_ISREG(inode->i_mode))
2313 return 1;
2314 if (S_ISDIR(inode->i_mode))
2315 return 1;
2316 if (S_ISLNK(inode->i_mode))
2317 return !ext4_inode_is_fast_symlink(inode);
2318 return 0;
2319}
2320
2308/*
2309 * ext4_truncate()
2310 *
2311 * We block out ext4_get_block() block instantiations across the entire
2312 * transaction, and VFS/VM ensures that ext4_truncate() cannot run
2313 * simultaneously on behalf of the same inode.
2314 *
2315 * As we work through the truncate and commmit bits of it to the journal there

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

2344 Indirect chain[4];
2345 Indirect *partial;
2346 __le32 nr = 0;
2347 int n;
2348 ext4_lblk_t last_block;
2349 unsigned blocksize = inode->i_sb->s_blocksize;
2350 struct page *page;
2351
2321/*
2322 * ext4_truncate()
2323 *
2324 * We block out ext4_get_block() block instantiations across the entire
2325 * transaction, and VFS/VM ensures that ext4_truncate() cannot run
2326 * simultaneously on behalf of the same inode.
2327 *
2328 * As we work through the truncate and commmit bits of it to the journal there

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

2357 Indirect chain[4];
2358 Indirect *partial;
2359 __le32 nr = 0;
2360 int n;
2361 ext4_lblk_t last_block;
2362 unsigned blocksize = inode->i_sb->s_blocksize;
2363 struct page *page;
2364
2352 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
2353 S_ISLNK(inode->i_mode)))
2365 if (!ext4_can_truncate(inode))
2354 return;
2366 return;
2355 if (ext4_inode_is_fast_symlink(inode))
2356 return;
2357 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
2358 return;
2359
2360 /*
2361 * We have to lock the EOF page here, because lock_page() nests
2362 * outside jbd2_journal_start().
2363 */
2364 if ((inode->i_size & (blocksize - 1)) == 0) {
2365 /* Block boundary? Nothing to do */
2366 page = NULL;

--- 1142 unchanged lines hidden ---
2367
2368 /*
2369 * We have to lock the EOF page here, because lock_page() nests
2370 * outside jbd2_journal_start().
2371 */
2372 if ((inode->i_size & (blocksize - 1)) == 0) {
2373 /* Block boundary? Nothing to do */
2374 page = NULL;

--- 1142 unchanged lines hidden ---