@@ -1987,19 +1987,19 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
19871987**
19881988** on failure, nonzero is returned, page_result and bh_result are untouched.
19891989*/
1990- static int grab_tail_page (struct inode * p_s_inode ,
1990+ static int grab_tail_page (struct inode * inode ,
19911991 struct page * * page_result ,
19921992 struct buffer_head * * bh_result )
19931993{
19941994
19951995 /* we want the page with the last byte in the file,
19961996 ** not the page that will hold the next byte for appending
19971997 */
1998- unsigned long index = (p_s_inode -> i_size - 1 ) >> PAGE_CACHE_SHIFT ;
1998+ unsigned long index = (inode -> i_size - 1 ) >> PAGE_CACHE_SHIFT ;
19991999 unsigned long pos = 0 ;
20002000 unsigned long start = 0 ;
2001- unsigned long blocksize = p_s_inode -> i_sb -> s_blocksize ;
2002- unsigned long offset = (p_s_inode -> i_size ) & (PAGE_CACHE_SIZE - 1 );
2001+ unsigned long blocksize = inode -> i_sb -> s_blocksize ;
2002+ unsigned long offset = (inode -> i_size ) & (PAGE_CACHE_SIZE - 1 );
20032003 struct buffer_head * bh ;
20042004 struct buffer_head * head ;
20052005 struct page * page ;
@@ -2013,7 +2013,7 @@ static int grab_tail_page(struct inode *p_s_inode,
20132013 if ((offset & (blocksize - 1 )) == 0 ) {
20142014 return - ENOENT ;
20152015 }
2016- page = grab_cache_page (p_s_inode -> i_mapping , index );
2016+ page = grab_cache_page (inode -> i_mapping , index );
20172017 error = - ENOMEM ;
20182018 if (!page ) {
20192019 goto out ;
@@ -2042,7 +2042,7 @@ static int grab_tail_page(struct inode *p_s_inode,
20422042 ** I've screwed up the code to find the buffer, or the code to
20432043 ** call prepare_write
20442044 */
2045- reiserfs_error (p_s_inode -> i_sb , "clm-6000" ,
2045+ reiserfs_error (inode -> i_sb , "clm-6000" ,
20462046 "error reading block %lu" , bh -> b_blocknr );
20472047 error = - EIO ;
20482048 goto unlock ;
@@ -2065,27 +2065,28 @@ static int grab_tail_page(struct inode *p_s_inode,
20652065**
20662066** some code taken from block_truncate_page
20672067*/
2068- int reiserfs_truncate_file (struct inode * p_s_inode , int update_timestamps )
2068+ int reiserfs_truncate_file (struct inode * inode , int update_timestamps )
20692069{
20702070 struct reiserfs_transaction_handle th ;
20712071 /* we want the offset for the first byte after the end of the file */
2072- unsigned long offset = p_s_inode -> i_size & (PAGE_CACHE_SIZE - 1 );
2073- unsigned blocksize = p_s_inode -> i_sb -> s_blocksize ;
2072+ unsigned long offset = inode -> i_size & (PAGE_CACHE_SIZE - 1 );
2073+ unsigned blocksize = inode -> i_sb -> s_blocksize ;
20742074 unsigned length ;
20752075 struct page * page = NULL ;
20762076 int error ;
20772077 struct buffer_head * bh = NULL ;
20782078 int err2 ;
20792079
2080- reiserfs_write_lock (p_s_inode -> i_sb );
2080+ reiserfs_write_lock (inode -> i_sb );
20812081
2082- if (p_s_inode -> i_size > 0 ) {
2083- if ((error = grab_tail_page (p_s_inode , & page , & bh ))) {
2082+ if (inode -> i_size > 0 ) {
2083+ error = grab_tail_page (inode , & page , & bh );
2084+ if (error ) {
20842085 // -ENOENT means we truncated past the end of the file,
20852086 // and get_block_create_0 could not find a block to read in,
20862087 // which is ok.
20872088 if (error != - ENOENT )
2088- reiserfs_error (p_s_inode -> i_sb , "clm-6001" ,
2089+ reiserfs_error (inode -> i_sb , "clm-6001" ,
20892090 "grab_tail_page failed %d" ,
20902091 error );
20912092 page = NULL ;
@@ -2103,19 +2104,19 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
21032104 /* it is enough to reserve space in transaction for 2 balancings:
21042105 one for "save" link adding and another for the first
21052106 cut_from_item. 1 is for update_sd */
2106- error = journal_begin (& th , p_s_inode -> i_sb ,
2107+ error = journal_begin (& th , inode -> i_sb ,
21072108 JOURNAL_PER_BALANCE_CNT * 2 + 1 );
21082109 if (error )
21092110 goto out ;
2110- reiserfs_update_inode_transaction (p_s_inode );
2111+ reiserfs_update_inode_transaction (inode );
21112112 if (update_timestamps )
21122113 /* we are doing real truncate: if the system crashes before the last
21132114 transaction of truncating gets committed - on reboot the file
21142115 either appears truncated properly or not truncated at all */
2115- add_save_link (& th , p_s_inode , 1 );
2116- err2 = reiserfs_do_truncate (& th , p_s_inode , page , update_timestamps );
2116+ add_save_link (& th , inode , 1 );
2117+ err2 = reiserfs_do_truncate (& th , inode , page , update_timestamps );
21172118 error =
2118- journal_end (& th , p_s_inode -> i_sb , JOURNAL_PER_BALANCE_CNT * 2 + 1 );
2119+ journal_end (& th , inode -> i_sb , JOURNAL_PER_BALANCE_CNT * 2 + 1 );
21192120 if (error )
21202121 goto out ;
21212122
@@ -2126,7 +2127,7 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
21262127 }
21272128
21282129 if (update_timestamps ) {
2129- error = remove_save_link (p_s_inode , 1 /* truncate */ );
2130+ error = remove_save_link (inode , 1 /* truncate */ );
21302131 if (error )
21312132 goto out ;
21322133 }
@@ -2145,14 +2146,14 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
21452146 page_cache_release (page );
21462147 }
21472148
2148- reiserfs_write_unlock (p_s_inode -> i_sb );
2149+ reiserfs_write_unlock (inode -> i_sb );
21492150 return 0 ;
21502151 out :
21512152 if (page ) {
21522153 unlock_page (page );
21532154 page_cache_release (page );
21542155 }
2155- reiserfs_write_unlock (p_s_inode -> i_sb );
2156+ reiserfs_write_unlock (inode -> i_sb );
21562157 return error ;
21572158}
21582159
0 commit comments