Skip to content

Commit 0b173bc

Browse files
koct9itorvalds
authored andcommitted
mm: kill vma flag VM_CAN_NONLINEAR
Move actual pte filling for non-linear file mappings into the new special vma operation: ->remap_pages(). Filesystems must implement this method to get non-linear mapping support, if it uses filemap_fault() then generic_file_remap_pages() can be used. Now device drivers can implement this method and obtain nonlinear vma support. Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Carsten Otte <cotte@de.ibm.com> Cc: Chris Metcalf <cmetcalf@tilera.com> #arch/tile Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Eric Paris <eparis@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Hugh Dickins <hughd@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Morris <james.l.morris@oracle.com> Cc: Jason Baron <jbaron@redhat.com> Cc: Kentaro Takeda <takedakn@nttdata.co.jp> Cc: Matt Helsley <matthltc@us.ibm.com> Cc: Nick Piggin <npiggin@kernel.dk> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Robert Richter <robert.richter@amd.com> Cc: Suresh Siddha <suresh.b.siddha@intel.com> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Venkatesh Pallipadi <venki@google.com> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4b6e1e3 commit 0b173bc

File tree

21 files changed

+39
-23
lines changed

21 files changed

+39
-23
lines changed

drivers/staging/android/ashmem.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
332332
if (vma->vm_file)
333333
fput(vma->vm_file);
334334
vma->vm_file = asma->file;
335-
vma->vm_flags |= VM_CAN_NONLINEAR;
336335

337336
out:
338337
mutex_unlock(&ashmem_mutex);

fs/9p/vfs_file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,7 @@ v9fs_cached_file_write(struct file *filp, const char __user * data,
738738
static const struct vm_operations_struct v9fs_file_vm_ops = {
739739
.fault = filemap_fault,
740740
.page_mkwrite = v9fs_vm_page_mkwrite,
741+
.remap_pages = generic_file_remap_pages,
741742
};
742743

743744

fs/btrfs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,6 +1599,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
15991599
static const struct vm_operations_struct btrfs_file_vm_ops = {
16001600
.fault = filemap_fault,
16011601
.page_mkwrite = btrfs_page_mkwrite,
1602+
.remap_pages = generic_file_remap_pages,
16021603
};
16031604

16041605
static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma)
@@ -1610,7 +1611,6 @@ static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma)
16101611

16111612
file_accessed(filp);
16121613
vma->vm_ops = &btrfs_file_vm_ops;
1613-
vma->vm_flags |= VM_CAN_NONLINEAR;
16141614

16151615
return 0;
16161616
}

fs/ceph/addr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,7 @@ static int ceph_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
12241224
static struct vm_operations_struct ceph_vmops = {
12251225
.fault = filemap_fault,
12261226
.page_mkwrite = ceph_page_mkwrite,
1227+
.remap_pages = generic_file_remap_pages,
12271228
};
12281229

12291230
int ceph_mmap(struct file *file, struct vm_area_struct *vma)
@@ -1234,6 +1235,5 @@ int ceph_mmap(struct file *file, struct vm_area_struct *vma)
12341235
return -ENOEXEC;
12351236
file_accessed(file);
12361237
vma->vm_ops = &ceph_vmops;
1237-
vma->vm_flags |= VM_CAN_NONLINEAR;
12381238
return 0;
12391239
}

fs/cifs/file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3003,6 +3003,7 @@ cifs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
30033003
static struct vm_operations_struct cifs_file_vm_ops = {
30043004
.fault = filemap_fault,
30053005
.page_mkwrite = cifs_page_mkwrite,
3006+
.remap_pages = generic_file_remap_pages,
30063007
};
30073008

30083009
int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)

fs/ext4/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
207207
static const struct vm_operations_struct ext4_file_vm_ops = {
208208
.fault = filemap_fault,
209209
.page_mkwrite = ext4_page_mkwrite,
210+
.remap_pages = generic_file_remap_pages,
210211
};
211212

212213
static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
@@ -217,7 +218,6 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
217218
return -ENOEXEC;
218219
file_accessed(file);
219220
vma->vm_ops = &ext4_file_vm_ops;
220-
vma->vm_flags |= VM_CAN_NONLINEAR;
221221
return 0;
222222
}
223223

fs/fuse/file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,7 @@ static const struct vm_operations_struct fuse_file_vm_ops = {
13791379
.close = fuse_vma_close,
13801380
.fault = filemap_fault,
13811381
.page_mkwrite = fuse_page_mkwrite,
1382+
.remap_pages = generic_file_remap_pages,
13821383
};
13831384

13841385
static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)

fs/gfs2/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
492492
static const struct vm_operations_struct gfs2_vm_ops = {
493493
.fault = filemap_fault,
494494
.page_mkwrite = gfs2_page_mkwrite,
495+
.remap_pages = generic_file_remap_pages,
495496
};
496497

497498
/**
@@ -526,7 +527,6 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
526527
return error;
527528
}
528529
vma->vm_ops = &gfs2_vm_ops;
529-
vma->vm_flags |= VM_CAN_NONLINEAR;
530530

531531
return 0;
532532
}

fs/nfs/file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
578578
static const struct vm_operations_struct nfs_file_vm_ops = {
579579
.fault = filemap_fault,
580580
.page_mkwrite = nfs_vm_page_mkwrite,
581+
.remap_pages = generic_file_remap_pages,
581582
};
582583

583584
static int nfs_need_sync_write(struct file *filp, struct inode *inode)

fs/nilfs2/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
135135
static const struct vm_operations_struct nilfs_file_vm_ops = {
136136
.fault = filemap_fault,
137137
.page_mkwrite = nilfs_page_mkwrite,
138+
.remap_pages = generic_file_remap_pages,
138139
};
139140

140141
static int nilfs_file_mmap(struct file *file, struct vm_area_struct *vma)
141142
{
142143
file_accessed(file);
143144
vma->vm_ops = &nilfs_file_vm_ops;
144-
vma->vm_flags |= VM_CAN_NONLINEAR;
145145
return 0;
146146
}
147147

0 commit comments

Comments
 (0)