diff mbox series

reiserfs: get rid of AOP_FLAG_CONT_EXPAND flag

Message ID 20220220232219.1235-1-edward.shishkin@gmail.com (mailing list archive)
State New, archived
Headers show
Series reiserfs: get rid of AOP_FLAG_CONT_EXPAND flag | expand

Commit Message

Edward Shishkin Feb. 20, 2022, 11:22 p.m. UTC
Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
---
 fs/reiserfs/inode.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

Comments

Jan Kara Feb. 22, 2022, 10:27 a.m. UTC | #1
On Mon 21-02-22 00:22:19, Edward Shishkin wrote:
> Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
> ---
>  fs/reiserfs/inode.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)

Thanks! I have queued this patch into my tree.

								Honza

> 
> diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
> index f49b72ccac4c..e943930939f5 100644
> --- a/fs/reiserfs/inode.c
> +++ b/fs/reiserfs/inode.c
> @@ -2763,13 +2763,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)
> @@ -2896,9 +2889,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;
> @@ -3316,7 +3306,11 @@ int reiserfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
>  
>  		/* 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);
> +			loff_t pos = attr->ia_size;
> +
> +			if ((pos & (inode->i_sb->s_blocksize - 1)) == 0)
> +				pos++;
> +			error = generic_cont_expand_simple(inode, pos);
>  			if (REISERFS_I(inode)->i_prealloc_count > 0) {
>  				int err;
>  				struct reiserfs_transaction_handle th;
> -- 
> 2.21.3
>
Matthew Wilcox Feb. 22, 2022, 1:38 p.m. UTC | #2
On Tue, Feb 22, 2022 at 11:27:27AM +0100, Jan Kara wrote:
> On Mon 21-02-22 00:22:19, Edward Shishkin wrote:
> > Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
> > ---
> >  fs/reiserfs/inode.c | 16 +++++-----------
> >  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> Thanks! I have queued this patch into my tree.

I added the following commit message to it for my tree:

Author: Edward Shishkin <edward.shishkin@gmail.com>
Date:   Mon Feb 21 00:22:19 2022 +0100

    reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag

    We can simplify write_begin() and write_end() by handling the
    cont_expand case in reiserfs_setattr().

    Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

I don't object if it goes via your tree; I doubt I'll get the AOP_FLAG
removal finished in time for the next merge window.
Jan Kara Feb. 23, 2022, 12:17 p.m. UTC | #3
On Tue 22-02-22 13:38:19, Matthew Wilcox wrote:
> On Tue, Feb 22, 2022 at 11:27:27AM +0100, Jan Kara wrote:
> > On Mon 21-02-22 00:22:19, Edward Shishkin wrote:
> > > Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
> > > ---
> > >  fs/reiserfs/inode.c | 16 +++++-----------
> > >  1 file changed, 5 insertions(+), 11 deletions(-)
> > 
> > Thanks! I have queued this patch into my tree.
> 
> I added the following commit message to it for my tree:
> 
> Author: Edward Shishkin <edward.shishkin@gmail.com>
> Date:   Mon Feb 21 00:22:19 2022 +0100
> 
>     reiserfs: Stop using AOP_FLAG_CONT_EXPAND flag
> 
>     We can simplify write_begin() and write_end() by handling the
>     cont_expand case in reiserfs_setattr().
> 
>     Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
>     Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Yeah, I have written some changelog as well :) Something like:

    reiserfs: get rid of AOP_FLAG_CONT_EXPAND flag
    
    Remove usage of AOP_FLAG_CONT_EXPAND flag. Reiserfs is the only user of
    it and it is easy to avoid.
    
    Link: https://lore.kernel.org/r/20220220232219.1235-1-edward.shishkin@gmail.com
    Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
    Signed-off-by: Jan Kara <jack@suse.cz>

> I don't object if it goes via your tree; I doubt I'll get the AOP_FLAG
> removal finished in time for the next merge window.

OK, I'll keep it in my tree then and push it to Linus for the merge window.

								Honza
diff mbox series

Patch

diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index f49b72ccac4c..e943930939f5 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2763,13 +2763,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)
@@ -2896,9 +2889,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;
@@ -3316,7 +3306,11 @@  int reiserfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
 
 		/* 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);
+			loff_t pos = attr->ia_size;
+
+			if ((pos & (inode->i_sb->s_blocksize - 1)) == 0)
+				pos++;
+			error = generic_cont_expand_simple(inode, pos);
 			if (REISERFS_I(inode)->i_prealloc_count > 0) {
 				int err;
 				struct reiserfs_transaction_handle th;