inode.c (8bb2b247124ba6093455d4aef26743b1bef27bc5) | inode.c (1f7d1e77419050831a905353683807fa69a26625) |
---|---|
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 * --- 346 unchanged lines hidden (view full) --- 355 i_block + direct_blocks + 356 indirect_blocks + double_blocks, inode->i_ino); 357 } 358 if (boundary) 359 *boundary = final - 1 - (i_block & (ptrs - 1)); 360 return n; 361} 362 | 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 * --- 346 unchanged lines hidden (view full) --- 355 i_block + direct_blocks + 356 indirect_blocks + double_blocks, inode->i_ino); 357 } 358 if (boundary) 359 *boundary = final - 1 - (i_block & (ptrs - 1)); 360 return n; 361} 362 |
363static int __ext4_check_blockref(const char *function, unsigned int line, 364 struct inode *inode, 365 __le32 *p, unsigned int max) 366{ 367 struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es; 368 __le32 *bref = p; 369 unsigned int blk; 370 371 while (bref < p+max) { 372 blk = le32_to_cpu(*bref++); 373 if (blk && 374 unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb), 375 blk, 1))) { 376 es->s_last_error_block = cpu_to_le64(blk); 377 ext4_error_inode(inode, function, line, blk, 378 "invalid block"); 379 return -EIO; 380 } 381 } 382 return 0; 383} 384 385 386#define ext4_check_indirect_blockref(inode, bh) \ 387 __ext4_check_blockref(__func__, __LINE__, inode, \ 388 (__le32 *)(bh)->b_data, \ 389 EXT4_ADDR_PER_BLOCK((inode)->i_sb)) 390 391#define ext4_check_inode_blockref(inode) \ 392 __ext4_check_blockref(__func__, __LINE__, inode, \ 393 EXT4_I(inode)->i_data, \ 394 EXT4_NDIR_BLOCKS) 395 | |
396/** 397 * ext4_get_branch - read the chain of indirect blocks leading to data 398 * @inode: inode in question 399 * @depth: depth of the chain (1 - direct pointer, etc.) 400 * @offsets: offsets of pointers in inode/indirect blocks 401 * @chain: place to store the result 402 * @err: here we store the error value 403 * --- 4601 unchanged lines hidden (view full) --- 5005 (S_ISLNK(inode->i_mode) && 5006 !ext4_inode_is_fast_symlink(inode))) 5007 /* Validate extent which is part of inode */ 5008 ret = ext4_ext_check_inode(inode); 5009 } else if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 5010 (S_ISLNK(inode->i_mode) && 5011 !ext4_inode_is_fast_symlink(inode))) { 5012 /* Validate block references which are part of inode */ | 363/** 364 * ext4_get_branch - read the chain of indirect blocks leading to data 365 * @inode: inode in question 366 * @depth: depth of the chain (1 - direct pointer, etc.) 367 * @offsets: offsets of pointers in inode/indirect blocks 368 * @chain: place to store the result 369 * @err: here we store the error value 370 * --- 4601 unchanged lines hidden (view full) --- 4972 (S_ISLNK(inode->i_mode) && 4973 !ext4_inode_is_fast_symlink(inode))) 4974 /* Validate extent which is part of inode */ 4975 ret = ext4_ext_check_inode(inode); 4976 } else if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 4977 (S_ISLNK(inode->i_mode) && 4978 !ext4_inode_is_fast_symlink(inode))) { 4979 /* Validate block references which are part of inode */ |
5013 ret = ext4_check_inode_blockref(inode); | 4980 ret = ext4_ind_check_inode(inode); |
5014 } 5015 if (ret) 5016 goto bad_inode; 5017 5018 if (S_ISREG(inode->i_mode)) { 5019 inode->i_op = &ext4_file_inode_operations; 5020 inode->i_fop = &ext4_file_operations; 5021 ext4_set_aops(inode); --- 903 unchanged lines hidden --- | 4981 } 4982 if (ret) 4983 goto bad_inode; 4984 4985 if (S_ISREG(inode->i_mode)) { 4986 inode->i_op = &ext4_file_inode_operations; 4987 inode->i_fop = &ext4_file_operations; 4988 ext4_set_aops(inode); --- 903 unchanged lines hidden --- |