2019-11-12 00:44:19

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 2/2] fs: Move swap_[de]activate to file_operations

On Mon, 11 Nov 2019 16:34:52 -0800 [email protected] wrote:

> From: Ira Weiny <[email protected]>
>
> swap_activate() and swap_deactivate() have nothing to do with
> address spaces. We want to eventually make the address space operations
> dynamic to switch inode flags on the fly.

What does this mean?

> So to simplify this code as
> well as properly track these operations we move these functions to the
> file_operations vector.
>
> This has been tested with XFS but not NFS, f2fs, or btrfs.
>
> Also note f2fs and xfs have simple moves of their functions to
> facilitate compilation. No functional changes are contained within
> those functions.
>
> ...
>
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -11002,6 +11002,8 @@ static const struct file_operations btrfs_dir_file_operations = {
> #endif
> .release = btrfs_release_file,
> .fsync = btrfs_sync_file,
> + .swap_activate = btrfs_swap_activate,
> + .swap_deactivate = btrfs_swap_deactivate,
> };

Shouldn't this be btrfs_file_operations?



2019-11-12 12:03:35

by Nikolay Borisov

[permalink] [raw]
Subject: Re: [PATCH 2/2] fs: Move swap_[de]activate to file_operations



On 12.11.19 г. 2:43 ч., Andrew Morton wrote:
> On Mon, 11 Nov 2019 16:34:52 -0800 [email protected] wrote:
>
>> From: Ira Weiny <[email protected]>
>>
>> swap_activate() and swap_deactivate() have nothing to do with
>> address spaces. We want to eventually make the address space operations
>> dynamic to switch inode flags on the fly.
>
> What does this mean?
>
>> So to simplify this code as
>> well as properly track these operations we move these functions to the
>> file_operations vector.
>>
>> This has been tested with XFS but not NFS, f2fs, or btrfs.
>>
>> Also note f2fs and xfs have simple moves of their functions to
>> facilitate compilation. No functional changes are contained within
>> those functions.
>>
>> ...
>>
>> --- a/fs/btrfs/inode.c
>> +++ b/fs/btrfs/inode.c
>> @@ -11002,6 +11002,8 @@ static const struct file_operations btrfs_dir_file_operations = {
>> #endif
>> .release = btrfs_release_file,
>> .fsync = btrfs_sync_file,
>> + .swap_activate = btrfs_swap_activate,
>> + .swap_deactivate = btrfs_swap_deactivate,
>> };
>
> Shouldn't this be btrfs_file_operations?

INdeed, having swap activate on a directory doesn't make much sense.

>
>

2019-11-12 13:35:03

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH 2/2] fs: Move swap_[de]activate to file_operations

On Mon 11-11-19 16:43:20, Andrew Morton wrote:
> On Mon, 11 Nov 2019 16:34:52 -0800 [email protected] wrote:
>
> > From: Ira Weiny <[email protected]>
> >
> > swap_activate() and swap_deactivate() have nothing to do with
> > address spaces. We want to eventually make the address space operations
> > dynamic to switch inode flags on the fly.
>
> What does this mean?

See my reply to Christoph [1]. Ira wants to make switching inodes between
DAX and non-DAX mode work which means switching also
address_space_operations pointer in the mapping.

Honza

[1] lore.kernel.org/r/[email protected]

--
Jan Kara <[email protected]>
SUSE Labs, CR