diff options
author | Jeff Mahoney <jeffm@suse.com> | 2009-03-30 14:02:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 15:16:39 -0400 |
commit | 995c762ea486b48c9777522071fbf132dea96807 (patch) | |
tree | d6d82ca71ca67a98687762b83ce2858eb8dc624f | |
parent | ad31a4fc0386e8590c51ca4b8f1ae1d8b8b2ac5e (diff) |
reiserfs: rename p_s_inode to inode
This patch is a simple s/p_s_inode/inode/g to the reiserfs code. This
is the third in a series of patches to rip out some of the awful
variable naming in reiserfs.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/reiserfs/file.c | 16 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 43 | ||||
-rw-r--r-- | fs/reiserfs/stree.c | 103 | ||||
-rw-r--r-- | fs/reiserfs/tail_conversion.c | 18 | ||||
-rw-r--r-- | include/linux/reiserfs_fs.h | 4 |
5 files changed, 95 insertions, 89 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index f0160ee03e17..a73579f66214 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -137,17 +137,17 @@ static void reiserfs_vfs_truncate_file(struct inode *inode) | |||
137 | static int reiserfs_sync_file(struct file *p_s_filp, | 137 | static int reiserfs_sync_file(struct file *p_s_filp, |
138 | struct dentry *p_s_dentry, int datasync) | 138 | struct dentry *p_s_dentry, int datasync) |
139 | { | 139 | { |
140 | struct inode *p_s_inode = p_s_dentry->d_inode; | 140 | struct inode *inode = p_s_dentry->d_inode; |
141 | int n_err; | 141 | int n_err; |
142 | int barrier_done; | 142 | int barrier_done; |
143 | 143 | ||
144 | BUG_ON(!S_ISREG(p_s_inode->i_mode)); | 144 | BUG_ON(!S_ISREG(inode->i_mode)); |
145 | n_err = sync_mapping_buffers(p_s_inode->i_mapping); | 145 | n_err = sync_mapping_buffers(inode->i_mapping); |
146 | reiserfs_write_lock(p_s_inode->i_sb); | 146 | reiserfs_write_lock(inode->i_sb); |
147 | barrier_done = reiserfs_commit_for_inode(p_s_inode); | 147 | barrier_done = reiserfs_commit_for_inode(inode); |
148 | reiserfs_write_unlock(p_s_inode->i_sb); | 148 | reiserfs_write_unlock(inode->i_sb); |
149 | if (barrier_done != 1 && reiserfs_barrier_flush(p_s_inode->i_sb)) | 149 | if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb)) |
150 | blkdev_issue_flush(p_s_inode->i_sb->s_bdev, NULL); | 150 | blkdev_issue_flush(inode->i_sb->s_bdev, NULL); |
151 | if (barrier_done < 0) | 151 | if (barrier_done < 0) |
152 | return barrier_done; | 152 | return barrier_done; |
153 | return (n_err < 0) ? -EIO : 0; | 153 | return (n_err < 0) ? -EIO : 0; |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index d106edaef64f..b090d2dd2a8e 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -1987,7 +1987,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | |||
1987 | ** | 1987 | ** |
1988 | ** on failure, nonzero is returned, page_result and bh_result are untouched. | 1988 | ** on failure, nonzero is returned, page_result and bh_result are untouched. |
1989 | */ | 1989 | */ |
1990 | static int grab_tail_page(struct inode *p_s_inode, | 1990 | static int grab_tail_page(struct inode *inode, |
1991 | struct page **page_result, | 1991 | struct page **page_result, |
1992 | struct buffer_head **bh_result) | 1992 | struct buffer_head **bh_result) |
1993 | { | 1993 | { |
@@ -1995,11 +1995,11 @@ static int grab_tail_page(struct inode *p_s_inode, | |||
1995 | /* we want the page with the last byte in the file, | 1995 | /* we want the page with the last byte in the file, |
1996 | ** not the page that will hold the next byte for appending | 1996 | ** not the page that will hold the next byte for appending |
1997 | */ | 1997 | */ |
1998 | unsigned long index = (p_s_inode->i_size - 1) >> PAGE_CACHE_SHIFT; | 1998 | unsigned long index = (inode->i_size - 1) >> PAGE_CACHE_SHIFT; |
1999 | unsigned long pos = 0; | 1999 | unsigned long pos = 0; |
2000 | unsigned long start = 0; | 2000 | unsigned long start = 0; |
2001 | unsigned long blocksize = p_s_inode->i_sb->s_blocksize; | 2001 | unsigned long blocksize = inode->i_sb->s_blocksize; |
2002 | unsigned long offset = (p_s_inode->i_size) & (PAGE_CACHE_SIZE - 1); | 2002 | unsigned long offset = (inode->i_size) & (PAGE_CACHE_SIZE - 1); |
2003 | struct buffer_head *bh; | 2003 | struct buffer_head *bh; |
2004 | struct buffer_head *head; | 2004 | struct buffer_head *head; |
2005 | struct page *page; | 2005 | struct page *page; |
@@ -2013,7 +2013,7 @@ static int grab_tail_page(struct inode *p_s_inode, | |||
2013 | if ((offset & (blocksize - 1)) == 0) { | 2013 | if ((offset & (blocksize - 1)) == 0) { |
2014 | return -ENOENT; | 2014 | return -ENOENT; |
2015 | } | 2015 | } |
2016 | page = grab_cache_page(p_s_inode->i_mapping, index); | 2016 | page = grab_cache_page(inode->i_mapping, index); |
2017 | error = -ENOMEM; | 2017 | error = -ENOMEM; |
2018 | if (!page) { | 2018 | if (!page) { |
2019 | goto out; | 2019 | goto out; |
@@ -2042,7 +2042,7 @@ static int grab_tail_page(struct inode *p_s_inode, | |||
2042 | ** I've screwed up the code to find the buffer, or the code to | 2042 | ** I've screwed up the code to find the buffer, or the code to |
2043 | ** call prepare_write | 2043 | ** call prepare_write |
2044 | */ | 2044 | */ |
2045 | reiserfs_error(p_s_inode->i_sb, "clm-6000", | 2045 | reiserfs_error(inode->i_sb, "clm-6000", |
2046 | "error reading block %lu", bh->b_blocknr); | 2046 | "error reading block %lu", bh->b_blocknr); |
2047 | error = -EIO; | 2047 | error = -EIO; |
2048 | goto unlock; | 2048 | goto unlock; |
@@ -2065,27 +2065,28 @@ static int grab_tail_page(struct inode *p_s_inode, | |||
2065 | ** | 2065 | ** |
2066 | ** some code taken from block_truncate_page | 2066 | ** some code taken from block_truncate_page |
2067 | */ | 2067 | */ |
2068 | int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) | 2068 | int reiserfs_truncate_file(struct inode *inode, int update_timestamps) |
2069 | { | 2069 | { |
2070 | struct reiserfs_transaction_handle th; | 2070 | struct reiserfs_transaction_handle th; |
2071 | /* we want the offset for the first byte after the end of the file */ | 2071 | /* 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); | 2072 | unsigned long offset = inode->i_size & (PAGE_CACHE_SIZE - 1); |
2073 | unsigned blocksize = p_s_inode->i_sb->s_blocksize; | 2073 | unsigned blocksize = inode->i_sb->s_blocksize; |
2074 | unsigned length; | 2074 | unsigned length; |
2075 | struct page *page = NULL; | 2075 | struct page *page = NULL; |
2076 | int error; | 2076 | int error; |
2077 | struct buffer_head *bh = NULL; | 2077 | struct buffer_head *bh = NULL; |
2078 | int err2; | 2078 | int err2; |
2079 | 2079 | ||
2080 | reiserfs_write_lock(p_s_inode->i_sb); | 2080 | reiserfs_write_lock(inode->i_sb); |
2081 | 2081 | ||
2082 | if (p_s_inode->i_size > 0) { | 2082 | if (inode->i_size > 0) { |
2083 | if ((error = grab_tail_page(p_s_inode, &page, &bh))) { | 2083 | error = grab_tail_page(inode, &page, &bh); |
2084 | if (error) { | ||
2084 | // -ENOENT means we truncated past the end of the file, | 2085 | // -ENOENT means we truncated past the end of the file, |
2085 | // and get_block_create_0 could not find a block to read in, | 2086 | // and get_block_create_0 could not find a block to read in, |
2086 | // which is ok. | 2087 | // which is ok. |
2087 | if (error != -ENOENT) | 2088 | if (error != -ENOENT) |
2088 | reiserfs_error(p_s_inode->i_sb, "clm-6001", | 2089 | reiserfs_error(inode->i_sb, "clm-6001", |
2089 | "grab_tail_page failed %d", | 2090 | "grab_tail_page failed %d", |
2090 | error); | 2091 | error); |
2091 | page = NULL; | 2092 | page = NULL; |
@@ -2103,19 +2104,19 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) | |||
2103 | /* it is enough to reserve space in transaction for 2 balancings: | 2104 | /* it is enough to reserve space in transaction for 2 balancings: |
2104 | one for "save" link adding and another for the first | 2105 | one for "save" link adding and another for the first |
2105 | cut_from_item. 1 is for update_sd */ | 2106 | 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, |
2107 | JOURNAL_PER_BALANCE_CNT * 2 + 1); | 2108 | JOURNAL_PER_BALANCE_CNT * 2 + 1); |
2108 | if (error) | 2109 | if (error) |
2109 | goto out; | 2110 | goto out; |
2110 | reiserfs_update_inode_transaction(p_s_inode); | 2111 | reiserfs_update_inode_transaction(inode); |
2111 | if (update_timestamps) | 2112 | if (update_timestamps) |
2112 | /* we are doing real truncate: if the system crashes before the last | 2113 | /* we are doing real truncate: if the system crashes before the last |
2113 | transaction of truncating gets committed - on reboot the file | 2114 | transaction of truncating gets committed - on reboot the file |
2114 | either appears truncated properly or not truncated at all */ | 2115 | either appears truncated properly or not truncated at all */ |
2115 | add_save_link(&th, p_s_inode, 1); | 2116 | add_save_link(&th, inode, 1); |
2116 | err2 = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps); | 2117 | err2 = reiserfs_do_truncate(&th, inode, page, update_timestamps); |
2117 | error = | 2118 | 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); |
2119 | if (error) | 2120 | if (error) |
2120 | goto out; | 2121 | goto out; |
2121 | 2122 | ||
@@ -2126,7 +2127,7 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) | |||
2126 | } | 2127 | } |
2127 | 2128 | ||
2128 | if (update_timestamps) { | 2129 | if (update_timestamps) { |
2129 | error = remove_save_link(p_s_inode, 1 /* truncate */ ); | 2130 | error = remove_save_link(inode, 1 /* truncate */); |
2130 | if (error) | 2131 | if (error) |
2131 | goto out; | 2132 | goto out; |
2132 | } | 2133 | } |
@@ -2145,14 +2146,14 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) | |||
2145 | page_cache_release(page); | 2146 | page_cache_release(page); |
2146 | } | 2147 | } |
2147 | 2148 | ||
2148 | reiserfs_write_unlock(p_s_inode->i_sb); | 2149 | reiserfs_write_unlock(inode->i_sb); |
2149 | return 0; | 2150 | return 0; |
2150 | out: | 2151 | out: |
2151 | if (page) { | 2152 | if (page) { |
2152 | unlock_page(page); | 2153 | unlock_page(page); |
2153 | page_cache_release(page); | 2154 | page_cache_release(page); |
2154 | } | 2155 | } |
2155 | reiserfs_write_unlock(p_s_inode->i_sb); | 2156 | reiserfs_write_unlock(inode->i_sb); |
2156 | return error; | 2157 | return error; |
2157 | } | 2158 | } |
2158 | 2159 | ||
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index eb6856f6d323..8f220fb777d7 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -1143,10 +1143,11 @@ char head2type(struct item_head *ih) | |||
1143 | /* Delete object item. */ | 1143 | /* Delete object item. */ |
1144 | int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath *p_s_path, /* Path to the deleted item. */ | 1144 | int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath *p_s_path, /* Path to the deleted item. */ |
1145 | const struct cpu_key *p_s_item_key, /* Key to search for the deleted item. */ | 1145 | const struct cpu_key *p_s_item_key, /* Key to search for the deleted item. */ |
1146 | struct inode *p_s_inode, /* inode is here just to update i_blocks and quotas */ | 1146 | struct inode *inode, /* inode is here just to update |
1147 | * i_blocks and quotas */ | ||
1147 | struct buffer_head *p_s_un_bh) | 1148 | struct buffer_head *p_s_un_bh) |
1148 | { /* NULL or unformatted node pointer. */ | 1149 | { /* NULL or unformatted node pointer. */ |
1149 | struct super_block *sb = p_s_inode->i_sb; | 1150 | struct super_block *sb = inode->i_sb; |
1150 | struct tree_balance s_del_balance; | 1151 | struct tree_balance s_del_balance; |
1151 | struct item_head s_ih; | 1152 | struct item_head s_ih; |
1152 | struct item_head *q_ih; | 1153 | struct item_head *q_ih; |
@@ -1170,10 +1171,10 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath | |||
1170 | n_iter++; | 1171 | n_iter++; |
1171 | c_mode = | 1172 | c_mode = |
1172 | #endif | 1173 | #endif |
1173 | prepare_for_delete_or_cut(th, p_s_inode, p_s_path, | 1174 | prepare_for_delete_or_cut(th, inode, p_s_path, |
1174 | p_s_item_key, &n_removed, | 1175 | p_s_item_key, &n_removed, |
1175 | &n_del_size, | 1176 | &n_del_size, |
1176 | max_reiserfs_offset(p_s_inode)); | 1177 | max_reiserfs_offset(inode)); |
1177 | 1178 | ||
1178 | RFALSE(c_mode != M_DELETE, "PAP-5320: mode must be M_DELETE"); | 1179 | RFALSE(c_mode != M_DELETE, "PAP-5320: mode must be M_DELETE"); |
1179 | 1180 | ||
@@ -1214,7 +1215,7 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath | |||
1214 | ** split into multiple items, and we only want to decrement for | 1215 | ** split into multiple items, and we only want to decrement for |
1215 | ** the unfm node once | 1216 | ** the unfm node once |
1216 | */ | 1217 | */ |
1217 | if (!S_ISLNK(p_s_inode->i_mode) && is_direct_le_ih(q_ih)) { | 1218 | if (!S_ISLNK(inode->i_mode) && is_direct_le_ih(q_ih)) { |
1218 | if ((le_ih_k_offset(q_ih) & (sb->s_blocksize - 1)) == 1) { | 1219 | if ((le_ih_k_offset(q_ih) & (sb->s_blocksize - 1)) == 1) { |
1219 | quota_cut_bytes = sb->s_blocksize + UNFM_P_SIZE; | 1220 | quota_cut_bytes = sb->s_blocksize + UNFM_P_SIZE; |
1220 | } else { | 1221 | } else { |
@@ -1259,9 +1260,9 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath | |||
1259 | #ifdef REISERQUOTA_DEBUG | 1260 | #ifdef REISERQUOTA_DEBUG |
1260 | reiserfs_debug(sb, REISERFS_DEBUG_CODE, | 1261 | reiserfs_debug(sb, REISERFS_DEBUG_CODE, |
1261 | "reiserquota delete_item(): freeing %u, id=%u type=%c", | 1262 | "reiserquota delete_item(): freeing %u, id=%u type=%c", |
1262 | quota_cut_bytes, p_s_inode->i_uid, head2type(&s_ih)); | 1263 | quota_cut_bytes, inode->i_uid, head2type(&s_ih)); |
1263 | #endif | 1264 | #endif |
1264 | DQUOT_FREE_SPACE_NODIRTY(p_s_inode, quota_cut_bytes); | 1265 | DQUOT_FREE_SPACE_NODIRTY(inode, quota_cut_bytes); |
1265 | 1266 | ||
1266 | /* Return deleted body length */ | 1267 | /* Return deleted body length */ |
1267 | return n_ret_value; | 1268 | return n_ret_value; |
@@ -1423,25 +1424,25 @@ static void unmap_buffers(struct page *page, loff_t pos) | |||
1423 | } | 1424 | } |
1424 | 1425 | ||
1425 | static int maybe_indirect_to_direct(struct reiserfs_transaction_handle *th, | 1426 | static int maybe_indirect_to_direct(struct reiserfs_transaction_handle *th, |
1426 | struct inode *p_s_inode, | 1427 | struct inode *inode, |
1427 | struct page *page, | 1428 | struct page *page, |
1428 | struct treepath *p_s_path, | 1429 | struct treepath *p_s_path, |
1429 | const struct cpu_key *p_s_item_key, | 1430 | const struct cpu_key *p_s_item_key, |
1430 | loff_t n_new_file_size, char *p_c_mode) | 1431 | loff_t n_new_file_size, char *p_c_mode) |
1431 | { | 1432 | { |
1432 | struct super_block *sb = p_s_inode->i_sb; | 1433 | struct super_block *sb = inode->i_sb; |
1433 | int n_block_size = sb->s_blocksize; | 1434 | int n_block_size = sb->s_blocksize; |
1434 | int cut_bytes; | 1435 | int cut_bytes; |
1435 | BUG_ON(!th->t_trans_id); | 1436 | BUG_ON(!th->t_trans_id); |
1436 | BUG_ON(n_new_file_size != p_s_inode->i_size); | 1437 | BUG_ON(n_new_file_size != inode->i_size); |
1437 | 1438 | ||
1438 | /* the page being sent in could be NULL if there was an i/o error | 1439 | /* the page being sent in could be NULL if there was an i/o error |
1439 | ** reading in the last block. The user will hit problems trying to | 1440 | ** reading in the last block. The user will hit problems trying to |
1440 | ** read the file, but for now we just skip the indirect2direct | 1441 | ** read the file, but for now we just skip the indirect2direct |
1441 | */ | 1442 | */ |
1442 | if (atomic_read(&p_s_inode->i_count) > 1 || | 1443 | if (atomic_read(&inode->i_count) > 1 || |
1443 | !tail_has_to_be_packed(p_s_inode) || | 1444 | !tail_has_to_be_packed(inode) || |
1444 | !page || (REISERFS_I(p_s_inode)->i_flags & i_nopack_mask)) { | 1445 | !page || (REISERFS_I(inode)->i_flags & i_nopack_mask)) { |
1445 | /* leave tail in an unformatted node */ | 1446 | /* leave tail in an unformatted node */ |
1446 | *p_c_mode = M_SKIP_BALANCING; | 1447 | *p_c_mode = M_SKIP_BALANCING; |
1447 | cut_bytes = | 1448 | cut_bytes = |
@@ -1450,8 +1451,9 @@ static int maybe_indirect_to_direct(struct reiserfs_transaction_handle *th, | |||
1450 | return cut_bytes; | 1451 | return cut_bytes; |
1451 | } | 1452 | } |
1452 | /* Permorm the conversion to a direct_item. */ | 1453 | /* Permorm the conversion to a direct_item. */ |
1453 | /*return indirect_to_direct (p_s_inode, p_s_path, p_s_item_key, n_new_file_size, p_c_mode); */ | 1454 | /* return indirect_to_direct(inode, p_s_path, p_s_item_key, |
1454 | return indirect2direct(th, p_s_inode, page, p_s_path, p_s_item_key, | 1455 | n_new_file_size, p_c_mode); */ |
1456 | return indirect2direct(th, inode, page, p_s_path, p_s_item_key, | ||
1455 | n_new_file_size, p_c_mode); | 1457 | n_new_file_size, p_c_mode); |
1456 | } | 1458 | } |
1457 | 1459 | ||
@@ -1505,10 +1507,10 @@ static void indirect_to_direct_roll_back(struct reiserfs_transaction_handle *th, | |||
1505 | int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | 1507 | int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, |
1506 | struct treepath *p_s_path, | 1508 | struct treepath *p_s_path, |
1507 | struct cpu_key *p_s_item_key, | 1509 | struct cpu_key *p_s_item_key, |
1508 | struct inode *p_s_inode, | 1510 | struct inode *inode, |
1509 | struct page *page, loff_t n_new_file_size) | 1511 | struct page *page, loff_t n_new_file_size) |
1510 | { | 1512 | { |
1511 | struct super_block *sb = p_s_inode->i_sb; | 1513 | struct super_block *sb = inode->i_sb; |
1512 | /* Every function which is going to call do_balance must first | 1514 | /* Every function which is going to call do_balance must first |
1513 | create a tree_balance structure. Then it must fill up this | 1515 | create a tree_balance structure. Then it must fill up this |
1514 | structure by using the init_tb_struct and fix_nodes functions. | 1516 | structure by using the init_tb_struct and fix_nodes functions. |
@@ -1525,7 +1527,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1525 | 1527 | ||
1526 | BUG_ON(!th->t_trans_id); | 1528 | BUG_ON(!th->t_trans_id); |
1527 | 1529 | ||
1528 | init_tb_struct(th, &s_cut_balance, p_s_inode->i_sb, p_s_path, | 1530 | init_tb_struct(th, &s_cut_balance, inode->i_sb, p_s_path, |
1529 | n_cut_size); | 1531 | n_cut_size); |
1530 | 1532 | ||
1531 | /* Repeat this loop until we either cut the item without needing | 1533 | /* Repeat this loop until we either cut the item without needing |
@@ -1537,7 +1539,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1537 | pointers. */ | 1539 | pointers. */ |
1538 | 1540 | ||
1539 | c_mode = | 1541 | c_mode = |
1540 | prepare_for_delete_or_cut(th, p_s_inode, p_s_path, | 1542 | prepare_for_delete_or_cut(th, inode, p_s_path, |
1541 | p_s_item_key, &n_removed, | 1543 | p_s_item_key, &n_removed, |
1542 | &n_cut_size, n_new_file_size); | 1544 | &n_cut_size, n_new_file_size); |
1543 | if (c_mode == M_CONVERT) { | 1545 | if (c_mode == M_CONVERT) { |
@@ -1547,7 +1549,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1547 | "PAP-5570: can not convert twice"); | 1549 | "PAP-5570: can not convert twice"); |
1548 | 1550 | ||
1549 | n_ret_value = | 1551 | n_ret_value = |
1550 | maybe_indirect_to_direct(th, p_s_inode, page, | 1552 | maybe_indirect_to_direct(th, inode, page, |
1551 | p_s_path, p_s_item_key, | 1553 | p_s_path, p_s_item_key, |
1552 | n_new_file_size, &c_mode); | 1554 | n_new_file_size, &c_mode); |
1553 | if (c_mode == M_SKIP_BALANCING) | 1555 | if (c_mode == M_SKIP_BALANCING) |
@@ -1612,7 +1614,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1612 | if (n_is_inode_locked) { | 1614 | if (n_is_inode_locked) { |
1613 | // FIXME: this seems to be not needed: we are always able | 1615 | // FIXME: this seems to be not needed: we are always able |
1614 | // to cut item | 1616 | // to cut item |
1615 | indirect_to_direct_roll_back(th, p_s_inode, p_s_path); | 1617 | indirect_to_direct_roll_back(th, inode, p_s_path); |
1616 | } | 1618 | } |
1617 | if (n_ret_value == NO_DISK_SPACE) | 1619 | if (n_ret_value == NO_DISK_SPACE) |
1618 | reiserfs_warning(sb, "reiserfs-5092", | 1620 | reiserfs_warning(sb, "reiserfs-5092", |
@@ -1639,12 +1641,12 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1639 | ** item. | 1641 | ** item. |
1640 | */ | 1642 | */ |
1641 | p_le_ih = PATH_PITEM_HEAD(s_cut_balance.tb_path); | 1643 | p_le_ih = PATH_PITEM_HEAD(s_cut_balance.tb_path); |
1642 | if (!S_ISLNK(p_s_inode->i_mode) && is_direct_le_ih(p_le_ih)) { | 1644 | if (!S_ISLNK(inode->i_mode) && is_direct_le_ih(p_le_ih)) { |
1643 | if (c_mode == M_DELETE && | 1645 | if (c_mode == M_DELETE && |
1644 | (le_ih_k_offset(p_le_ih) & (sb->s_blocksize - 1)) == | 1646 | (le_ih_k_offset(p_le_ih) & (sb->s_blocksize - 1)) == |
1645 | 1) { | 1647 | 1) { |
1646 | // FIXME: this is to keep 3.5 happy | 1648 | // FIXME: this is to keep 3.5 happy |
1647 | REISERFS_I(p_s_inode)->i_first_direct_byte = U32_MAX; | 1649 | REISERFS_I(inode)->i_first_direct_byte = U32_MAX; |
1648 | quota_cut_bytes = sb->s_blocksize + UNFM_P_SIZE; | 1650 | quota_cut_bytes = sb->s_blocksize + UNFM_P_SIZE; |
1649 | } else { | 1651 | } else { |
1650 | quota_cut_bytes = 0; | 1652 | quota_cut_bytes = 0; |
@@ -1687,14 +1689,14 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1687 | ** unmap and invalidate it | 1689 | ** unmap and invalidate it |
1688 | */ | 1690 | */ |
1689 | unmap_buffers(page, tail_pos); | 1691 | unmap_buffers(page, tail_pos); |
1690 | REISERFS_I(p_s_inode)->i_flags &= ~i_pack_on_close_mask; | 1692 | REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask; |
1691 | } | 1693 | } |
1692 | #ifdef REISERQUOTA_DEBUG | 1694 | #ifdef REISERQUOTA_DEBUG |
1693 | reiserfs_debug(p_s_inode->i_sb, REISERFS_DEBUG_CODE, | 1695 | reiserfs_debug(inode->i_sb, REISERFS_DEBUG_CODE, |
1694 | "reiserquota cut_from_item(): freeing %u id=%u type=%c", | 1696 | "reiserquota cut_from_item(): freeing %u id=%u type=%c", |
1695 | quota_cut_bytes, p_s_inode->i_uid, '?'); | 1697 | quota_cut_bytes, inode->i_uid, '?'); |
1696 | #endif | 1698 | #endif |
1697 | DQUOT_FREE_SPACE_NODIRTY(p_s_inode, quota_cut_bytes); | 1699 | DQUOT_FREE_SPACE_NODIRTY(inode, quota_cut_bytes); |
1698 | return n_ret_value; | 1700 | return n_ret_value; |
1699 | } | 1701 | } |
1700 | 1702 | ||
@@ -1715,8 +1717,8 @@ static void truncate_directory(struct reiserfs_transaction_handle *th, | |||
1715 | 1717 | ||
1716 | /* Truncate file to the new size. Note, this must be called with a transaction | 1718 | /* Truncate file to the new size. Note, this must be called with a transaction |
1717 | already started */ | 1719 | already started */ |
1718 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, /* ->i_size contains new | 1720 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, |
1719 | size */ | 1721 | struct inode *inode, /* ->i_size contains new size */ |
1720 | struct page *page, /* up to date for last block */ | 1722 | struct page *page, /* up to date for last block */ |
1721 | int update_timestamps /* when it is called by | 1723 | int update_timestamps /* when it is called by |
1722 | file_release to convert | 1724 | file_release to convert |
@@ -1735,35 +1737,35 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p | |||
1735 | 1737 | ||
1736 | BUG_ON(!th->t_trans_id); | 1738 | BUG_ON(!th->t_trans_id); |
1737 | if (! | 1739 | if (! |
1738 | (S_ISREG(p_s_inode->i_mode) || S_ISDIR(p_s_inode->i_mode) | 1740 | (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) |
1739 | || S_ISLNK(p_s_inode->i_mode))) | 1741 | || S_ISLNK(inode->i_mode))) |
1740 | return 0; | 1742 | return 0; |
1741 | 1743 | ||
1742 | if (S_ISDIR(p_s_inode->i_mode)) { | 1744 | if (S_ISDIR(inode->i_mode)) { |
1743 | // deletion of directory - no need to update timestamps | 1745 | // deletion of directory - no need to update timestamps |
1744 | truncate_directory(th, p_s_inode); | 1746 | truncate_directory(th, inode); |
1745 | return 0; | 1747 | return 0; |
1746 | } | 1748 | } |
1747 | 1749 | ||
1748 | /* Get new file size. */ | 1750 | /* Get new file size. */ |
1749 | n_new_file_size = p_s_inode->i_size; | 1751 | n_new_file_size = inode->i_size; |
1750 | 1752 | ||
1751 | // FIXME: note, that key type is unimportant here | 1753 | // FIXME: note, that key type is unimportant here |
1752 | make_cpu_key(&s_item_key, p_s_inode, max_reiserfs_offset(p_s_inode), | 1754 | make_cpu_key(&s_item_key, inode, max_reiserfs_offset(inode), |
1753 | TYPE_DIRECT, 3); | 1755 | TYPE_DIRECT, 3); |
1754 | 1756 | ||
1755 | retval = | 1757 | retval = |
1756 | search_for_position_by_key(p_s_inode->i_sb, &s_item_key, | 1758 | search_for_position_by_key(inode->i_sb, &s_item_key, |
1757 | &s_search_path); | 1759 | &s_search_path); |
1758 | if (retval == IO_ERROR) { | 1760 | if (retval == IO_ERROR) { |
1759 | reiserfs_error(p_s_inode->i_sb, "vs-5657", | 1761 | reiserfs_error(inode->i_sb, "vs-5657", |
1760 | "i/o failure occurred trying to truncate %K", | 1762 | "i/o failure occurred trying to truncate %K", |
1761 | &s_item_key); | 1763 | &s_item_key); |
1762 | err = -EIO; | 1764 | err = -EIO; |
1763 | goto out; | 1765 | goto out; |
1764 | } | 1766 | } |
1765 | if (retval == POSITION_FOUND || retval == FILE_NOT_FOUND) { | 1767 | if (retval == POSITION_FOUND || retval == FILE_NOT_FOUND) { |
1766 | reiserfs_error(p_s_inode->i_sb, "PAP-5660", | 1768 | reiserfs_error(inode->i_sb, "PAP-5660", |
1767 | "wrong result %d of search for %K", retval, | 1769 | "wrong result %d of search for %K", retval, |
1768 | &s_item_key); | 1770 | &s_item_key); |
1769 | 1771 | ||
@@ -1780,7 +1782,7 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p | |||
1780 | else { | 1782 | else { |
1781 | loff_t offset = le_ih_k_offset(p_le_ih); | 1783 | loff_t offset = le_ih_k_offset(p_le_ih); |
1782 | int bytes = | 1784 | int bytes = |
1783 | op_bytes_number(p_le_ih, p_s_inode->i_sb->s_blocksize); | 1785 | op_bytes_number(p_le_ih, inode->i_sb->s_blocksize); |
1784 | 1786 | ||
1785 | /* this may mismatch with real file size: if last direct item | 1787 | /* this may mismatch with real file size: if last direct item |
1786 | had no padding zeros and last unformatted node had no free | 1788 | had no padding zeros and last unformatted node had no free |
@@ -1805,9 +1807,9 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p | |||
1805 | /* Cut or delete file item. */ | 1807 | /* Cut or delete file item. */ |
1806 | n_deleted = | 1808 | n_deleted = |
1807 | reiserfs_cut_from_item(th, &s_search_path, &s_item_key, | 1809 | reiserfs_cut_from_item(th, &s_search_path, &s_item_key, |
1808 | p_s_inode, page, n_new_file_size); | 1810 | inode, page, n_new_file_size); |
1809 | if (n_deleted < 0) { | 1811 | if (n_deleted < 0) { |
1810 | reiserfs_warning(p_s_inode->i_sb, "vs-5665", | 1812 | reiserfs_warning(inode->i_sb, "vs-5665", |
1811 | "reiserfs_cut_from_item failed"); | 1813 | "reiserfs_cut_from_item failed"); |
1812 | reiserfs_check_path(&s_search_path); | 1814 | reiserfs_check_path(&s_search_path); |
1813 | return 0; | 1815 | return 0; |
@@ -1837,22 +1839,22 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p | |||
1837 | pathrelse(&s_search_path); | 1839 | pathrelse(&s_search_path); |
1838 | 1840 | ||
1839 | if (update_timestamps) { | 1841 | if (update_timestamps) { |
1840 | p_s_inode->i_mtime = p_s_inode->i_ctime = | 1842 | inode->i_mtime = CURRENT_TIME_SEC; |
1841 | CURRENT_TIME_SEC; | 1843 | inode->i_ctime = CURRENT_TIME_SEC; |
1842 | } | 1844 | } |
1843 | reiserfs_update_sd(th, p_s_inode); | 1845 | reiserfs_update_sd(th, inode); |
1844 | 1846 | ||
1845 | err = journal_end(th, p_s_inode->i_sb, orig_len_alloc); | 1847 | err = journal_end(th, inode->i_sb, orig_len_alloc); |
1846 | if (err) | 1848 | if (err) |
1847 | goto out; | 1849 | goto out; |
1848 | err = journal_begin(th, p_s_inode->i_sb, | 1850 | err = journal_begin(th, inode->i_sb, |
1849 | JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD + JOURNAL_PER_BALANCE_CNT * 4) ; | 1851 | JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD + JOURNAL_PER_BALANCE_CNT * 4) ; |
1850 | if (err) | 1852 | if (err) |
1851 | goto out; | 1853 | goto out; |
1852 | reiserfs_update_inode_transaction(p_s_inode); | 1854 | reiserfs_update_inode_transaction(inode); |
1853 | } | 1855 | } |
1854 | } while (n_file_size > ROUND_UP(n_new_file_size) && | 1856 | } while (n_file_size > ROUND_UP(n_new_file_size) && |
1855 | search_for_position_by_key(p_s_inode->i_sb, &s_item_key, | 1857 | search_for_position_by_key(inode->i_sb, &s_item_key, |
1856 | &s_search_path) == POSITION_FOUND); | 1858 | &s_search_path) == POSITION_FOUND); |
1857 | 1859 | ||
1858 | RFALSE(n_file_size > ROUND_UP(n_new_file_size), | 1860 | RFALSE(n_file_size > ROUND_UP(n_new_file_size), |
@@ -1862,9 +1864,10 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p | |||
1862 | update_and_out: | 1864 | update_and_out: |
1863 | if (update_timestamps) { | 1865 | if (update_timestamps) { |
1864 | // this is truncate, not file closing | 1866 | // this is truncate, not file closing |
1865 | p_s_inode->i_mtime = p_s_inode->i_ctime = CURRENT_TIME_SEC; | 1867 | inode->i_mtime = CURRENT_TIME_SEC; |
1868 | inode->i_ctime = CURRENT_TIME_SEC; | ||
1866 | } | 1869 | } |
1867 | reiserfs_update_sd(th, p_s_inode); | 1870 | reiserfs_update_sd(th, inode); |
1868 | 1871 | ||
1869 | out: | 1872 | out: |
1870 | pathrelse(&s_search_path); | 1873 | pathrelse(&s_search_path); |
diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c index 27311a5f0469..5c5ee0d0d6a8 100644 --- a/fs/reiserfs/tail_conversion.c +++ b/fs/reiserfs/tail_conversion.c | |||
@@ -170,12 +170,14 @@ void reiserfs_unmap_buffer(struct buffer_head *bh) | |||
170 | what we expect from it (number of cut bytes). But when tail remains | 170 | what we expect from it (number of cut bytes). But when tail remains |
171 | in the unformatted node, we set mode to SKIP_BALANCING and unlock | 171 | in the unformatted node, we set mode to SKIP_BALANCING and unlock |
172 | inode */ | 172 | inode */ |
173 | int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, struct page *page, struct treepath *p_s_path, /* path to the indirect item. */ | 173 | int indirect2direct(struct reiserfs_transaction_handle *th, |
174 | struct inode *inode, struct page *page, | ||
175 | struct treepath *p_s_path, /* path to the indirect item. */ | ||
174 | const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */ | 176 | const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */ |
175 | loff_t n_new_file_size, /* New file size. */ | 177 | loff_t n_new_file_size, /* New file size. */ |
176 | char *p_c_mode) | 178 | char *p_c_mode) |
177 | { | 179 | { |
178 | struct super_block *sb = p_s_inode->i_sb; | 180 | struct super_block *sb = inode->i_sb; |
179 | struct item_head s_ih; | 181 | struct item_head s_ih; |
180 | unsigned long n_block_size = sb->s_blocksize; | 182 | unsigned long n_block_size = sb->s_blocksize; |
181 | char *tail; | 183 | char *tail; |
@@ -193,7 +195,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in | |||
193 | copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); | 195 | copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); |
194 | 196 | ||
195 | tail_len = (n_new_file_size & (n_block_size - 1)); | 197 | tail_len = (n_new_file_size & (n_block_size - 1)); |
196 | if (get_inode_sd_version(p_s_inode) == STAT_DATA_V2) | 198 | if (get_inode_sd_version(inode) == STAT_DATA_V2) |
197 | round_tail_len = ROUND_UP(tail_len); | 199 | round_tail_len = ROUND_UP(tail_len); |
198 | else | 200 | else |
199 | round_tail_len = tail_len; | 201 | round_tail_len = tail_len; |
@@ -228,7 +230,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in | |||
228 | } | 230 | } |
229 | 231 | ||
230 | /* Set direct item header to insert. */ | 232 | /* Set direct item header to insert. */ |
231 | make_le_item_head(&s_ih, NULL, get_inode_item_key_version(p_s_inode), | 233 | make_le_item_head(&s_ih, NULL, get_inode_item_key_version(inode), |
232 | pos1 + 1, TYPE_DIRECT, round_tail_len, | 234 | pos1 + 1, TYPE_DIRECT, round_tail_len, |
233 | 0xffff /*ih_free_space */ ); | 235 | 0xffff /*ih_free_space */ ); |
234 | 236 | ||
@@ -244,7 +246,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in | |||
244 | set_cpu_key_k_type(&key, TYPE_DIRECT); | 246 | set_cpu_key_k_type(&key, TYPE_DIRECT); |
245 | key.key_length = 4; | 247 | key.key_length = 4; |
246 | /* Insert tail as new direct item in the tree */ | 248 | /* Insert tail as new direct item in the tree */ |
247 | if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, p_s_inode, | 249 | if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, inode, |
248 | tail ? tail : NULL) < 0) { | 250 | tail ? tail : NULL) < 0) { |
249 | /* No disk memory. So we can not convert last unformatted node | 251 | /* No disk memory. So we can not convert last unformatted node |
250 | to the direct item. In this case we used to adjust | 252 | to the direct item. In this case we used to adjust |
@@ -258,7 +260,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in | |||
258 | kunmap(page); | 260 | kunmap(page); |
259 | 261 | ||
260 | /* make sure to get the i_blocks changes from reiserfs_insert_item */ | 262 | /* make sure to get the i_blocks changes from reiserfs_insert_item */ |
261 | reiserfs_update_sd(th, p_s_inode); | 263 | reiserfs_update_sd(th, inode); |
262 | 264 | ||
263 | // note: we have now the same as in above direct2indirect | 265 | // note: we have now the same as in above direct2indirect |
264 | // conversion: there are two keys which have matching first three | 266 | // conversion: there are two keys which have matching first three |
@@ -269,8 +271,8 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in | |||
269 | *p_c_mode = M_CUT; | 271 | *p_c_mode = M_CUT; |
270 | 272 | ||
271 | /* we store position of first direct item in the in-core inode */ | 273 | /* we store position of first direct item in the in-core inode */ |
272 | //mark_file_with_tail (p_s_inode, pos1 + 1); | 274 | /* mark_file_with_tail (inode, pos1 + 1); */ |
273 | REISERFS_I(p_s_inode)->i_first_direct_byte = pos1 + 1; | 275 | REISERFS_I(inode)->i_first_direct_byte = pos1 + 1; |
274 | 276 | ||
275 | return n_block_size - round_tail_len; | 277 | return n_block_size - round_tail_len; |
276 | } | 278 | } |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 9cfa518c90b6..3192dc793226 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -1870,9 +1870,9 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, | |||
1870 | void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, | 1870 | void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, |
1871 | struct inode *inode, struct reiserfs_key *key); | 1871 | struct inode *inode, struct reiserfs_key *key); |
1872 | int reiserfs_delete_object(struct reiserfs_transaction_handle *th, | 1872 | int reiserfs_delete_object(struct reiserfs_transaction_handle *th, |
1873 | struct inode *p_s_inode); | 1873 | struct inode *inode); |
1874 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, | 1874 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, |
1875 | struct inode *p_s_inode, struct page *, | 1875 | struct inode *inode, struct page *, |
1876 | int update_timestamps); | 1876 | int update_timestamps); |
1877 | 1877 | ||
1878 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) | 1878 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) |