inode.c (bcbc8c648d6cc88f771435d8031c1a13e00945ed) | inode.c (365e215ce1f154e288ff0f7c9acbdf5421f57949) |
---|---|
1/* 2 * inode.c - NILFS inode operations. 3 * 4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 44 unchanged lines hidden (view full) --- 53 * block. It is done by VFS. 54 */ 55int nilfs_get_block(struct inode *inode, sector_t blkoff, 56 struct buffer_head *bh_result, int create) 57{ 58 struct nilfs_inode_info *ii = NILFS_I(inode); 59 __u64 blknum = 0; 60 int err = 0, ret; | 1/* 2 * inode.c - NILFS inode operations. 3 * 4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 44 unchanged lines hidden (view full) --- 53 * block. It is done by VFS. 54 */ 55int nilfs_get_block(struct inode *inode, sector_t blkoff, 56 struct buffer_head *bh_result, int create) 57{ 58 struct nilfs_inode_info *ii = NILFS_I(inode); 59 __u64 blknum = 0; 60 int err = 0, ret; |
61 struct inode *dat = nilfs_dat_inode(NILFS_I_NILFS(inode)); | 61 struct inode *dat = NILFS_I_NILFS(inode)->ns_dat; |
62 unsigned maxblocks = bh_result->b_size >> inode->i_blkbits; 63 64 down_read(&NILFS_MDT(dat)->mi_sem); 65 ret = nilfs_bmap_lookup_contig(ii->i_bmap, blkoff, &blknum, maxblocks); 66 up_read(&NILFS_MDT(dat)->mi_sem); 67 if (ret >= 0) { /* found */ 68 map_bh(bh_result, inode->i_sb, blknum); 69 if (ret > 0) --- 345 unchanged lines hidden (view full) --- 415 } 416 return 0; 417} 418 419static int __nilfs_read_inode(struct super_block *sb, 420 struct nilfs_root *root, unsigned long ino, 421 struct inode *inode) 422{ | 62 unsigned maxblocks = bh_result->b_size >> inode->i_blkbits; 63 64 down_read(&NILFS_MDT(dat)->mi_sem); 65 ret = nilfs_bmap_lookup_contig(ii->i_bmap, blkoff, &blknum, maxblocks); 66 up_read(&NILFS_MDT(dat)->mi_sem); 67 if (ret >= 0) { /* found */ 68 map_bh(bh_result, inode->i_sb, blknum); 69 if (ret > 0) --- 345 unchanged lines hidden (view full) --- 415 } 416 return 0; 417} 418 419static int __nilfs_read_inode(struct super_block *sb, 420 struct nilfs_root *root, unsigned long ino, 421 struct inode *inode) 422{ |
423 struct nilfs_sb_info *sbi = NILFS_SB(sb); 424 struct inode *dat = nilfs_dat_inode(sbi->s_nilfs); | 423 struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs; |
425 struct buffer_head *bh; 426 struct nilfs_inode *raw_inode; 427 int err; 428 | 424 struct buffer_head *bh; 425 struct nilfs_inode *raw_inode; 426 int err; 427 |
429 down_read(&NILFS_MDT(dat)->mi_sem); /* XXX */ | 428 down_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem); |
430 err = nilfs_ifile_get_inode_block(root->ifile, ino, &bh); 431 if (unlikely(err)) 432 goto bad_inode; 433 434 raw_inode = nilfs_ifile_map_inode(root->ifile, ino, bh); 435 436 err = nilfs_read_inode_common(inode, raw_inode); 437 if (err) --- 13 unchanged lines hidden (view full) --- 451 } else { 452 inode->i_op = &nilfs_special_inode_operations; 453 init_special_inode( 454 inode, inode->i_mode, 455 huge_decode_dev(le64_to_cpu(raw_inode->i_device_code))); 456 } 457 nilfs_ifile_unmap_inode(root->ifile, ino, bh); 458 brelse(bh); | 429 err = nilfs_ifile_get_inode_block(root->ifile, ino, &bh); 430 if (unlikely(err)) 431 goto bad_inode; 432 433 raw_inode = nilfs_ifile_map_inode(root->ifile, ino, bh); 434 435 err = nilfs_read_inode_common(inode, raw_inode); 436 if (err) --- 13 unchanged lines hidden (view full) --- 450 } else { 451 inode->i_op = &nilfs_special_inode_operations; 452 init_special_inode( 453 inode, inode->i_mode, 454 huge_decode_dev(le64_to_cpu(raw_inode->i_device_code))); 455 } 456 nilfs_ifile_unmap_inode(root->ifile, ino, bh); 457 brelse(bh); |
459 up_read(&NILFS_MDT(dat)->mi_sem); /* XXX */ | 458 up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem); |
460 nilfs_set_inode_flags(inode); 461 return 0; 462 463 failed_unmap: 464 nilfs_ifile_unmap_inode(root->ifile, ino, bh); 465 brelse(bh); 466 467 bad_inode: | 459 nilfs_set_inode_flags(inode); 460 return 0; 461 462 failed_unmap: 463 nilfs_ifile_unmap_inode(root->ifile, ino, bh); 464 brelse(bh); 465 466 bad_inode: |
468 up_read(&NILFS_MDT(dat)->mi_sem); /* XXX */ | 467 up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem); |
469 return err; 470} 471 472static int nilfs_iget_test(struct inode *inode, void *opaque) 473{ 474 struct nilfs_iget_args *args = opaque; 475 struct nilfs_inode_info *ii; 476 --- 571 unchanged lines hidden --- | 468 return err; 469} 470 471static int nilfs_iget_test(struct inode *inode, void *opaque) 472{ 473 struct nilfs_iget_args *args = opaque; 474 struct nilfs_inode_info *ii; 475 --- 571 unchanged lines hidden --- |