[PATCH 09/10] reiserfs: cont_expand() to eliminate AOP_FLAG_CONT_EXPAND

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>

Reiserfs is the only user of AOP_FLAG_CONT_EXPAND. Remove the flag
and add a function cont_expand to deal with pos increment.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
---
 fs/reiserfs/inode.c | 38 +++++++++++++++++++++++++++-----------
 include/linux/fs.h  |  2 --
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index b13fc024d2ee..44895c4dc354 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2761,13 +2761,6 @@ static int reiserfs_write_begin(struct file *file,
 	int old_ref = 0;
 
  	inode = mapping->host;
-	*fsdata = NULL;
- 	if (flags & AOP_FLAG_CONT_EXPAND &&
- 	    (pos & (inode->i_sb->s_blocksize - 1)) == 0) {
- 		pos ++;
-		*fsdata = (void *)(unsigned long)flags;
-	}
-
 	index = pos >> PAGE_SHIFT;
 	page = grab_cache_page_write_begin(mapping, index, flags);
 	if (!page)
@@ -2894,9 +2887,6 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
 	unsigned start;
 	bool locked = false;
 
-	if ((unsigned long)fsdata & AOP_FLAG_CONT_EXPAND)
-		pos ++;
-
 	reiserfs_wait_on_write_block(inode->i_sb);
 	if (reiserfs_transaction_running(inode->i_sb))
 		th = current->journal_info;
@@ -3278,6 +3268,32 @@ static ssize_t reiserfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 	return ret;
 }
 
+int cont_expand(struct inode *inode, loff_t pos)
+{
+	void *fsdata;
+	struct page *page;
+	int err;
+
+	err = inode_newsize_ok(inode, pos);
+	if (err)
+		goto out;
+	if ((pos & (inode->i_sb->s_blocksize -1)) == 0)
+		pos++;
+
+	err = reiserfs_write_begin(NULL, inode->i_mapping, pos, 0, 0,
+			&page, &fsdata);
+	if (err)
+		goto out;
+
+	err = reiserfs_write_end(NULL, inode->i_mapping, pos, 0, 0, page, fsdata);
+	if (err)
+		goto out;
+
+out:
+	return err;
+
+}
+
 int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 {
 	struct inode *inode = d_inode(dentry);
@@ -3313,7 +3329,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 
 		/* fill in hole pointers in the expanding truncate case. */
 		if (attr->ia_size > inode->i_size) {
-			error = generic_cont_expand_simple(inode, attr->ia_size);
+			error = cont_expand(inode, attr->ia_size);
 			if (REISERFS_I(inode)->i_prealloc_count > 0) {
 				int err;
 				struct reiserfs_transaction_handle th;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 877bccb9874f..67f81b737935 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -259,8 +259,6 @@ enum positive_aop_returns {
 	AOP_TRUNCATED_PAGE	= 0x80001,
 };
 
-#define AOP_FLAG_CONT_EXPAND		0x0001 /* called from cont_expand */
-
 /*
  * oh the beauties of C type declarations.
  */
-- 
2.16.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux