Lines Matching refs:inode
44 static int ext3_writepage_trans_blocks(struct inode *inode);
49 static int ext3_inode_is_fast_symlink(struct inode *inode) in ext3_inode_is_fast_symlink() argument
51 int ea_blocks = EXT3_I(inode)->i_file_acl ? in ext3_inode_is_fast_symlink()
52 (inode->i_sb->s_blocksize >> 9) : 0; in ext3_inode_is_fast_symlink()
54 return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0); in ext3_inode_is_fast_symlink()
66 int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, in ext3_forget() argument
77 bh, is_metadata, inode->i_mode, in ext3_forget()
78 test_opt(inode->i_sb, DATA_FLAGS)); in ext3_forget()
85 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA || in ext3_forget()
86 (!is_metadata && !ext3_should_journal_data(inode))) { in ext3_forget()
100 ext3_abort(inode->i_sb, __func__, in ext3_forget()
110 static unsigned long blocks_for_truncate(struct inode *inode) in blocks_for_truncate() argument
114 needed = inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9); in blocks_for_truncate()
130 return EXT3_DATA_TRANS_BLOCKS(inode->i_sb) + needed; in blocks_for_truncate()
143 static handle_t *start_transaction(struct inode *inode) in start_transaction() argument
147 result = ext3_journal_start(inode, blocks_for_truncate(inode)); in start_transaction()
151 ext3_std_error(inode->i_sb, PTR_ERR(result)); in start_transaction()
161 static int try_to_extend_transaction(handle_t *handle, struct inode *inode) in try_to_extend_transaction() argument
165 if (!ext3_journal_extend(handle, blocks_for_truncate(inode))) in try_to_extend_transaction()
175 static int ext3_journal_test_restart(handle_t *handle, struct inode *inode) in ext3_journal_test_restart() argument
178 return ext3_journal_restart(handle, blocks_for_truncate(inode)); in ext3_journal_test_restart()
184 void ext3_delete_inode (struct inode * inode) in ext3_delete_inode() argument
188 truncate_inode_pages(&inode->i_data, 0); in ext3_delete_inode()
190 if (is_bad_inode(inode)) in ext3_delete_inode()
193 handle = start_transaction(inode); in ext3_delete_inode()
200 ext3_orphan_del(NULL, inode); in ext3_delete_inode()
204 if (IS_SYNC(inode)) in ext3_delete_inode()
206 inode->i_size = 0; in ext3_delete_inode()
207 if (inode->i_blocks) in ext3_delete_inode()
208 ext3_truncate(inode); in ext3_delete_inode()
217 ext3_orphan_del(handle, inode); in ext3_delete_inode()
218 EXT3_I(inode)->i_dtime = get_seconds(); in ext3_delete_inode()
227 if (ext3_mark_inode_dirty(handle, inode)) in ext3_delete_inode()
229 clear_inode(inode); in ext3_delete_inode()
231 ext3_free_inode(handle, inode); in ext3_delete_inode()
235 clear_inode(inode); /* We must guarantee clearing of inode... */ in ext3_delete_inode()
288 static int ext3_block_to_path(struct inode *inode, in ext3_block_to_path() argument
291 int ptrs = EXT3_ADDR_PER_BLOCK(inode->i_sb); in ext3_block_to_path()
292 int ptrs_bits = EXT3_ADDR_PER_BLOCK_BITS(inode->i_sb); in ext3_block_to_path()
300 ext3_warning (inode->i_sb, "ext3_block_to_path", "block < 0"); in ext3_block_to_path()
320 ext3_warning(inode->i_sb, "ext3_block_to_path", "block > big"); in ext3_block_to_path()
356 static Indirect *ext3_get_branch(struct inode *inode, int depth, int *offsets, in ext3_get_branch() argument
359 struct super_block *sb = inode->i_sb; in ext3_get_branch()
365 add_chain (chain, NULL, EXT3_I(inode)->i_data + *offsets); in ext3_get_branch()
412 static ext3_fsblk_t ext3_find_near(struct inode *inode, Indirect *ind) in ext3_find_near() argument
414 struct ext3_inode_info *ei = EXT3_I(inode); in ext3_find_near()
434 bg_start = ext3_group_first_block_no(inode->i_sb, ei->i_block_group); in ext3_find_near()
436 (EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16); in ext3_find_near()
450 static ext3_fsblk_t ext3_find_goal(struct inode *inode, long block, in ext3_find_goal() argument
455 block_i = EXT3_I(inode)->i_block_alloc_info; in ext3_find_goal()
466 return ext3_find_near(inode, partial); in ext3_find_goal()
517 static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, in ext3_alloc_blocks() argument
540 current_block = ext3_new_blocks(handle,inode,goal,&count,err); in ext3_alloc_blocks()
564 ext3_free_blocks(handle, inode, new_blocks[i], 1); in ext3_alloc_blocks()
593 static int ext3_alloc_branch(handle_t *handle, struct inode *inode, in ext3_alloc_branch() argument
597 int blocksize = inode->i_sb->s_blocksize; in ext3_alloc_branch()
605 num = ext3_alloc_blocks(handle, inode, goal, indirect_blks, in ext3_alloc_branch()
620 bh = sb_getblk(inode->i_sb, new_blocks[n-1]); in ext3_alloc_branch()
663 ext3_free_blocks(handle, inode, new_blocks[i], 1); in ext3_alloc_branch()
665 ext3_free_blocks(handle, inode, new_blocks[i], num); in ext3_alloc_branch()
684 static int ext3_splice_branch(handle_t *handle, struct inode *inode, in ext3_splice_branch() argument
692 block_i = EXT3_I(inode)->i_block_alloc_info; in ext3_splice_branch()
731 inode->i_ctime = CURRENT_TIME_SEC; in ext3_splice_branch()
732 ext3_mark_inode_dirty(handle, inode); in ext3_splice_branch()
762 ext3_free_blocks(handle,inode,le32_to_cpu(where[i-1].key),1); in ext3_splice_branch()
764 ext3_free_blocks(handle, inode, le32_to_cpu(where[num].key), blks); in ext3_splice_branch()
788 int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, in ext3_get_blocks_handle() argument
801 struct ext3_inode_info *ei = EXT3_I(inode); in ext3_get_blocks_handle()
807 depth = ext3_block_to_path(inode,iblock,offsets,&blocks_to_boundary); in ext3_get_blocks_handle()
812 partial = ext3_get_branch(inode, depth, offsets, chain, &err); in ext3_get_blocks_handle()
869 partial = ext3_get_branch(inode, depth, offsets, chain, &err); in ext3_get_blocks_handle()
884 if (S_ISREG(inode->i_mode) && (!ei->i_block_alloc_info)) in ext3_get_blocks_handle()
885 ext3_init_block_alloc_info(inode); in ext3_get_blocks_handle()
887 goal = ext3_find_goal(inode, iblock, partial); in ext3_get_blocks_handle()
901 err = ext3_alloc_branch(handle, inode, indirect_blks, &count, goal, in ext3_get_blocks_handle()
912 err = ext3_splice_branch(handle, inode, iblock, in ext3_get_blocks_handle()
919 if (!err && extend_disksize && inode->i_size > ei->i_disksize) in ext3_get_blocks_handle()
920 ei->i_disksize = inode->i_size; in ext3_get_blocks_handle()
927 map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); in ext3_get_blocks_handle()
955 static int ext3_get_block(struct inode *inode, sector_t iblock, in ext3_get_block() argument
960 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits; in ext3_get_block()
965 handle = ext3_journal_start(inode, DIO_CREDITS + in ext3_get_block()
966 2 * EXT3_QUOTA_TRANS_BLOCKS(inode->i_sb)); in ext3_get_block()
974 ret = ext3_get_blocks_handle(handle, inode, iblock, in ext3_get_block()
977 bh_result->b_size = (ret << inode->i_blkbits); in ext3_get_block()
986 int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, in ext3_fiemap() argument
989 return generic_block_fiemap(inode, fieinfo, start, len, in ext3_fiemap()
996 struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode, in ext3_getblk() argument
1007 err = ext3_get_blocks_handle(handle, inode, block, 1, in ext3_getblk()
1021 bh = sb_getblk(inode->i_sb, dummy.b_blocknr); in ext3_getblk()
1041 memset(bh->b_data,0,inode->i_sb->s_blocksize); in ext3_getblk()
1063 struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode, in ext3_bread() argument
1068 bh = ext3_getblk(handle, inode, block, create, err); in ext3_bread()
1151 struct inode *inode = mapping->host; in ext3_write_begin() local
1152 int ret, needed_blocks = ext3_writepage_trans_blocks(inode); in ext3_write_begin()
1169 handle = ext3_journal_start(inode, needed_blocks); in ext3_write_begin()
1181 if (ext3_should_journal_data(inode)) { in ext3_write_begin()
1195 if (pos + len > inode->i_size) in ext3_write_begin()
1196 vmtruncate(inode, inode->i_size); in ext3_write_begin()
1198 if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) in ext3_write_begin()
1234 struct inode *inode = file->f_mapping->host; in ext3_generic_write_end() local
1238 if (pos+copied > inode->i_size) { in ext3_generic_write_end()
1239 i_size_write(inode, pos+copied); in ext3_generic_write_end()
1240 mark_inode_dirty(inode); in ext3_generic_write_end()
1259 struct inode *inode = file->f_mapping->host; in ext3_ordered_write_end() local
1278 if (new_i_size > EXT3_I(inode)->i_disksize) in ext3_ordered_write_end()
1279 EXT3_I(inode)->i_disksize = new_i_size; in ext3_ordered_write_end()
1301 struct inode *inode = file->f_mapping->host; in ext3_writeback_write_end() local
1306 if (new_i_size > EXT3_I(inode)->i_disksize) in ext3_writeback_write_end()
1307 EXT3_I(inode)->i_disksize = new_i_size; in ext3_writeback_write_end()
1330 struct inode *inode = mapping->host; in ext3_journalled_write_end() local
1348 if (pos+copied > inode->i_size) in ext3_journalled_write_end()
1349 i_size_write(inode, pos+copied); in ext3_journalled_write_end()
1350 EXT3_I(inode)->i_state |= EXT3_STATE_JDATA; in ext3_journalled_write_end()
1351 if (inode->i_size > EXT3_I(inode)->i_disksize) { in ext3_journalled_write_end()
1352 EXT3_I(inode)->i_disksize = inode->i_size; in ext3_journalled_write_end()
1353 ret2 = ext3_mark_inode_dirty(handle, inode); in ext3_journalled_write_end()
1383 struct inode *inode = mapping->host; in ext3_bmap() local
1387 if (EXT3_I(inode)->i_state & EXT3_STATE_JDATA) { in ext3_bmap()
1406 EXT3_I(inode)->i_state &= ~EXT3_STATE_JDATA; in ext3_bmap()
1407 journal = EXT3_JOURNAL(inode); in ext3_bmap()
1493 struct inode *inode = page->mapping->host; in ext3_ordered_writepage() local
1508 handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode)); in ext3_ordered_writepage()
1516 create_empty_buffers(page, inode->i_sb->s_blocksize, in ext3_ordered_writepage()
1559 struct inode *inode = page->mapping->host; in ext3_writeback_writepage() local
1567 handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode)); in ext3_writeback_writepage()
1573 if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode)) in ext3_writeback_writepage()
1592 struct inode *inode = page->mapping->host; in ext3_journalled_writepage() local
1600 handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode)); in ext3_journalled_writepage()
1625 EXT3_I(inode)->i_state |= EXT3_STATE_JDATA; in ext3_journalled_writepage()
1697 struct inode *inode = file->f_mapping->host; in ext3_direct_IO() local
1698 struct ext3_inode_info *ei = EXT3_I(inode); in ext3_direct_IO()
1707 if (final_size > inode->i_size) { in ext3_direct_IO()
1709 handle = ext3_journal_start(inode, 2); in ext3_direct_IO()
1714 ret = ext3_orphan_add(handle, inode); in ext3_direct_IO()
1720 ei->i_disksize = inode->i_size; in ext3_direct_IO()
1725 ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, in ext3_direct_IO()
1733 handle = ext3_journal_start(inode, 2); in ext3_direct_IO()
1741 if (inode->i_nlink) in ext3_direct_IO()
1742 ext3_orphan_del(handle, inode); in ext3_direct_IO()
1745 if (end > inode->i_size) { in ext3_direct_IO()
1747 i_size_write(inode, end); in ext3_direct_IO()
1755 ext3_mark_inode_dirty(handle, inode); in ext3_direct_IO()
1829 void ext3_set_aops(struct inode *inode) in ext3_set_aops() argument
1831 if (ext3_should_order_data(inode)) in ext3_set_aops()
1832 inode->i_mapping->a_ops = &ext3_ordered_aops; in ext3_set_aops()
1833 else if (ext3_should_writeback_data(inode)) in ext3_set_aops()
1834 inode->i_mapping->a_ops = &ext3_writeback_aops; in ext3_set_aops()
1836 inode->i_mapping->a_ops = &ext3_journalled_aops; in ext3_set_aops()
1851 struct inode *inode = mapping->host; in ext3_block_truncate_page() local
1855 blocksize = inode->i_sb->s_blocksize; in ext3_block_truncate_page()
1857 iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); in ext3_block_truncate_page()
1863 if (!page_has_buffers(page) && test_opt(inode->i_sb, NOBH) && in ext3_block_truncate_page()
1864 ext3_should_writeback_data(inode) && PageUptodate(page)) { in ext3_block_truncate_page()
1890 ext3_get_block(inode, iblock, bh, 0); in ext3_block_truncate_page()
1911 if (ext3_should_journal_data(inode)) { in ext3_block_truncate_page()
1922 if (ext3_should_journal_data(inode)) { in ext3_block_truncate_page()
1925 if (ext3_should_order_data(inode)) in ext3_block_truncate_page()
1984 static Indirect *ext3_find_shared(struct inode *inode, int depth, in ext3_find_shared() argument
1994 partial = ext3_get_branch(inode, k, offsets, chain, &err); in ext3_find_shared()
2040 static void ext3_clear_blocks(handle_t *handle, struct inode *inode, in ext3_clear_blocks() argument
2045 if (try_to_extend_transaction(handle, inode)) { in ext3_clear_blocks()
2050 ext3_mark_inode_dirty(handle, inode); in ext3_clear_blocks()
2051 ext3_journal_test_restart(handle, inode); in ext3_clear_blocks()
2072 bh = sb_find_get_block(inode->i_sb, nr); in ext3_clear_blocks()
2073 ext3_forget(handle, 0, inode, bh, nr); in ext3_clear_blocks()
2077 ext3_free_blocks(handle, inode, block_to_free, count); in ext3_clear_blocks()
2099 static void ext3_free_data(handle_t *handle, struct inode *inode, in ext3_free_data() argument
2133 ext3_clear_blocks(handle, inode, this_bh, in ext3_free_data()
2144 ext3_clear_blocks(handle, inode, this_bh, block_to_free, in ext3_free_data()
2159 ext3_error(inode->i_sb, "ext3_free_data", in ext3_free_data()
2162 inode->i_ino, in ext3_free_data()
2180 static void ext3_free_branches(handle_t *handle, struct inode *inode, in ext3_free_branches() argument
2192 int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb); in ext3_free_branches()
2200 bh = sb_bread(inode->i_sb, nr); in ext3_free_branches()
2207 ext3_error(inode->i_sb, "ext3_free_branches", in ext3_free_branches()
2209 inode->i_ino, nr); in ext3_free_branches()
2215 ext3_free_branches(handle, inode, bh, in ext3_free_branches()
2239 ext3_forget(handle, 1, inode, bh, bh->b_blocknr); in ext3_free_branches()
2259 if (try_to_extend_transaction(handle, inode)) { in ext3_free_branches()
2260 ext3_mark_inode_dirty(handle, inode); in ext3_free_branches()
2261 ext3_journal_test_restart(handle, inode); in ext3_free_branches()
2264 ext3_free_blocks(handle, inode, nr, 1); in ext3_free_branches()
2285 ext3_free_data(handle, inode, parent_bh, first, last); in ext3_free_branches()
2289 int ext3_can_truncate(struct inode *inode) in ext3_can_truncate() argument
2291 if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) in ext3_can_truncate()
2293 if (S_ISREG(inode->i_mode)) in ext3_can_truncate()
2295 if (S_ISDIR(inode->i_mode)) in ext3_can_truncate()
2297 if (S_ISLNK(inode->i_mode)) in ext3_can_truncate()
2298 return !ext3_inode_is_fast_symlink(inode); in ext3_can_truncate()
2330 void ext3_truncate(struct inode *inode) in ext3_truncate() argument
2333 struct ext3_inode_info *ei = EXT3_I(inode); in ext3_truncate()
2335 int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb); in ext3_truncate()
2336 struct address_space *mapping = inode->i_mapping; in ext3_truncate()
2343 unsigned blocksize = inode->i_sb->s_blocksize; in ext3_truncate()
2346 if (!ext3_can_truncate(inode)) in ext3_truncate()
2353 if ((inode->i_size & (blocksize - 1)) == 0) { in ext3_truncate()
2358 inode->i_size >> PAGE_CACHE_SHIFT); in ext3_truncate()
2363 handle = start_transaction(inode); in ext3_truncate()
2374 last_block = (inode->i_size + blocksize-1) in ext3_truncate()
2375 >> EXT3_BLOCK_SIZE_BITS(inode->i_sb); in ext3_truncate()
2378 ext3_block_truncate_page(handle, page, mapping, inode->i_size); in ext3_truncate()
2380 n = ext3_block_to_path(inode, last_block, offsets, NULL); in ext3_truncate()
2393 if (ext3_orphan_add(handle, inode)) in ext3_truncate()
2403 ei->i_disksize = inode->i_size; in ext3_truncate()
2412 ext3_free_data(handle, inode, NULL, i_data+offsets[0], in ext3_truncate()
2417 partial = ext3_find_shared(inode, n, offsets, chain, &nr); in ext3_truncate()
2422 ext3_free_branches(handle, inode, NULL, in ext3_truncate()
2432 ext3_free_branches(handle, inode, partial->bh, in ext3_truncate()
2439 ext3_free_branches(handle, inode, partial->bh, partial->p + 1, in ext3_truncate()
2452 ext3_free_branches(handle, inode, NULL, &nr, &nr+1, 1); in ext3_truncate()
2458 ext3_free_branches(handle, inode, NULL, &nr, &nr+1, 2); in ext3_truncate()
2464 ext3_free_branches(handle, inode, NULL, &nr, &nr+1, 3); in ext3_truncate()
2471 ext3_discard_reservation(inode); in ext3_truncate()
2474 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; in ext3_truncate()
2475 ext3_mark_inode_dirty(handle, inode); in ext3_truncate()
2481 if (IS_SYNC(inode)) in ext3_truncate()
2491 if (inode->i_nlink) in ext3_truncate()
2492 ext3_orphan_del(handle, inode); in ext3_truncate()
2537 static int __ext3_get_inode_loc(struct inode *inode, in __ext3_get_inode_loc() argument
2543 block = ext3_get_inode_block(inode->i_sb, inode->i_ino, iloc); in __ext3_get_inode_loc()
2547 bh = sb_getblk(inode->i_sb, block); in __ext3_get_inode_loc()
2549 ext3_error (inode->i_sb, "ext3_get_inode_loc", in __ext3_get_inode_loc()
2552 inode->i_ino, block); in __ext3_get_inode_loc()
2586 block_group = (inode->i_ino - 1) / in __ext3_get_inode_loc()
2587 EXT3_INODES_PER_GROUP(inode->i_sb); in __ext3_get_inode_loc()
2589 EXT3_INODE_SIZE(inode->i_sb); in __ext3_get_inode_loc()
2590 inode_offset = ((inode->i_ino - 1) % in __ext3_get_inode_loc()
2591 EXT3_INODES_PER_GROUP(inode->i_sb)); in __ext3_get_inode_loc()
2595 desc = ext3_get_group_desc(inode->i_sb, in __ext3_get_inode_loc()
2600 bitmap_bh = sb_getblk(inode->i_sb, in __ext3_get_inode_loc()
2641 ext3_error(inode->i_sb, "ext3_get_inode_loc", in __ext3_get_inode_loc()
2644 inode->i_ino, block); in __ext3_get_inode_loc()
2654 int ext3_get_inode_loc(struct inode *inode, struct ext3_iloc *iloc) in ext3_get_inode_loc() argument
2657 return __ext3_get_inode_loc(inode, iloc, in ext3_get_inode_loc()
2658 !(EXT3_I(inode)->i_state & EXT3_STATE_XATTR)); in ext3_get_inode_loc()
2661 void ext3_set_inode_flags(struct inode *inode) in ext3_set_inode_flags() argument
2663 unsigned int flags = EXT3_I(inode)->i_flags; in ext3_set_inode_flags()
2665 inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); in ext3_set_inode_flags()
2667 inode->i_flags |= S_SYNC; in ext3_set_inode_flags()
2669 inode->i_flags |= S_APPEND; in ext3_set_inode_flags()
2671 inode->i_flags |= S_IMMUTABLE; in ext3_set_inode_flags()
2673 inode->i_flags |= S_NOATIME; in ext3_set_inode_flags()
2675 inode->i_flags |= S_DIRSYNC; in ext3_set_inode_flags()
2697 struct inode *ext3_iget(struct super_block *sb, unsigned long ino) in ext3_iget()
2703 struct inode *inode; in ext3_iget() local
2707 inode = iget_locked(sb, ino); in ext3_iget()
2708 if (!inode) in ext3_iget()
2710 if (!(inode->i_state & I_NEW)) in ext3_iget()
2711 return inode; in ext3_iget()
2713 ei = EXT3_I(inode); in ext3_iget()
2720 ret = __ext3_get_inode_loc(inode, &iloc, 0); in ext3_iget()
2725 inode->i_mode = le16_to_cpu(raw_inode->i_mode); in ext3_iget()
2726 inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low); in ext3_iget()
2727 inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low); in ext3_iget()
2728 if(!(test_opt (inode->i_sb, NO_UID32))) { in ext3_iget()
2729 inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16; in ext3_iget()
2730 inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16; in ext3_iget()
2732 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); in ext3_iget()
2733 inode->i_size = le32_to_cpu(raw_inode->i_size); in ext3_iget()
2734 inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime); in ext3_iget()
2735 inode->i_ctime.tv_sec = (signed)le32_to_cpu(raw_inode->i_ctime); in ext3_iget()
2736 inode->i_mtime.tv_sec = (signed)le32_to_cpu(raw_inode->i_mtime); in ext3_iget()
2737 inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0; in ext3_iget()
2747 if (inode->i_nlink == 0) { in ext3_iget()
2748 if (inode->i_mode == 0 || in ext3_iget()
2749 !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ORPHAN_FS)) { in ext3_iget()
2760 inode->i_blocks = le32_to_cpu(raw_inode->i_blocks); in ext3_iget()
2768 if (!S_ISREG(inode->i_mode)) { in ext3_iget()
2771 inode->i_size |= in ext3_iget()
2774 ei->i_disksize = inode->i_size; in ext3_iget()
2775 inode->i_generation = le32_to_cpu(raw_inode->i_generation); in ext3_iget()
2785 if (inode->i_ino >= EXT3_FIRST_INO(inode->i_sb) + 1 && in ext3_iget()
2786 EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) { in ext3_iget()
2794 EXT3_INODE_SIZE(inode->i_sb)) { in ext3_iget()
2813 if (S_ISREG(inode->i_mode)) { in ext3_iget()
2814 inode->i_op = &ext3_file_inode_operations; in ext3_iget()
2815 inode->i_fop = &ext3_file_operations; in ext3_iget()
2816 ext3_set_aops(inode); in ext3_iget()
2817 } else if (S_ISDIR(inode->i_mode)) { in ext3_iget()
2818 inode->i_op = &ext3_dir_inode_operations; in ext3_iget()
2819 inode->i_fop = &ext3_dir_operations; in ext3_iget()
2820 } else if (S_ISLNK(inode->i_mode)) { in ext3_iget()
2821 if (ext3_inode_is_fast_symlink(inode)) { in ext3_iget()
2822 inode->i_op = &ext3_fast_symlink_inode_operations; in ext3_iget()
2823 nd_terminate_link(ei->i_data, inode->i_size, in ext3_iget()
2826 inode->i_op = &ext3_symlink_inode_operations; in ext3_iget()
2827 ext3_set_aops(inode); in ext3_iget()
2830 inode->i_op = &ext3_special_inode_operations; in ext3_iget()
2832 init_special_inode(inode, inode->i_mode, in ext3_iget()
2835 init_special_inode(inode, inode->i_mode, in ext3_iget()
2839 ext3_set_inode_flags(inode); in ext3_iget()
2840 unlock_new_inode(inode); in ext3_iget()
2841 return inode; in ext3_iget()
2844 iget_failed(inode); in ext3_iget()
2856 struct inode *inode, in ext3_do_update_inode() argument
2860 struct ext3_inode_info *ei = EXT3_I(inode); in ext3_do_update_inode()
2867 memset(raw_inode, 0, EXT3_SB(inode->i_sb)->s_inode_size); in ext3_do_update_inode()
2870 raw_inode->i_mode = cpu_to_le16(inode->i_mode); in ext3_do_update_inode()
2871 if(!(test_opt(inode->i_sb, NO_UID32))) { in ext3_do_update_inode()
2872 raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid)); in ext3_do_update_inode()
2873 raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid)); in ext3_do_update_inode()
2880 cpu_to_le16(high_16_bits(inode->i_uid)); in ext3_do_update_inode()
2882 cpu_to_le16(high_16_bits(inode->i_gid)); in ext3_do_update_inode()
2889 cpu_to_le16(fs_high2lowuid(inode->i_uid)); in ext3_do_update_inode()
2891 cpu_to_le16(fs_high2lowgid(inode->i_gid)); in ext3_do_update_inode()
2895 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); in ext3_do_update_inode()
2897 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec); in ext3_do_update_inode()
2898 raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec); in ext3_do_update_inode()
2899 raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec); in ext3_do_update_inode()
2900 raw_inode->i_blocks = cpu_to_le32(inode->i_blocks); in ext3_do_update_inode()
2909 if (!S_ISREG(inode->i_mode)) { in ext3_do_update_inode()
2915 struct super_block *sb = inode->i_sb; in ext3_do_update_inode()
2937 raw_inode->i_generation = cpu_to_le32(inode->i_generation); in ext3_do_update_inode()
2938 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) { in ext3_do_update_inode()
2939 if (old_valid_dev(inode->i_rdev)) { in ext3_do_update_inode()
2941 cpu_to_le32(old_encode_dev(inode->i_rdev)); in ext3_do_update_inode()
2946 cpu_to_le32(new_encode_dev(inode->i_rdev)); in ext3_do_update_inode()
2963 ext3_std_error(inode->i_sb, err); in ext3_do_update_inode()
3002 int ext3_write_inode(struct inode *inode, int wait) in ext3_write_inode() argument
3016 return ext3_force_commit(inode->i_sb); in ext3_write_inode()
3038 struct inode *inode = dentry->d_inode; in ext3_setattr() local
3042 error = inode_change_ok(inode, attr); in ext3_setattr()
3046 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || in ext3_setattr()
3047 (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { in ext3_setattr()
3052 handle = ext3_journal_start(inode, 2*(EXT3_QUOTA_INIT_BLOCKS(inode->i_sb)+ in ext3_setattr()
3053 EXT3_QUOTA_DEL_BLOCKS(inode->i_sb))+3); in ext3_setattr()
3058 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; in ext3_setattr()
3066 inode->i_uid = attr->ia_uid; in ext3_setattr()
3068 inode->i_gid = attr->ia_gid; in ext3_setattr()
3069 error = ext3_mark_inode_dirty(handle, inode); in ext3_setattr()
3073 if (S_ISREG(inode->i_mode) && in ext3_setattr()
3074 attr->ia_valid & ATTR_SIZE && attr->ia_size < inode->i_size) { in ext3_setattr()
3077 handle = ext3_journal_start(inode, 3); in ext3_setattr()
3083 error = ext3_orphan_add(handle, inode); in ext3_setattr()
3084 EXT3_I(inode)->i_disksize = attr->ia_size; in ext3_setattr()
3085 rc = ext3_mark_inode_dirty(handle, inode); in ext3_setattr()
3091 rc = inode_setattr(inode, attr); in ext3_setattr()
3096 if (inode->i_nlink) in ext3_setattr()
3097 ext3_orphan_del(NULL, inode); in ext3_setattr()
3100 rc = ext3_acl_chmod(inode); in ext3_setattr()
3103 ext3_std_error(inode->i_sb, error); in ext3_setattr()
3137 static int ext3_writepage_trans_blocks(struct inode *inode) in ext3_writepage_trans_blocks() argument
3139 int bpp = ext3_journal_blocks_per_page(inode); in ext3_writepage_trans_blocks()
3143 if (ext3_should_journal_data(inode)) in ext3_writepage_trans_blocks()
3151 ret += 2*EXT3_QUOTA_TRANS_BLOCKS(inode->i_sb); in ext3_writepage_trans_blocks()
3162 struct inode *inode, struct ext3_iloc *iloc) in ext3_mark_iloc_dirty() argument
3170 err = ext3_do_update_inode(handle, inode, iloc); in ext3_mark_iloc_dirty()
3181 ext3_reserve_inode_write(handle_t *handle, struct inode *inode, in ext3_reserve_inode_write() argument
3186 err = ext3_get_inode_loc(inode, iloc); in ext3_reserve_inode_write()
3196 ext3_std_error(inode->i_sb, err); in ext3_reserve_inode_write()
3221 int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode) in ext3_mark_inode_dirty() argument
3227 err = ext3_reserve_inode_write(handle, inode, &iloc); in ext3_mark_inode_dirty()
3229 err = ext3_mark_iloc_dirty(handle, inode, &iloc); in ext3_mark_inode_dirty()
3247 void ext3_dirty_inode(struct inode *inode) in ext3_dirty_inode() argument
3252 handle = ext3_journal_start(inode, 2); in ext3_dirty_inode()
3263 ext3_mark_inode_dirty(handle, inode); in ext3_dirty_inode()
3278 static int ext3_pin_inode(handle_t *handle, struct inode *inode)
3284 err = ext3_get_inode_loc(inode, &iloc);
3294 ext3_std_error(inode->i_sb, err);
3299 int ext3_change_inode_journal_flag(struct inode *inode, int val) in ext3_change_inode_journal_flag() argument
3315 journal = EXT3_JOURNAL(inode); in ext3_change_inode_journal_flag()
3331 EXT3_I(inode)->i_flags |= EXT3_JOURNAL_DATA_FL; in ext3_change_inode_journal_flag()
3333 EXT3_I(inode)->i_flags &= ~EXT3_JOURNAL_DATA_FL; in ext3_change_inode_journal_flag()
3334 ext3_set_aops(inode); in ext3_change_inode_journal_flag()
3340 handle = ext3_journal_start(inode, 1); in ext3_change_inode_journal_flag()
3344 err = ext3_mark_inode_dirty(handle, inode); in ext3_change_inode_journal_flag()
3347 ext3_std_error(inode->i_sb, err); in ext3_change_inode_journal_flag()