aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/stree.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2009-03-30 14:02:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 15:16:39 -0400
commit995c762ea486b48c9777522071fbf132dea96807 (patch)
treed6d82ca71ca67a98687762b83ce2858eb8dc624f /fs/reiserfs/stree.c
parentad31a4fc0386e8590c51ca4b8f1ae1d8b8b2ac5e (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>
Diffstat (limited to 'fs/reiserfs/stree.c')
-rw-r--r--fs/reiserfs/stree.c103
1 files changed, 53 insertions, 50 deletions
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. */
1144int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath *p_s_path, /* Path to the deleted item. */ 1144int 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
1425static int maybe_indirect_to_direct(struct reiserfs_transaction_handle *th, 1426static 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,
1505int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, 1507int 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 */
1718int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, /* ->i_size contains new 1720int 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);