Commit 995c762e authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Linus Torvalds

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: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ad31a4fc
......@@ -137,17 +137,17 @@ static void reiserfs_vfs_truncate_file(struct inode *inode)
static int reiserfs_sync_file(struct file *p_s_filp,
struct dentry *p_s_dentry, int datasync)
{
struct inode *p_s_inode = p_s_dentry->d_inode;
struct inode *inode = p_s_dentry->d_inode;
int n_err;
int barrier_done;
BUG_ON(!S_ISREG(p_s_inode->i_mode));
n_err = sync_mapping_buffers(p_s_inode->i_mapping);
reiserfs_write_lock(p_s_inode->i_sb);
barrier_done = reiserfs_commit_for_inode(p_s_inode);
reiserfs_write_unlock(p_s_inode->i_sb);
if (barrier_done != 1 && reiserfs_barrier_flush(p_s_inode->i_sb))
blkdev_issue_flush(p_s_inode->i_sb->s_bdev, NULL);
BUG_ON(!S_ISREG(inode->i_mode));
n_err = sync_mapping_buffers(inode->i_mapping);
reiserfs_write_lock(inode->i_sb);
barrier_done = reiserfs_commit_for_inode(inode);
reiserfs_write_unlock(inode->i_sb);
if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb))
blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
if (barrier_done < 0)
return barrier_done;
return (n_err < 0) ? -EIO : 0;
......
......@@ -1987,7 +1987,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
**
** on failure, nonzero is returned, page_result and bh_result are untouched.
*/
static int grab_tail_page(struct inode *p_s_inode,
static int grab_tail_page(struct inode *inode,
struct page **page_result,
struct buffer_head **bh_result)
{
......@@ -1995,11 +1995,11 @@ static int grab_tail_page(struct inode *p_s_inode,
/* we want the page with the last byte in the file,
** not the page that will hold the next byte for appending
*/
unsigned long index = (p_s_inode->i_size - 1) >> PAGE_CACHE_SHIFT;
unsigned long index = (inode->i_size - 1) >> PAGE_CACHE_SHIFT;
unsigned long pos = 0;
unsigned long start = 0;
unsigned long blocksize = p_s_inode->i_sb->s_blocksize;
unsigned long offset = (p_s_inode->i_size) & (PAGE_CACHE_SIZE - 1);
unsigned long blocksize = inode->i_sb->s_blocksize;
unsigned long offset = (inode->i_size) & (PAGE_CACHE_SIZE - 1);
struct buffer_head *bh;
struct buffer_head *head;
struct page *page;
......@@ -2013,7 +2013,7 @@ static int grab_tail_page(struct inode *p_s_inode,
if ((offset & (blocksize - 1)) == 0) {
return -ENOENT;
}
page = grab_cache_page(p_s_inode->i_mapping, index);
page = grab_cache_page(inode->i_mapping, index);
error = -ENOMEM;
if (!page) {
goto out;
......@@ -2042,7 +2042,7 @@ static int grab_tail_page(struct inode *p_s_inode,
** I've screwed up the code to find the buffer, or the code to
** call prepare_write
*/
reiserfs_error(p_s_inode->i_sb, "clm-6000",
reiserfs_error(inode->i_sb, "clm-6000",
"error reading block %lu", bh->b_blocknr);
error = -EIO;
goto unlock;
......@@ -2065,27 +2065,28 @@ static int grab_tail_page(struct inode *p_s_inode,
**
** some code taken from block_truncate_page
*/
int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
int reiserfs_truncate_file(struct inode *inode, int update_timestamps)
{
struct reiserfs_transaction_handle th;
/* we want the offset for the first byte after the end of the file */
unsigned long offset = p_s_inode->i_size & (PAGE_CACHE_SIZE - 1);
unsigned blocksize = p_s_inode->i_sb->s_blocksize;
unsigned long offset = inode->i_size & (PAGE_CACHE_SIZE - 1);
unsigned blocksize = inode->i_sb->s_blocksize;
unsigned length;
struct page *page = NULL;
int error;
struct buffer_head *bh = NULL;
int err2;
reiserfs_write_lock(p_s_inode->i_sb);
reiserfs_write_lock(inode->i_sb);
if (p_s_inode->i_size > 0) {
if ((error = grab_tail_page(p_s_inode, &page, &bh))) {
if (inode->i_size > 0) {
error = grab_tail_page(inode, &page, &bh);
if (error) {
// -ENOENT means we truncated past the end of the file,
// and get_block_create_0 could not find a block to read in,
// which is ok.
if (error != -ENOENT)
reiserfs_error(p_s_inode->i_sb, "clm-6001",
reiserfs_error(inode->i_sb, "clm-6001",
"grab_tail_page failed %d",
error);
page = NULL;
......@@ -2103,19 +2104,19 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
/* it is enough to reserve space in transaction for 2 balancings:
one for "save" link adding and another for the first
cut_from_item. 1 is for update_sd */
error = journal_begin(&th, p_s_inode->i_sb,
error = journal_begin(&th, inode->i_sb,
JOURNAL_PER_BALANCE_CNT * 2 + 1);
if (error)
goto out;
reiserfs_update_inode_transaction(p_s_inode);
reiserfs_update_inode_transaction(inode);
if (update_timestamps)
/* we are doing real truncate: if the system crashes before the last
transaction of truncating gets committed - on reboot the file
either appears truncated properly or not truncated at all */
add_save_link(&th, p_s_inode, 1);
err2 = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps);
add_save_link(&th, inode, 1);
err2 = reiserfs_do_truncate(&th, inode, page, update_timestamps);
error =
journal_end(&th, p_s_inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1);
journal_end(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1);
if (error)
goto out;
......@@ -2126,7 +2127,7 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
}
if (update_timestamps) {
error = remove_save_link(p_s_inode, 1 /* truncate */ );
error = remove_save_link(inode, 1 /* truncate */);
if (error)
goto out;
}
......@@ -2145,14 +2146,14 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
page_cache_release(page);
}
reiserfs_write_unlock(p_s_inode->i_sb);
reiserfs_write_unlock(inode->i_sb);
return 0;
out:
if (page) {
unlock_page(page);
page_cache_release(page);
}
reiserfs_write_unlock(p_s_inode->i_sb);
reiserfs_write_unlock(inode->i_sb);
return error;
}
......
This diff is collapsed.
......@@ -170,12 +170,14 @@ void reiserfs_unmap_buffer(struct buffer_head *bh)
what we expect from it (number of cut bytes). But when tail remains
in the unformatted node, we set mode to SKIP_BALANCING and unlock
inode */
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. */
int indirect2direct(struct reiserfs_transaction_handle *th,
struct inode *inode, struct page *page,
struct treepath *p_s_path, /* path to the indirect item. */
const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */
loff_t n_new_file_size, /* New file size. */
char *p_c_mode)
{
struct super_block *sb = p_s_inode->i_sb;
struct super_block *sb = inode->i_sb;
struct item_head s_ih;
unsigned long n_block_size = sb->s_blocksize;
char *tail;
......@@ -193,7 +195,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
tail_len = (n_new_file_size & (n_block_size - 1));
if (get_inode_sd_version(p_s_inode) == STAT_DATA_V2)
if (get_inode_sd_version(inode) == STAT_DATA_V2)
round_tail_len = ROUND_UP(tail_len);
else
round_tail_len = tail_len;
......@@ -228,7 +230,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
}
/* Set direct item header to insert. */
make_le_item_head(&s_ih, NULL, get_inode_item_key_version(p_s_inode),
make_le_item_head(&s_ih, NULL, get_inode_item_key_version(inode),
pos1 + 1, TYPE_DIRECT, round_tail_len,
0xffff /*ih_free_space */ );
......@@ -244,7 +246,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
set_cpu_key_k_type(&key, TYPE_DIRECT);
key.key_length = 4;
/* Insert tail as new direct item in the tree */
if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, p_s_inode,
if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, inode,
tail ? tail : NULL) < 0) {
/* No disk memory. So we can not convert last unformatted node
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
kunmap(page);
/* make sure to get the i_blocks changes from reiserfs_insert_item */
reiserfs_update_sd(th, p_s_inode);
reiserfs_update_sd(th, inode);
// note: we have now the same as in above direct2indirect
// 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
*p_c_mode = M_CUT;
/* we store position of first direct item in the in-core inode */
//mark_file_with_tail (p_s_inode, pos1 + 1);
REISERFS_I(p_s_inode)->i_first_direct_byte = pos1 + 1;
/* mark_file_with_tail (inode, pos1 + 1); */
REISERFS_I(inode)->i_first_direct_byte = pos1 + 1;
return n_block_size - round_tail_len;
}
......@@ -1870,9 +1870,9 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
struct inode *inode, struct reiserfs_key *key);
int reiserfs_delete_object(struct reiserfs_transaction_handle *th,
struct inode *p_s_inode);
struct inode *inode);
int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
struct inode *p_s_inode, struct page *,
struct inode *inode, struct page *,
int update_timestamps);
#define i_block_size(inode) ((inode)->i_sb->s_blocksize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment