* [Ocfs2-devel] [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
This series of patches introduce wrappers for functions,
arguments simplification in functions calls and most importantly
groups duplicated code in a single header, simplefs, to avoid redundancy
in the linux fs, especially debugfs and tracefs.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Emanuele Giuseppe Esposito (8):
apparmor: just use vfs_kern_mount to make .null
fs: extract simple_pin/release_fs to separate files
fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
fs: introduce simple_new_inode
simplefs: add alloc_anon_inode wrapper
simplefs: add file creation functions
debugfs: switch to simplefs inode creation API
tracefs: switch to simplefs inode creation API
arch/powerpc/platforms/cell/spufs/inode.c | 4 +-
arch/s390/hypfs/inode.c | 4 +-
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/drm_drv.c | 13 +-
drivers/infiniband/hw/qib/qib_fs.c | 6 +-
drivers/misc/cxl/Kconfig | 1 +
drivers/misc/cxl/api.c | 14 +-
drivers/misc/ibmasm/ibmasmfs.c | 8 +-
drivers/misc/ocxl/Kconfig | 1 +
drivers/oprofile/oprofilefs.c | 8 +-
drivers/scsi/cxlflash/ocxl_hw.c | 15 +-
drivers/usb/gadget/function/f_fs.c | 8 +-
fs/Kconfig | 3 +
fs/Kconfig.binfmt | 1 +
fs/Makefile | 1 +
fs/autofs/inode.c | 4 +-
fs/binfmt_misc.c | 27 +--
fs/configfs/Kconfig | 1 +
fs/configfs/mount.c | 12 +-
fs/debugfs/inode.c | 171 +++----------------
fs/efivarfs/inode.c | 4 +-
fs/fuse/control.c | 4 +-
fs/hugetlbfs/inode.c | 8 +-
fs/libfs.c | 48 ++----
fs/ocfs2/dlmfs/dlmfs.c | 8 +-
fs/proc/base.c | 4 +-
fs/proc/proc_sysctl.c | 5 +-
fs/pstore/inode.c | 14 +-
fs/ramfs/inode.c | 4 +-
fs/simplefs.c | 194 ++++++++++++++++++++++
fs/tracefs/inode.c | 108 ++----------
include/linux/fs.h | 3 +-
include/linux/simplefs.h | 36 ++++
ipc/mqueue.c | 4 +-
kernel/bpf/inode.c | 7 +-
lib/Kconfig.debug | 16 +-
mm/shmem.c | 4 +-
net/sunrpc/rpc_pipe.c | 4 +-
security/Kconfig | 1 +
security/apparmor/apparmorfs.c | 48 +++---
security/inode.c | 17 +-
41 files changed, 385 insertions(+), 459 deletions(-)
create mode 100644 fs/simplefs.c
create mode 100644 include/linux/simplefs.h
--
2.25.2
^ permalink raw reply [flat|nested] 130+ messages in thread
* [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Paolo Bonzini, Emanuele Giuseppe Esposito, Jeremy Kerr,
Arnd Bergmann, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, Trond Myklebust, Anna Schumaker,
J. Bruce Fields, Chuck Lever, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
This series of patches introduce wrappers for functions,
arguments simplification in functions calls and most importantly
groups duplicated code in a single header, simplefs, to avoid redundancy
in the linux fs, especially debugfs and tracefs.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Emanuele Giuseppe Esposito (8):
apparmor: just use vfs_kern_mount to make .null
fs: extract simple_pin/release_fs to separate files
fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
fs: introduce simple_new_inode
simplefs: add alloc_anon_inode wrapper
simplefs: add file creation functions
debugfs: switch to simplefs inode creation API
tracefs: switch to simplefs inode creation API
arch/powerpc/platforms/cell/spufs/inode.c | 4 +-
arch/s390/hypfs/inode.c | 4 +-
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/drm_drv.c | 13 +-
drivers/infiniband/hw/qib/qib_fs.c | 6 +-
drivers/misc/cxl/Kconfig | 1 +
drivers/misc/cxl/api.c | 14 +-
drivers/misc/ibmasm/ibmasmfs.c | 8 +-
drivers/misc/ocxl/Kconfig | 1 +
drivers/oprofile/oprofilefs.c | 8 +-
drivers/scsi/cxlflash/ocxl_hw.c | 15 +-
drivers/usb/gadget/function/f_fs.c | 8 +-
fs/Kconfig | 3 +
fs/Kconfig.binfmt | 1 +
fs/Makefile | 1 +
fs/autofs/inode.c | 4 +-
fs/binfmt_misc.c | 27 +--
fs/configfs/Kconfig | 1 +
fs/configfs/mount.c | 12 +-
fs/debugfs/inode.c | 171 +++----------------
fs/efivarfs/inode.c | 4 +-
fs/fuse/control.c | 4 +-
fs/hugetlbfs/inode.c | 8 +-
fs/libfs.c | 48 ++----
fs/ocfs2/dlmfs/dlmfs.c | 8 +-
fs/proc/base.c | 4 +-
fs/proc/proc_sysctl.c | 5 +-
fs/pstore/inode.c | 14 +-
fs/ramfs/inode.c | 4 +-
fs/simplefs.c | 194 ++++++++++++++++++++++
fs/tracefs/inode.c | 108 ++----------
include/linux/fs.h | 3 +-
include/linux/simplefs.h | 36 ++++
ipc/mqueue.c | 4 +-
kernel/bpf/inode.c | 7 +-
lib/Kconfig.debug | 16 +-
mm/shmem.c | 4 +-
net/sunrpc/rpc_pipe.c | 4 +-
security/Kconfig | 1 +
security/apparmor/apparmorfs.c | 48 +++---
security/inode.c | 17 +-
41 files changed, 385 insertions(+), 459 deletions(-)
create mode 100644 fs/simplefs.c
create mode 100644 include/linux/simplefs.h
--
2.25.2
^ permalink raw reply [flat|nested] 130+ messages in thread
* [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, linux-fsdevel, Manoj N. Kumar, Alexander Viro,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, Mike Marciniszyn, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
This series of patches introduce wrappers for functions,
arguments simplification in functions calls and most importantly
groups duplicated code in a single header, simplefs, to avoid redundancy
in the linux fs, especially debugfs and tracefs.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Emanuele Giuseppe Esposito (8):
apparmor: just use vfs_kern_mount to make .null
fs: extract simple_pin/release_fs to separate files
fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
fs: introduce simple_new_inode
simplefs: add alloc_anon_inode wrapper
simplefs: add file creation functions
debugfs: switch to simplefs inode creation API
tracefs: switch to simplefs inode creation API
arch/powerpc/platforms/cell/spufs/inode.c | 4 +-
arch/s390/hypfs/inode.c | 4 +-
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/drm_drv.c | 13 +-
drivers/infiniband/hw/qib/qib_fs.c | 6 +-
drivers/misc/cxl/Kconfig | 1 +
drivers/misc/cxl/api.c | 14 +-
drivers/misc/ibmasm/ibmasmfs.c | 8 +-
drivers/misc/ocxl/Kconfig | 1 +
drivers/oprofile/oprofilefs.c | 8 +-
drivers/scsi/cxlflash/ocxl_hw.c | 15 +-
drivers/usb/gadget/function/f_fs.c | 8 +-
fs/Kconfig | 3 +
fs/Kconfig.binfmt | 1 +
fs/Makefile | 1 +
fs/autofs/inode.c | 4 +-
fs/binfmt_misc.c | 27 +--
fs/configfs/Kconfig | 1 +
fs/configfs/mount.c | 12 +-
fs/debugfs/inode.c | 171 +++----------------
fs/efivarfs/inode.c | 4 +-
fs/fuse/control.c | 4 +-
fs/hugetlbfs/inode.c | 8 +-
fs/libfs.c | 48 ++----
fs/ocfs2/dlmfs/dlmfs.c | 8 +-
fs/proc/base.c | 4 +-
fs/proc/proc_sysctl.c | 5 +-
fs/pstore/inode.c | 14 +-
fs/ramfs/inode.c | 4 +-
fs/simplefs.c | 194 ++++++++++++++++++++++
fs/tracefs/inode.c | 108 ++----------
include/linux/fs.h | 3 +-
include/linux/simplefs.h | 36 ++++
ipc/mqueue.c | 4 +-
kernel/bpf/inode.c | 7 +-
lib/Kconfig.debug | 16 +-
mm/shmem.c | 4 +-
net/sunrpc/rpc_pipe.c | 4 +-
security/Kconfig | 1 +
security/apparmor/apparmorfs.c | 48 +++---
security/inode.c | 17 +-
41 files changed, 385 insertions(+), 459 deletions(-)
create mode 100644 fs/simplefs.c
create mode 100644 include/linux/simplefs.h
--
2.25.2
^ permalink raw reply [flat|nested] 130+ messages in thread
* [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
This series of patches introduce wrappers for functions,
arguments simplification in functions calls and most importantly
groups duplicated code in a single header, simplefs, to avoid redundancy
in the linux fs, especially debugfs and tracefs.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Emanuele Giuseppe Esposito (8):
apparmor: just use vfs_kern_mount to make .null
fs: extract simple_pin/release_fs to separate files
fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
fs: introduce simple_new_inode
simplefs: add alloc_anon_inode wrapper
simplefs: add file creation functions
debugfs: switch to simplefs inode creation API
tracefs: switch to simplefs inode creation API
arch/powerpc/platforms/cell/spufs/inode.c | 4 +-
arch/s390/hypfs/inode.c | 4 +-
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/drm_drv.c | 13 +-
drivers/infiniband/hw/qib/qib_fs.c | 6 +-
drivers/misc/cxl/Kconfig | 1 +
drivers/misc/cxl/api.c | 14 +-
drivers/misc/ibmasm/ibmasmfs.c | 8 +-
drivers/misc/ocxl/Kconfig | 1 +
drivers/oprofile/oprofilefs.c | 8 +-
drivers/scsi/cxlflash/ocxl_hw.c | 15 +-
drivers/usb/gadget/function/f_fs.c | 8 +-
fs/Kconfig | 3 +
fs/Kconfig.binfmt | 1 +
fs/Makefile | 1 +
fs/autofs/inode.c | 4 +-
fs/binfmt_misc.c | 27 +--
fs/configfs/Kconfig | 1 +
fs/configfs/mount.c | 12 +-
fs/debugfs/inode.c | 171 +++----------------
fs/efivarfs/inode.c | 4 +-
fs/fuse/control.c | 4 +-
fs/hugetlbfs/inode.c | 8 +-
fs/libfs.c | 48 ++----
fs/ocfs2/dlmfs/dlmfs.c | 8 +-
fs/proc/base.c | 4 +-
fs/proc/proc_sysctl.c | 5 +-
fs/pstore/inode.c | 14 +-
fs/ramfs/inode.c | 4 +-
fs/simplefs.c | 194 ++++++++++++++++++++++
fs/tracefs/inode.c | 108 ++----------
include/linux/fs.h | 3 +-
include/linux/simplefs.h | 36 ++++
ipc/mqueue.c | 4 +-
kernel/bpf/inode.c | 7 +-
lib/Kconfig.debug | 16 +-
mm/shmem.c | 4 +-
net/sunrpc/rpc_pipe.c | 4 +-
security/Kconfig | 1 +
security/apparmor/apparmorfs.c | 48 +++---
security/inode.c | 17 +-
41 files changed, 385 insertions(+), 459 deletions(-)
create mode 100644 fs/simplefs.c
create mode 100644 include/linux/simplefs.h
--
2.25.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh
This series of patches introduce wrappers for functions,
arguments simplification in functions calls and most importantly
groups duplicated code in a single header, simplefs, to avoid redundancy
in the linux fs, especially debugfs and tracefs.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Emanuele Giuseppe Esposito (8):
apparmor: just use vfs_kern_mount to make .null
fs: extract simple_pin/release_fs to separate files
fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
fs: introduce simple_new_inode
simplefs: add alloc_anon_inode wrapper
simplefs: add file creation functions
debugfs: switch to simplefs inode creation API
tracefs: switch to simplefs inode creation API
arch/powerpc/platforms/cell/spufs/inode.c | 4 +-
arch/s390/hypfs/inode.c | 4 +-
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/drm_drv.c | 13 +-
drivers/infiniband/hw/qib/qib_fs.c | 6 +-
drivers/misc/cxl/Kconfig | 1 +
drivers/misc/cxl/api.c | 14 +-
drivers/misc/ibmasm/ibmasmfs.c | 8 +-
drivers/misc/ocxl/Kconfig | 1 +
drivers/oprofile/oprofilefs.c | 8 +-
drivers/scsi/cxlflash/ocxl_hw.c | 15 +-
drivers/usb/gadget/function/f_fs.c | 8 +-
fs/Kconfig | 3 +
fs/Kconfig.binfmt | 1 +
fs/Makefile | 1 +
fs/autofs/inode.c | 4 +-
fs/binfmt_misc.c | 27 +--
fs/configfs/Kconfig | 1 +
fs/configfs/mount.c | 12 +-
fs/debugfs/inode.c | 171 +++----------------
fs/efivarfs/inode.c | 4 +-
fs/fuse/control.c | 4 +-
fs/hugetlbfs/inode.c | 8 +-
fs/libfs.c | 48 ++----
fs/ocfs2/dlmfs/dlmfs.c | 8 +-
fs/proc/base.c | 4 +-
fs/proc/proc_sysctl.c | 5 +-
fs/pstore/inode.c | 14 +-
fs/ramfs/inode.c | 4 +-
fs/simplefs.c | 194 ++++++++++++++++++++++
fs/tracefs/inode.c | 108 ++----------
include/linux/fs.h | 3 +-
include/linux/simplefs.h | 36 ++++
ipc/mqueue.c | 4 +-
kernel/bpf/inode.c | 7 +-
lib/Kconfig.debug | 16 +-
mm/shmem.c | 4 +-
net/sunrpc/rpc_pipe.c | 4 +-
security/Kconfig | 1 +
security/apparmor/apparmorfs.c | 48 +++---
security/inode.c | 17 +-
41 files changed, 385 insertions(+), 459 deletions(-)
create mode 100644 fs/simplefs.c
create mode 100644 include/linux/simplefs.h
--
2.25.2
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
variables as arguments, for what would amount to a simple
vfs_kern_mount/mntput pair if everything was inlined. Just use
the normal filesystem API since the reference counting is not needed
here.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
security/apparmor/apparmorfs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 280741fc0f5f..828bb1eb77ea 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -2525,14 +2525,14 @@ struct path aa_null;
static int aa_mk_null_file(struct dentry *parent)
{
- struct vfsmount *mount = NULL;
+ struct file_system_type *type = parent->d_sb->s_type;
+ struct vfsmount *mount;
struct dentry *dentry;
struct inode *inode;
- int count = 0;
- int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
- if (error)
- return error;
+ mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
+ if (IS_ERR(mount))
+ return PTR_ERR(mount);
inode_lock(d_inode(parent));
dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
@@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
dput(dentry);
out:
inode_unlock(d_inode(parent));
- simple_release_fs(&mount, &count);
+ mntput(mount);
return error;
}
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Paolo Bonzini, Emanuele Giuseppe Esposito, Jeremy Kerr,
Arnd Bergmann, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
variables as arguments, for what would amount to a simple
vfs_kern_mount/mntput pair if everything was inlined. Just use
the normal filesystem API since the reference counting is not needed
here.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
security/apparmor/apparmorfs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 280741fc0f5f..828bb1eb77ea 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -2525,14 +2525,14 @@ struct path aa_null;
static int aa_mk_null_file(struct dentry *parent)
{
- struct vfsmount *mount = NULL;
+ struct file_system_type *type = parent->d_sb->s_type;
+ struct vfsmount *mount;
struct dentry *dentry;
struct inode *inode;
- int count = 0;
- int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
- if (error)
- return error;
+ mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
+ if (IS_ERR(mount))
+ return PTR_ERR(mount);
inode_lock(d_inode(parent));
dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
@@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
dput(dentry);
out:
inode_unlock(d_inode(parent));
- simple_release_fs(&mount, &count);
+ mntput(mount);
return error;
}
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, linux-fsdevel, Manoj N. Kumar, Alexander Viro,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, Mike Marciniszyn, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
variables as arguments, for what would amount to a simple
vfs_kern_mount/mntput pair if everything was inlined. Just use
the normal filesystem API since the reference counting is not needed
here.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
security/apparmor/apparmorfs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 280741fc0f5f..828bb1eb77ea 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -2525,14 +2525,14 @@ struct path aa_null;
static int aa_mk_null_file(struct dentry *parent)
{
- struct vfsmount *mount = NULL;
+ struct file_system_type *type = parent->d_sb->s_type;
+ struct vfsmount *mount;
struct dentry *dentry;
struct inode *inode;
- int count = 0;
- int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
- if (error)
- return error;
+ mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
+ if (IS_ERR(mount))
+ return PTR_ERR(mount);
inode_lock(d_inode(parent));
dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
@@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
dput(dentry);
out:
inode_unlock(d_inode(parent));
- simple_release_fs(&mount, &count);
+ mntput(mount);
return error;
}
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
variables as arguments, for what would amount to a simple
vfs_kern_mount/mntput pair if everything was inlined. Just use
the normal filesystem API since the reference counting is not needed
here.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
security/apparmor/apparmorfs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 280741fc0f5f..828bb1eb77ea 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -2525,14 +2525,14 @@ struct path aa_null;
static int aa_mk_null_file(struct dentry *parent)
{
- struct vfsmount *mount = NULL;
+ struct file_system_type *type = parent->d_sb->s_type;
+ struct vfsmount *mount;
struct dentry *dentry;
struct inode *inode;
- int count = 0;
- int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
- if (error)
- return error;
+ mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
+ if (IS_ERR(mount))
+ return PTR_ERR(mount);
inode_lock(d_inode(parent));
dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
@@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
dput(dentry);
out:
inode_unlock(d_inode(parent));
- simple_release_fs(&mount, &count);
+ mntput(mount);
return error;
}
--
2.25.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh
aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
variables as arguments, for what would amount to a simple
vfs_kern_mount/mntput pair if everything was inlined. Just use
the normal filesystem API since the reference counting is not needed
here.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
security/apparmor/apparmorfs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 280741fc0f5f..828bb1eb77ea 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -2525,14 +2525,14 @@ struct path aa_null;
static int aa_mk_null_file(struct dentry *parent)
{
- struct vfsmount *mount = NULL;
+ struct file_system_type *type = parent->d_sb->s_type;
+ struct vfsmount *mount;
struct dentry *dentry;
struct inode *inode;
- int count = 0;
- int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
- if (error)
- return error;
+ mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
+ if (IS_ERR(mount))
+ return PTR_ERR(mount);
inode_lock(d_inode(parent));
dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
@@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
dput(dentry);
out:
inode_unlock(d_inode(parent));
- simple_release_fs(&mount, &count);
+ mntput(mount);
return error;
}
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
We will augment this family of functions with inode management. To avoid
littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
with a Kconfig symbol to enable them.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/Kconfig | 1 +
drivers/misc/cxl/api.c | 1 +
drivers/misc/ocxl/Kconfig | 1 +
drivers/scsi/cxlflash/ocxl_hw.c | 1 +
fs/Kconfig | 3 +++
fs/Kconfig.binfmt | 1 +
fs/Makefile | 1 +
fs/binfmt_misc.c | 2 +-
fs/configfs/Kconfig | 1 +
fs/configfs/mount.c | 2 +-
fs/debugfs/inode.c | 2 +-
fs/libfs.c | 36 +------------------------------
fs/simplefs.c | 38 +++++++++++++++++++++++++++++++++
fs/tracefs/inode.c | 2 +-
include/linux/fs.h | 2 --
include/linux/simplefs.h | 10 +++++++++
lib/Kconfig.debug | 16 ++++++++------
security/Kconfig | 1 +
security/apparmor/apparmorfs.c | 3 ++-
security/inode.c | 2 +-
22 files changed, 79 insertions(+), 50 deletions(-)
create mode 100644 fs/simplefs.c
create mode 100644 include/linux/simplefs.h
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 43594978958e..a6fe933de9da 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -14,6 +14,7 @@ menuconfig DRM
select I2C
select I2C_ALGOBIT
select DMA_SHARED_BUFFER
+ select SIMPLEFS
select SYNC_FILE
help
Kernel-level support for the Direct Rendering Infrastructure (DRI)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 7b1a628d1f6e..187a61091b5c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -27,7 +27,7 @@
*/
#include <linux/debugfs.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mount.h>
diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
index 39eec9031487..a62795079d9c 100644
--- a/drivers/misc/cxl/Kconfig
+++ b/drivers/misc/cxl/Kconfig
@@ -19,6 +19,7 @@ config CXL
select CXL_BASE
select CXL_AFU_DRIVER_OPS
select CXL_LIB
+ select SIMPLEFS
default m
help
Select this option to enable driver support for IBM Coherent
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index b493de962153..0b8f8de7475a 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -9,6 +9,7 @@
#include <misc/cxl.h>
#include <linux/module.h>
#include <linux/mount.h>
+#include <linux/simplefs.h>
#include <linux/pseudo_fs.h>
#include <linux/sched/mm.h>
#include <linux/mmu_context.h>
diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
index 2d2266c1439e..ddd9245fff3d 100644
--- a/drivers/misc/ocxl/Kconfig
+++ b/drivers/misc/ocxl/Kconfig
@@ -12,6 +12,7 @@ config OCXL
depends on PPC_POWERNV && PCI && EEH
select OCXL_BASE
select HOTPLUG_PCI_POWERNV
+ select SIMPLEFS
default m
help
Select this option to enable the ocxl driver for Open
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 7018cd802569..429f55651090 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -12,6 +12,7 @@
#include <linux/idr.h>
#include <linux/module.h>
#include <linux/mount.h>
+#include <linux/simplefs.h>
#include <linux/pseudo_fs.h>
#include <linux/poll.h>
#include <linux/sched/signal.h>
diff --git a/fs/Kconfig b/fs/Kconfig
index f08fbbfafd9a..a6795ae312a2 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -218,6 +218,9 @@ config HUGETLB_PAGE
config MEMFD_CREATE
def_bool TMPFS || HUGETLBFS
+config SIMPLEFS
+ bool
+
config ARCH_HAS_GIGANTIC_PAGE
bool
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 62dc4f577ba1..af7b765de4d3 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -176,6 +176,7 @@ config BINFMT_EM86
config BINFMT_MISC
tristate "Kernel support for MISC binaries"
+ select SIMPLEFS
---help---
If you say Y here, it will be possible to plug wrapper-driven binary
formats into the kernel. You will like this especially when you use
diff --git a/fs/Makefile b/fs/Makefile
index 2ce5112b02c8..c5c665984b9e 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_PROC_FS) += proc_namespace.o
obj-y += notify/
obj-$(CONFIG_EPOLL) += eventpoll.o
obj-y += anon_inodes.o
+obj-$(CONFIG_SIMPLEFS) += simplefs.o
obj-$(CONFIG_SIGNALFD) += signalfd.o
obj-$(CONFIG_TIMERFD) += timerfd.o
obj-$(CONFIG_EVENTFD) += eventfd.o
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index cdb45829354d..c764110f5f0b 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -25,7 +25,7 @@
#include <linux/mount.h>
#include <linux/fs_context.h>
#include <linux/syscalls.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/uaccess.h>
#include "internal.h"
diff --git a/fs/configfs/Kconfig b/fs/configfs/Kconfig
index 272b64456999..3b461e4e3989 100644
--- a/fs/configfs/Kconfig
+++ b/fs/configfs/Kconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config CONFIGFS_FS
tristate "Userspace-driven configuration filesystem"
+ select SIMPLEFS
select SYSFS
help
configfs is a RAM-based filesystem that provides the converse
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 0c6e8cf61953..331c2f064f02 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -10,7 +10,7 @@
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/fs_context.h>
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index b7f2e971ecbc..7b9fddced48f 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -13,7 +13,7 @@
#define pr_fmt(fmt) "debugfs: " fmt
#include <linux/module.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
diff --git a/fs/libfs.c b/fs/libfs.c
index 3759fbacf522..26ec729f7bcd 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -11,6 +11,7 @@
#include <linux/cred.h>
#include <linux/mount.h>
#include <linux/vfs.h>
+#include <linux/simplefs.h>
#include <linux/quotaops.h>
#include <linux/mutex.h>
#include <linux/namei.h>
@@ -663,41 +664,6 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
}
EXPORT_SYMBOL(simple_fill_super);
-static DEFINE_SPINLOCK(pin_fs_lock);
-
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt = NULL;
- spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
- spin_unlock(&pin_fs_lock);
- mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
- if (IS_ERR(mnt))
- return PTR_ERR(mnt);
- spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
- }
- mntget(*mount);
- ++*count;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
- return 0;
-}
-EXPORT_SYMBOL(simple_pin_fs);
-
-void simple_release_fs(struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt;
- spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
-}
-EXPORT_SYMBOL(simple_release_fs);
-
/**
* simple_read_from_buffer - copy data from the buffer to user space
* @to: the user space buffer to read to
diff --git a/fs/simplefs.c b/fs/simplefs.c
new file mode 100644
index 000000000000..226d18963801
--- /dev/null
+++ b/fs/simplefs.c
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <linux/simplefs.h>
+#include <linux/mount.h>
+
+static DEFINE_SPINLOCK(pin_fs_lock);
+
+int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+{
+ struct vfsmount *mnt = NULL;
+ spin_lock(&pin_fs_lock);
+ if (unlikely(!*mount)) {
+ spin_unlock(&pin_fs_lock);
+ mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
+ if (IS_ERR(mnt))
+ return PTR_ERR(mnt);
+ spin_lock(&pin_fs_lock);
+ if (!*mount)
+ *mount = mnt;
+ }
+ mntget(*mount);
+ ++*count;
+ spin_unlock(&pin_fs_lock);
+ mntput(mnt);
+ return 0;
+}
+EXPORT_SYMBOL(simple_pin_fs);
+
+void simple_release_fs(struct vfsmount **mount, int *count)
+{
+ struct vfsmount *mnt;
+ spin_lock(&pin_fs_lock);
+ mnt = *mount;
+ if (!--*count)
+ *mount = NULL;
+ spin_unlock(&pin_fs_lock);
+ mntput(mnt);
+}
+EXPORT_SYMBOL(simple_release_fs);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 0ee8c6dfb036..4353ca81e1d7 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -10,7 +10,7 @@
*/
#include <linux/module.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/mount.h>
#include <linux/kobject.h>
#include <linux/namei.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4f6f59b4f22a..55b679b89c8a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3363,8 +3363,6 @@ struct tree_descr { const char *name; const struct file_operations *ops; int mod
struct dentry *d_alloc_name(struct dentry *, const char *);
extern int simple_fill_super(struct super_block *, unsigned long,
const struct tree_descr *);
-extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
-extern void simple_release_fs(struct vfsmount **mount, int *count);
extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
loff_t *ppos, const void *from, size_t available);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
new file mode 100644
index 000000000000..1076a44db308
--- /dev/null
+++ b/include/linux/simplefs.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_SIMPLEFS_H
+#define _LINUX_SIMPLEFS_H
+
+#include <linux/fs.h>
+
+extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
+extern void simple_release_fs(struct vfsmount **mount, int *count);
+
+#endif
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d1398cef3b18..fc38a6f0fc11 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
config READABLE_ASM
bool "Generate readable assembler code"
- depends on DEBUG_KERNEL
- help
- Disable some compiler optimizations that tend to generate human unreadable
- assembler output. This may make the kernel slightly slower, but it helps
- to keep kernel developers who have to stare a lot at assembler listings
- sane.
+ depends on DEBUG_KERNEL
+ help
+ Disable some compiler optimizations that tend to generate human unreadable
+ assembler output. This may make the kernel slightly slower, but it helps
+ to keep kernel developers who have to stare a lot at assembler listings
+ sane.
+
+config DEBUG_FS
+ bool "Debug Filesystem"
+ select SIMPLEFS
config HEADERS_INSTALL
bool "Install uapi headers to usr/include"
diff --git a/security/Kconfig b/security/Kconfig
index cd3cc7da3a55..2c6713aa8b4f 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -39,6 +39,7 @@ config SECURITY_WRITABLE_HOOKS
config SECURITYFS
bool "Enable the securityfs filesystem"
+ select SIMPLEFS
help
This will build the securityfs filesystem. It is currently used by
various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM).
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 828bb1eb77ea..d62d3fca47f2 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -18,7 +18,7 @@
#include <linux/namei.h>
#include <linux/capability.h>
#include <linux/rcupdate.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/fs_context.h>
#include <linux/poll.h>
#include <linux/zlib.h>
@@ -2529,6 +2529,7 @@ static int aa_mk_null_file(struct dentry *parent)
struct vfsmount *mount;
struct dentry *dentry;
struct inode *inode;
+ int error;
mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
if (IS_ERR(mount))
diff --git a/security/inode.c b/security/inode.c
index 6c326939750d..a9a9ee4de21d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -12,7 +12,7 @@
/* #define DEBUG */
#include <linux/sysfs.h>
#include <linux/kobject.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/fs_context.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Paolo Bonzini, Emanuele Giuseppe Esposito, Jeremy Kerr,
Arnd Bergmann, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
We will augment this family of functions with inode management. To avoid
littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
with a Kconfig symbol to enable them.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/Kconfig | 1 +
drivers/misc/cxl/api.c | 1 +
drivers/misc/ocxl/Kconfig | 1 +
drivers/scsi/cxlflash/ocxl_hw.c | 1 +
fs/Kconfig | 3 +++
fs/Kconfig.binfmt | 1 +
fs/Makefile | 1 +
fs/binfmt_misc.c | 2 +-
fs/configfs/Kconfig | 1 +
fs/configfs/mount.c | 2 +-
fs/debugfs/inode.c | 2 +-
fs/libfs.c | 36 +------------------------------
fs/simplefs.c | 38 +++++++++++++++++++++++++++++++++
fs/tracefs/inode.c | 2 +-
include/linux/fs.h | 2 --
include/linux/simplefs.h | 10 +++++++++
lib/Kconfig.debug | 16 ++++++++------
security/Kconfig | 1 +
security/apparmor/apparmorfs.c | 3 ++-
security/inode.c | 2 +-
22 files changed, 79 insertions(+), 50 deletions(-)
create mode 100644 fs/simplefs.c
create mode 100644 include/linux/simplefs.h
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 43594978958e..a6fe933de9da 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -14,6 +14,7 @@ menuconfig DRM
select I2C
select I2C_ALGOBIT
select DMA_SHARED_BUFFER
+ select SIMPLEFS
select SYNC_FILE
help
Kernel-level support for the Direct Rendering Infrastructure (DRI)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 7b1a628d1f6e..187a61091b5c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -27,7 +27,7 @@
*/
#include <linux/debugfs.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mount.h>
diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
index 39eec9031487..a62795079d9c 100644
--- a/drivers/misc/cxl/Kconfig
+++ b/drivers/misc/cxl/Kconfig
@@ -19,6 +19,7 @@ config CXL
select CXL_BASE
select CXL_AFU_DRIVER_OPS
select CXL_LIB
+ select SIMPLEFS
default m
help
Select this option to enable driver support for IBM Coherent
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index b493de962153..0b8f8de7475a 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -9,6 +9,7 @@
#include <misc/cxl.h>
#include <linux/module.h>
#include <linux/mount.h>
+#include <linux/simplefs.h>
#include <linux/pseudo_fs.h>
#include <linux/sched/mm.h>
#include <linux/mmu_context.h>
diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
index 2d2266c1439e..ddd9245fff3d 100644
--- a/drivers/misc/ocxl/Kconfig
+++ b/drivers/misc/ocxl/Kconfig
@@ -12,6 +12,7 @@ config OCXL
depends on PPC_POWERNV && PCI && EEH
select OCXL_BASE
select HOTPLUG_PCI_POWERNV
+ select SIMPLEFS
default m
help
Select this option to enable the ocxl driver for Open
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 7018cd802569..429f55651090 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -12,6 +12,7 @@
#include <linux/idr.h>
#include <linux/module.h>
#include <linux/mount.h>
+#include <linux/simplefs.h>
#include <linux/pseudo_fs.h>
#include <linux/poll.h>
#include <linux/sched/signal.h>
diff --git a/fs/Kconfig b/fs/Kconfig
index f08fbbfafd9a..a6795ae312a2 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -218,6 +218,9 @@ config HUGETLB_PAGE
config MEMFD_CREATE
def_bool TMPFS || HUGETLBFS
+config SIMPLEFS
+ bool
+
config ARCH_HAS_GIGANTIC_PAGE
bool
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 62dc4f577ba1..af7b765de4d3 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -176,6 +176,7 @@ config BINFMT_EM86
config BINFMT_MISC
tristate "Kernel support for MISC binaries"
+ select SIMPLEFS
---help---
If you say Y here, it will be possible to plug wrapper-driven binary
formats into the kernel. You will like this especially when you use
diff --git a/fs/Makefile b/fs/Makefile
index 2ce5112b02c8..c5c665984b9e 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_PROC_FS) += proc_namespace.o
obj-y += notify/
obj-$(CONFIG_EPOLL) += eventpoll.o
obj-y += anon_inodes.o
+obj-$(CONFIG_SIMPLEFS) += simplefs.o
obj-$(CONFIG_SIGNALFD) += signalfd.o
obj-$(CONFIG_TIMERFD) += timerfd.o
obj-$(CONFIG_EVENTFD) += eventfd.o
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index cdb45829354d..c764110f5f0b 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -25,7 +25,7 @@
#include <linux/mount.h>
#include <linux/fs_context.h>
#include <linux/syscalls.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/uaccess.h>
#include "internal.h"
diff --git a/fs/configfs/Kconfig b/fs/configfs/Kconfig
index 272b64456999..3b461e4e3989 100644
--- a/fs/configfs/Kconfig
+++ b/fs/configfs/Kconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config CONFIGFS_FS
tristate "Userspace-driven configuration filesystem"
+ select SIMPLEFS
select SYSFS
help
configfs is a RAM-based filesystem that provides the converse
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 0c6e8cf61953..331c2f064f02 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -10,7 +10,7 @@
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/fs_context.h>
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index b7f2e971ecbc..7b9fddced48f 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -13,7 +13,7 @@
#define pr_fmt(fmt) "debugfs: " fmt
#include <linux/module.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
diff --git a/fs/libfs.c b/fs/libfs.c
index 3759fbacf522..26ec729f7bcd 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -11,6 +11,7 @@
#include <linux/cred.h>
#include <linux/mount.h>
#include <linux/vfs.h>
+#include <linux/simplefs.h>
#include <linux/quotaops.h>
#include <linux/mutex.h>
#include <linux/namei.h>
@@ -663,41 +664,6 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
}
EXPORT_SYMBOL(simple_fill_super);
-static DEFINE_SPINLOCK(pin_fs_lock);
-
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt = NULL;
- spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
- spin_unlock(&pin_fs_lock);
- mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
- if (IS_ERR(mnt))
- return PTR_ERR(mnt);
- spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
- }
- mntget(*mount);
- ++*count;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
- return 0;
-}
-EXPORT_SYMBOL(simple_pin_fs);
-
-void simple_release_fs(struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt;
- spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
-}
-EXPORT_SYMBOL(simple_release_fs);
-
/**
* simple_read_from_buffer - copy data from the buffer to user space
* @to: the user space buffer to read to
diff --git a/fs/simplefs.c b/fs/simplefs.c
new file mode 100644
index 000000000000..226d18963801
--- /dev/null
+++ b/fs/simplefs.c
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <linux/simplefs.h>
+#include <linux/mount.h>
+
+static DEFINE_SPINLOCK(pin_fs_lock);
+
+int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+{
+ struct vfsmount *mnt = NULL;
+ spin_lock(&pin_fs_lock);
+ if (unlikely(!*mount)) {
+ spin_unlock(&pin_fs_lock);
+ mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
+ if (IS_ERR(mnt))
+ return PTR_ERR(mnt);
+ spin_lock(&pin_fs_lock);
+ if (!*mount)
+ *mount = mnt;
+ }
+ mntget(*mount);
+ ++*count;
+ spin_unlock(&pin_fs_lock);
+ mntput(mnt);
+ return 0;
+}
+EXPORT_SYMBOL(simple_pin_fs);
+
+void simple_release_fs(struct vfsmount **mount, int *count)
+{
+ struct vfsmount *mnt;
+ spin_lock(&pin_fs_lock);
+ mnt = *mount;
+ if (!--*count)
+ *mount = NULL;
+ spin_unlock(&pin_fs_lock);
+ mntput(mnt);
+}
+EXPORT_SYMBOL(simple_release_fs);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 0ee8c6dfb036..4353ca81e1d7 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -10,7 +10,7 @@
*/
#include <linux/module.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/mount.h>
#include <linux/kobject.h>
#include <linux/namei.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4f6f59b4f22a..55b679b89c8a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3363,8 +3363,6 @@ struct tree_descr { const char *name; const struct file_operations *ops; int mod
struct dentry *d_alloc_name(struct dentry *, const char *);
extern int simple_fill_super(struct super_block *, unsigned long,
const struct tree_descr *);
-extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
-extern void simple_release_fs(struct vfsmount **mount, int *count);
extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
loff_t *ppos, const void *from, size_t available);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
new file mode 100644
index 000000000000..1076a44db308
--- /dev/null
+++ b/include/linux/simplefs.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_SIMPLEFS_H
+#define _LINUX_SIMPLEFS_H
+
+#include <linux/fs.h>
+
+extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
+extern void simple_release_fs(struct vfsmount **mount, int *count);
+
+#endif
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d1398cef3b18..fc38a6f0fc11 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
config READABLE_ASM
bool "Generate readable assembler code"
- depends on DEBUG_KERNEL
- help
- Disable some compiler optimizations that tend to generate human unreadable
- assembler output. This may make the kernel slightly slower, but it helps
- to keep kernel developers who have to stare a lot at assembler listings
- sane.
+ depends on DEBUG_KERNEL
+ help
+ Disable some compiler optimizations that tend to generate human unreadable
+ assembler output. This may make the kernel slightly slower, but it helps
+ to keep kernel developers who have to stare a lot at assembler listings
+ sane.
+
+config DEBUG_FS
+ bool "Debug Filesystem"
+ select SIMPLEFS
config HEADERS_INSTALL
bool "Install uapi headers to usr/include"
diff --git a/security/Kconfig b/security/Kconfig
index cd3cc7da3a55..2c6713aa8b4f 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -39,6 +39,7 @@ config SECURITY_WRITABLE_HOOKS
config SECURITYFS
bool "Enable the securityfs filesystem"
+ select SIMPLEFS
help
This will build the securityfs filesystem. It is currently used by
various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM).
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 828bb1eb77ea..d62d3fca47f2 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -18,7 +18,7 @@
#include <linux/namei.h>
#include <linux/capability.h>
#include <linux/rcupdate.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/fs_context.h>
#include <linux/poll.h>
#include <linux/zlib.h>
@@ -2529,6 +2529,7 @@ static int aa_mk_null_file(struct dentry *parent)
struct vfsmount *mount;
struct dentry *dentry;
struct inode *inode;
+ int error;
mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
if (IS_ERR(mount))
diff --git a/security/inode.c b/security/inode.c
index 6c326939750d..a9a9ee4de21d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -12,7 +12,7 @@
/* #define DEBUG */
#include <linux/sysfs.h>
#include <linux/kobject.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/fs_context.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, linux-fsdevel, Manoj N. Kumar, Alexander Viro,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, Mike Marciniszyn, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
We will augment this family of functions with inode management. To avoid
littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
with a Kconfig symbol to enable them.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/Kconfig | 1 +
drivers/misc/cxl/api.c | 1 +
drivers/misc/ocxl/Kconfig | 1 +
drivers/scsi/cxlflash/ocxl_hw.c | 1 +
fs/Kconfig | 3 +++
fs/Kconfig.binfmt | 1 +
fs/Makefile | 1 +
fs/binfmt_misc.c | 2 +-
fs/configfs/Kconfig | 1 +
fs/configfs/mount.c | 2 +-
fs/debugfs/inode.c | 2 +-
fs/libfs.c | 36 +------------------------------
fs/simplefs.c | 38 +++++++++++++++++++++++++++++++++
fs/tracefs/inode.c | 2 +-
include/linux/fs.h | 2 --
include/linux/simplefs.h | 10 +++++++++
lib/Kconfig.debug | 16 ++++++++------
security/Kconfig | 1 +
security/apparmor/apparmorfs.c | 3 ++-
security/inode.c | 2 +-
22 files changed, 79 insertions(+), 50 deletions(-)
create mode 100644 fs/simplefs.c
create mode 100644 include/linux/simplefs.h
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 43594978958e..a6fe933de9da 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -14,6 +14,7 @@ menuconfig DRM
select I2C
select I2C_ALGOBIT
select DMA_SHARED_BUFFER
+ select SIMPLEFS
select SYNC_FILE
help
Kernel-level support for the Direct Rendering Infrastructure (DRI)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 7b1a628d1f6e..187a61091b5c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -27,7 +27,7 @@
*/
#include <linux/debugfs.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mount.h>
diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
index 39eec9031487..a62795079d9c 100644
--- a/drivers/misc/cxl/Kconfig
+++ b/drivers/misc/cxl/Kconfig
@@ -19,6 +19,7 @@ config CXL
select CXL_BASE
select CXL_AFU_DRIVER_OPS
select CXL_LIB
+ select SIMPLEFS
default m
help
Select this option to enable driver support for IBM Coherent
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index b493de962153..0b8f8de7475a 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -9,6 +9,7 @@
#include <misc/cxl.h>
#include <linux/module.h>
#include <linux/mount.h>
+#include <linux/simplefs.h>
#include <linux/pseudo_fs.h>
#include <linux/sched/mm.h>
#include <linux/mmu_context.h>
diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
index 2d2266c1439e..ddd9245fff3d 100644
--- a/drivers/misc/ocxl/Kconfig
+++ b/drivers/misc/ocxl/Kconfig
@@ -12,6 +12,7 @@ config OCXL
depends on PPC_POWERNV && PCI && EEH
select OCXL_BASE
select HOTPLUG_PCI_POWERNV
+ select SIMPLEFS
default m
help
Select this option to enable the ocxl driver for Open
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 7018cd802569..429f55651090 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -12,6 +12,7 @@
#include <linux/idr.h>
#include <linux/module.h>
#include <linux/mount.h>
+#include <linux/simplefs.h>
#include <linux/pseudo_fs.h>
#include <linux/poll.h>
#include <linux/sched/signal.h>
diff --git a/fs/Kconfig b/fs/Kconfig
index f08fbbfafd9a..a6795ae312a2 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -218,6 +218,9 @@ config HUGETLB_PAGE
config MEMFD_CREATE
def_bool TMPFS || HUGETLBFS
+config SIMPLEFS
+ bool
+
config ARCH_HAS_GIGANTIC_PAGE
bool
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 62dc4f577ba1..af7b765de4d3 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -176,6 +176,7 @@ config BINFMT_EM86
config BINFMT_MISC
tristate "Kernel support for MISC binaries"
+ select SIMPLEFS
---help---
If you say Y here, it will be possible to plug wrapper-driven binary
formats into the kernel. You will like this especially when you use
diff --git a/fs/Makefile b/fs/Makefile
index 2ce5112b02c8..c5c665984b9e 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_PROC_FS) += proc_namespace.o
obj-y += notify/
obj-$(CONFIG_EPOLL) += eventpoll.o
obj-y += anon_inodes.o
+obj-$(CONFIG_SIMPLEFS) += simplefs.o
obj-$(CONFIG_SIGNALFD) += signalfd.o
obj-$(CONFIG_TIMERFD) += timerfd.o
obj-$(CONFIG_EVENTFD) += eventfd.o
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index cdb45829354d..c764110f5f0b 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -25,7 +25,7 @@
#include <linux/mount.h>
#include <linux/fs_context.h>
#include <linux/syscalls.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/uaccess.h>
#include "internal.h"
diff --git a/fs/configfs/Kconfig b/fs/configfs/Kconfig
index 272b64456999..3b461e4e3989 100644
--- a/fs/configfs/Kconfig
+++ b/fs/configfs/Kconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config CONFIGFS_FS
tristate "Userspace-driven configuration filesystem"
+ select SIMPLEFS
select SYSFS
help
configfs is a RAM-based filesystem that provides the converse
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 0c6e8cf61953..331c2f064f02 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -10,7 +10,7 @@
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/fs_context.h>
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index b7f2e971ecbc..7b9fddced48f 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -13,7 +13,7 @@
#define pr_fmt(fmt) "debugfs: " fmt
#include <linux/module.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
diff --git a/fs/libfs.c b/fs/libfs.c
index 3759fbacf522..26ec729f7bcd 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -11,6 +11,7 @@
#include <linux/cred.h>
#include <linux/mount.h>
#include <linux/vfs.h>
+#include <linux/simplefs.h>
#include <linux/quotaops.h>
#include <linux/mutex.h>
#include <linux/namei.h>
@@ -663,41 +664,6 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
}
EXPORT_SYMBOL(simple_fill_super);
-static DEFINE_SPINLOCK(pin_fs_lock);
-
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt = NULL;
- spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
- spin_unlock(&pin_fs_lock);
- mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
- if (IS_ERR(mnt))
- return PTR_ERR(mnt);
- spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
- }
- mntget(*mount);
- ++*count;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
- return 0;
-}
-EXPORT_SYMBOL(simple_pin_fs);
-
-void simple_release_fs(struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt;
- spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
-}
-EXPORT_SYMBOL(simple_release_fs);
-
/**
* simple_read_from_buffer - copy data from the buffer to user space
* @to: the user space buffer to read to
diff --git a/fs/simplefs.c b/fs/simplefs.c
new file mode 100644
index 000000000000..226d18963801
--- /dev/null
+++ b/fs/simplefs.c
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <linux/simplefs.h>
+#include <linux/mount.h>
+
+static DEFINE_SPINLOCK(pin_fs_lock);
+
+int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+{
+ struct vfsmount *mnt = NULL;
+ spin_lock(&pin_fs_lock);
+ if (unlikely(!*mount)) {
+ spin_unlock(&pin_fs_lock);
+ mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
+ if (IS_ERR(mnt))
+ return PTR_ERR(mnt);
+ spin_lock(&pin_fs_lock);
+ if (!*mount)
+ *mount = mnt;
+ }
+ mntget(*mount);
+ ++*count;
+ spin_unlock(&pin_fs_lock);
+ mntput(mnt);
+ return 0;
+}
+EXPORT_SYMBOL(simple_pin_fs);
+
+void simple_release_fs(struct vfsmount **mount, int *count)
+{
+ struct vfsmount *mnt;
+ spin_lock(&pin_fs_lock);
+ mnt = *mount;
+ if (!--*count)
+ *mount = NULL;
+ spin_unlock(&pin_fs_lock);
+ mntput(mnt);
+}
+EXPORT_SYMBOL(simple_release_fs);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 0ee8c6dfb036..4353ca81e1d7 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -10,7 +10,7 @@
*/
#include <linux/module.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/mount.h>
#include <linux/kobject.h>
#include <linux/namei.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4f6f59b4f22a..55b679b89c8a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3363,8 +3363,6 @@ struct tree_descr { const char *name; const struct file_operations *ops; int mod
struct dentry *d_alloc_name(struct dentry *, const char *);
extern int simple_fill_super(struct super_block *, unsigned long,
const struct tree_descr *);
-extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
-extern void simple_release_fs(struct vfsmount **mount, int *count);
extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
loff_t *ppos, const void *from, size_t available);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
new file mode 100644
index 000000000000..1076a44db308
--- /dev/null
+++ b/include/linux/simplefs.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_SIMPLEFS_H
+#define _LINUX_SIMPLEFS_H
+
+#include <linux/fs.h>
+
+extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
+extern void simple_release_fs(struct vfsmount **mount, int *count);
+
+#endif
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d1398cef3b18..fc38a6f0fc11 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
config READABLE_ASM
bool "Generate readable assembler code"
- depends on DEBUG_KERNEL
- help
- Disable some compiler optimizations that tend to generate human unreadable
- assembler output. This may make the kernel slightly slower, but it helps
- to keep kernel developers who have to stare a lot at assembler listings
- sane.
+ depends on DEBUG_KERNEL
+ help
+ Disable some compiler optimizations that tend to generate human unreadable
+ assembler output. This may make the kernel slightly slower, but it helps
+ to keep kernel developers who have to stare a lot at assembler listings
+ sane.
+
+config DEBUG_FS
+ bool "Debug Filesystem"
+ select SIMPLEFS
config HEADERS_INSTALL
bool "Install uapi headers to usr/include"
diff --git a/security/Kconfig b/security/Kconfig
index cd3cc7da3a55..2c6713aa8b4f 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -39,6 +39,7 @@ config SECURITY_WRITABLE_HOOKS
config SECURITYFS
bool "Enable the securityfs filesystem"
+ select SIMPLEFS
help
This will build the securityfs filesystem. It is currently used by
various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM).
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 828bb1eb77ea..d62d3fca47f2 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -18,7 +18,7 @@
#include <linux/namei.h>
#include <linux/capability.h>
#include <linux/rcupdate.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/fs_context.h>
#include <linux/poll.h>
#include <linux/zlib.h>
@@ -2529,6 +2529,7 @@ static int aa_mk_null_file(struct dentry *parent)
struct vfsmount *mount;
struct dentry *dentry;
struct inode *inode;
+ int error;
mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
if (IS_ERR(mount))
diff --git a/security/inode.c b/security/inode.c
index 6c326939750d..a9a9ee4de21d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -12,7 +12,7 @@
/* #define DEBUG */
#include <linux/sysfs.h>
#include <linux/kobject.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/fs_context.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
We will augment this family of functions with inode management. To avoid
littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
with a Kconfig symbol to enable them.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/Kconfig | 1 +
drivers/misc/cxl/api.c | 1 +
drivers/misc/ocxl/Kconfig | 1 +
drivers/scsi/cxlflash/ocxl_hw.c | 1 +
fs/Kconfig | 3 +++
fs/Kconfig.binfmt | 1 +
fs/Makefile | 1 +
fs/binfmt_misc.c | 2 +-
fs/configfs/Kconfig | 1 +
fs/configfs/mount.c | 2 +-
fs/debugfs/inode.c | 2 +-
fs/libfs.c | 36 +------------------------------
fs/simplefs.c | 38 +++++++++++++++++++++++++++++++++
fs/tracefs/inode.c | 2 +-
include/linux/fs.h | 2 --
include/linux/simplefs.h | 10 +++++++++
lib/Kconfig.debug | 16 ++++++++------
security/Kconfig | 1 +
security/apparmor/apparmorfs.c | 3 ++-
security/inode.c | 2 +-
22 files changed, 79 insertions(+), 50 deletions(-)
create mode 100644 fs/simplefs.c
create mode 100644 include/linux/simplefs.h
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 43594978958e..a6fe933de9da 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -14,6 +14,7 @@ menuconfig DRM
select I2C
select I2C_ALGOBIT
select DMA_SHARED_BUFFER
+ select SIMPLEFS
select SYNC_FILE
help
Kernel-level support for the Direct Rendering Infrastructure (DRI)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 7b1a628d1f6e..187a61091b5c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -27,7 +27,7 @@
*/
#include <linux/debugfs.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mount.h>
diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
index 39eec9031487..a62795079d9c 100644
--- a/drivers/misc/cxl/Kconfig
+++ b/drivers/misc/cxl/Kconfig
@@ -19,6 +19,7 @@ config CXL
select CXL_BASE
select CXL_AFU_DRIVER_OPS
select CXL_LIB
+ select SIMPLEFS
default m
help
Select this option to enable driver support for IBM Coherent
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index b493de962153..0b8f8de7475a 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -9,6 +9,7 @@
#include <misc/cxl.h>
#include <linux/module.h>
#include <linux/mount.h>
+#include <linux/simplefs.h>
#include <linux/pseudo_fs.h>
#include <linux/sched/mm.h>
#include <linux/mmu_context.h>
diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
index 2d2266c1439e..ddd9245fff3d 100644
--- a/drivers/misc/ocxl/Kconfig
+++ b/drivers/misc/ocxl/Kconfig
@@ -12,6 +12,7 @@ config OCXL
depends on PPC_POWERNV && PCI && EEH
select OCXL_BASE
select HOTPLUG_PCI_POWERNV
+ select SIMPLEFS
default m
help
Select this option to enable the ocxl driver for Open
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 7018cd802569..429f55651090 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -12,6 +12,7 @@
#include <linux/idr.h>
#include <linux/module.h>
#include <linux/mount.h>
+#include <linux/simplefs.h>
#include <linux/pseudo_fs.h>
#include <linux/poll.h>
#include <linux/sched/signal.h>
diff --git a/fs/Kconfig b/fs/Kconfig
index f08fbbfafd9a..a6795ae312a2 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -218,6 +218,9 @@ config HUGETLB_PAGE
config MEMFD_CREATE
def_bool TMPFS || HUGETLBFS
+config SIMPLEFS
+ bool
+
config ARCH_HAS_GIGANTIC_PAGE
bool
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 62dc4f577ba1..af7b765de4d3 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -176,6 +176,7 @@ config BINFMT_EM86
config BINFMT_MISC
tristate "Kernel support for MISC binaries"
+ select SIMPLEFS
---help---
If you say Y here, it will be possible to plug wrapper-driven binary
formats into the kernel. You will like this especially when you use
diff --git a/fs/Makefile b/fs/Makefile
index 2ce5112b02c8..c5c665984b9e 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_PROC_FS) += proc_namespace.o
obj-y += notify/
obj-$(CONFIG_EPOLL) += eventpoll.o
obj-y += anon_inodes.o
+obj-$(CONFIG_SIMPLEFS) += simplefs.o
obj-$(CONFIG_SIGNALFD) += signalfd.o
obj-$(CONFIG_TIMERFD) += timerfd.o
obj-$(CONFIG_EVENTFD) += eventfd.o
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index cdb45829354d..c764110f5f0b 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -25,7 +25,7 @@
#include <linux/mount.h>
#include <linux/fs_context.h>
#include <linux/syscalls.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/uaccess.h>
#include "internal.h"
diff --git a/fs/configfs/Kconfig b/fs/configfs/Kconfig
index 272b64456999..3b461e4e3989 100644
--- a/fs/configfs/Kconfig
+++ b/fs/configfs/Kconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config CONFIGFS_FS
tristate "Userspace-driven configuration filesystem"
+ select SIMPLEFS
select SYSFS
help
configfs is a RAM-based filesystem that provides the converse
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 0c6e8cf61953..331c2f064f02 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -10,7 +10,7 @@
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/fs_context.h>
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index b7f2e971ecbc..7b9fddced48f 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -13,7 +13,7 @@
#define pr_fmt(fmt) "debugfs: " fmt
#include <linux/module.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
diff --git a/fs/libfs.c b/fs/libfs.c
index 3759fbacf522..26ec729f7bcd 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -11,6 +11,7 @@
#include <linux/cred.h>
#include <linux/mount.h>
#include <linux/vfs.h>
+#include <linux/simplefs.h>
#include <linux/quotaops.h>
#include <linux/mutex.h>
#include <linux/namei.h>
@@ -663,41 +664,6 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
}
EXPORT_SYMBOL(simple_fill_super);
-static DEFINE_SPINLOCK(pin_fs_lock);
-
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt = NULL;
- spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
- spin_unlock(&pin_fs_lock);
- mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
- if (IS_ERR(mnt))
- return PTR_ERR(mnt);
- spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
- }
- mntget(*mount);
- ++*count;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
- return 0;
-}
-EXPORT_SYMBOL(simple_pin_fs);
-
-void simple_release_fs(struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt;
- spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
-}
-EXPORT_SYMBOL(simple_release_fs);
-
/**
* simple_read_from_buffer - copy data from the buffer to user space
* @to: the user space buffer to read to
diff --git a/fs/simplefs.c b/fs/simplefs.c
new file mode 100644
index 000000000000..226d18963801
--- /dev/null
+++ b/fs/simplefs.c
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <linux/simplefs.h>
+#include <linux/mount.h>
+
+static DEFINE_SPINLOCK(pin_fs_lock);
+
+int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+{
+ struct vfsmount *mnt = NULL;
+ spin_lock(&pin_fs_lock);
+ if (unlikely(!*mount)) {
+ spin_unlock(&pin_fs_lock);
+ mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
+ if (IS_ERR(mnt))
+ return PTR_ERR(mnt);
+ spin_lock(&pin_fs_lock);
+ if (!*mount)
+ *mount = mnt;
+ }
+ mntget(*mount);
+ ++*count;
+ spin_unlock(&pin_fs_lock);
+ mntput(mnt);
+ return 0;
+}
+EXPORT_SYMBOL(simple_pin_fs);
+
+void simple_release_fs(struct vfsmount **mount, int *count)
+{
+ struct vfsmount *mnt;
+ spin_lock(&pin_fs_lock);
+ mnt = *mount;
+ if (!--*count)
+ *mount = NULL;
+ spin_unlock(&pin_fs_lock);
+ mntput(mnt);
+}
+EXPORT_SYMBOL(simple_release_fs);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 0ee8c6dfb036..4353ca81e1d7 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -10,7 +10,7 @@
*/
#include <linux/module.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/mount.h>
#include <linux/kobject.h>
#include <linux/namei.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4f6f59b4f22a..55b679b89c8a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3363,8 +3363,6 @@ struct tree_descr { const char *name; const struct file_operations *ops; int mod
struct dentry *d_alloc_name(struct dentry *, const char *);
extern int simple_fill_super(struct super_block *, unsigned long,
const struct tree_descr *);
-extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
-extern void simple_release_fs(struct vfsmount **mount, int *count);
extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
loff_t *ppos, const void *from, size_t available);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
new file mode 100644
index 000000000000..1076a44db308
--- /dev/null
+++ b/include/linux/simplefs.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_SIMPLEFS_H
+#define _LINUX_SIMPLEFS_H
+
+#include <linux/fs.h>
+
+extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
+extern void simple_release_fs(struct vfsmount **mount, int *count);
+
+#endif
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d1398cef3b18..fc38a6f0fc11 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
config READABLE_ASM
bool "Generate readable assembler code"
- depends on DEBUG_KERNEL
- help
- Disable some compiler optimizations that tend to generate human unreadable
- assembler output. This may make the kernel slightly slower, but it helps
- to keep kernel developers who have to stare a lot at assembler listings
- sane.
+ depends on DEBUG_KERNEL
+ help
+ Disable some compiler optimizations that tend to generate human unreadable
+ assembler output. This may make the kernel slightly slower, but it helps
+ to keep kernel developers who have to stare a lot at assembler listings
+ sane.
+
+config DEBUG_FS
+ bool "Debug Filesystem"
+ select SIMPLEFS
config HEADERS_INSTALL
bool "Install uapi headers to usr/include"
diff --git a/security/Kconfig b/security/Kconfig
index cd3cc7da3a55..2c6713aa8b4f 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -39,6 +39,7 @@ config SECURITY_WRITABLE_HOOKS
config SECURITYFS
bool "Enable the securityfs filesystem"
+ select SIMPLEFS
help
This will build the securityfs filesystem. It is currently used by
various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM).
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 828bb1eb77ea..d62d3fca47f2 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -18,7 +18,7 @@
#include <linux/namei.h>
#include <linux/capability.h>
#include <linux/rcupdate.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/fs_context.h>
#include <linux/poll.h>
#include <linux/zlib.h>
@@ -2529,6 +2529,7 @@ static int aa_mk_null_file(struct dentry *parent)
struct vfsmount *mount;
struct dentry *dentry;
struct inode *inode;
+ int error;
mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
if (IS_ERR(mount))
diff --git a/security/inode.c b/security/inode.c
index 6c326939750d..a9a9ee4de21d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -12,7 +12,7 @@
/* #define DEBUG */
#include <linux/sysfs.h>
#include <linux/kobject.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/fs_context.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
--
2.25.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh
We will augment this family of functions with inode management. To avoid
littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
with a Kconfig symbol to enable them.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/Kconfig | 1 +
drivers/misc/cxl/api.c | 1 +
drivers/misc/ocxl/Kconfig | 1 +
drivers/scsi/cxlflash/ocxl_hw.c | 1 +
fs/Kconfig | 3 +++
fs/Kconfig.binfmt | 1 +
fs/Makefile | 1 +
fs/binfmt_misc.c | 2 +-
fs/configfs/Kconfig | 1 +
fs/configfs/mount.c | 2 +-
fs/debugfs/inode.c | 2 +-
fs/libfs.c | 36 +------------------------------
fs/simplefs.c | 38 +++++++++++++++++++++++++++++++++
fs/tracefs/inode.c | 2 +-
include/linux/fs.h | 2 --
include/linux/simplefs.h | 10 +++++++++
lib/Kconfig.debug | 16 ++++++++------
security/Kconfig | 1 +
security/apparmor/apparmorfs.c | 3 ++-
security/inode.c | 2 +-
22 files changed, 79 insertions(+), 50 deletions(-)
create mode 100644 fs/simplefs.c
create mode 100644 include/linux/simplefs.h
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 43594978958e..a6fe933de9da 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -14,6 +14,7 @@ menuconfig DRM
select I2C
select I2C_ALGOBIT
select DMA_SHARED_BUFFER
+ select SIMPLEFS
select SYNC_FILE
help
Kernel-level support for the Direct Rendering Infrastructure (DRI)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 7b1a628d1f6e..187a61091b5c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -27,7 +27,7 @@
*/
#include <linux/debugfs.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mount.h>
diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
index 39eec9031487..a62795079d9c 100644
--- a/drivers/misc/cxl/Kconfig
+++ b/drivers/misc/cxl/Kconfig
@@ -19,6 +19,7 @@ config CXL
select CXL_BASE
select CXL_AFU_DRIVER_OPS
select CXL_LIB
+ select SIMPLEFS
default m
help
Select this option to enable driver support for IBM Coherent
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index b493de962153..0b8f8de7475a 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -9,6 +9,7 @@
#include <misc/cxl.h>
#include <linux/module.h>
#include <linux/mount.h>
+#include <linux/simplefs.h>
#include <linux/pseudo_fs.h>
#include <linux/sched/mm.h>
#include <linux/mmu_context.h>
diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
index 2d2266c1439e..ddd9245fff3d 100644
--- a/drivers/misc/ocxl/Kconfig
+++ b/drivers/misc/ocxl/Kconfig
@@ -12,6 +12,7 @@ config OCXL
depends on PPC_POWERNV && PCI && EEH
select OCXL_BASE
select HOTPLUG_PCI_POWERNV
+ select SIMPLEFS
default m
help
Select this option to enable the ocxl driver for Open
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 7018cd802569..429f55651090 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -12,6 +12,7 @@
#include <linux/idr.h>
#include <linux/module.h>
#include <linux/mount.h>
+#include <linux/simplefs.h>
#include <linux/pseudo_fs.h>
#include <linux/poll.h>
#include <linux/sched/signal.h>
diff --git a/fs/Kconfig b/fs/Kconfig
index f08fbbfafd9a..a6795ae312a2 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -218,6 +218,9 @@ config HUGETLB_PAGE
config MEMFD_CREATE
def_bool TMPFS || HUGETLBFS
+config SIMPLEFS
+ bool
+
config ARCH_HAS_GIGANTIC_PAGE
bool
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 62dc4f577ba1..af7b765de4d3 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -176,6 +176,7 @@ config BINFMT_EM86
config BINFMT_MISC
tristate "Kernel support for MISC binaries"
+ select SIMPLEFS
---help---
If you say Y here, it will be possible to plug wrapper-driven binary
formats into the kernel. You will like this especially when you use
diff --git a/fs/Makefile b/fs/Makefile
index 2ce5112b02c8..c5c665984b9e 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_PROC_FS) += proc_namespace.o
obj-y += notify/
obj-$(CONFIG_EPOLL) += eventpoll.o
obj-y += anon_inodes.o
+obj-$(CONFIG_SIMPLEFS) += simplefs.o
obj-$(CONFIG_SIGNALFD) += signalfd.o
obj-$(CONFIG_TIMERFD) += timerfd.o
obj-$(CONFIG_EVENTFD) += eventfd.o
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index cdb45829354d..c764110f5f0b 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -25,7 +25,7 @@
#include <linux/mount.h>
#include <linux/fs_context.h>
#include <linux/syscalls.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/uaccess.h>
#include "internal.h"
diff --git a/fs/configfs/Kconfig b/fs/configfs/Kconfig
index 272b64456999..3b461e4e3989 100644
--- a/fs/configfs/Kconfig
+++ b/fs/configfs/Kconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config CONFIGFS_FS
tristate "Userspace-driven configuration filesystem"
+ select SIMPLEFS
select SYSFS
help
configfs is a RAM-based filesystem that provides the converse
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 0c6e8cf61953..331c2f064f02 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -10,7 +10,7 @@
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/fs_context.h>
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index b7f2e971ecbc..7b9fddced48f 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -13,7 +13,7 @@
#define pr_fmt(fmt) "debugfs: " fmt
#include <linux/module.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
diff --git a/fs/libfs.c b/fs/libfs.c
index 3759fbacf522..26ec729f7bcd 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -11,6 +11,7 @@
#include <linux/cred.h>
#include <linux/mount.h>
#include <linux/vfs.h>
+#include <linux/simplefs.h>
#include <linux/quotaops.h>
#include <linux/mutex.h>
#include <linux/namei.h>
@@ -663,41 +664,6 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
}
EXPORT_SYMBOL(simple_fill_super);
-static DEFINE_SPINLOCK(pin_fs_lock);
-
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt = NULL;
- spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
- spin_unlock(&pin_fs_lock);
- mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
- if (IS_ERR(mnt))
- return PTR_ERR(mnt);
- spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
- }
- mntget(*mount);
- ++*count;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
- return 0;
-}
-EXPORT_SYMBOL(simple_pin_fs);
-
-void simple_release_fs(struct vfsmount **mount, int *count)
-{
- struct vfsmount *mnt;
- spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
- spin_unlock(&pin_fs_lock);
- mntput(mnt);
-}
-EXPORT_SYMBOL(simple_release_fs);
-
/**
* simple_read_from_buffer - copy data from the buffer to user space
* @to: the user space buffer to read to
diff --git a/fs/simplefs.c b/fs/simplefs.c
new file mode 100644
index 000000000000..226d18963801
--- /dev/null
+++ b/fs/simplefs.c
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <linux/simplefs.h>
+#include <linux/mount.h>
+
+static DEFINE_SPINLOCK(pin_fs_lock);
+
+int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+{
+ struct vfsmount *mnt = NULL;
+ spin_lock(&pin_fs_lock);
+ if (unlikely(!*mount)) {
+ spin_unlock(&pin_fs_lock);
+ mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
+ if (IS_ERR(mnt))
+ return PTR_ERR(mnt);
+ spin_lock(&pin_fs_lock);
+ if (!*mount)
+ *mount = mnt;
+ }
+ mntget(*mount);
+ ++*count;
+ spin_unlock(&pin_fs_lock);
+ mntput(mnt);
+ return 0;
+}
+EXPORT_SYMBOL(simple_pin_fs);
+
+void simple_release_fs(struct vfsmount **mount, int *count)
+{
+ struct vfsmount *mnt;
+ spin_lock(&pin_fs_lock);
+ mnt = *mount;
+ if (!--*count)
+ *mount = NULL;
+ spin_unlock(&pin_fs_lock);
+ mntput(mnt);
+}
+EXPORT_SYMBOL(simple_release_fs);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 0ee8c6dfb036..4353ca81e1d7 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -10,7 +10,7 @@
*/
#include <linux/module.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/mount.h>
#include <linux/kobject.h>
#include <linux/namei.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4f6f59b4f22a..55b679b89c8a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3363,8 +3363,6 @@ struct tree_descr { const char *name; const struct file_operations *ops; int mod
struct dentry *d_alloc_name(struct dentry *, const char *);
extern int simple_fill_super(struct super_block *, unsigned long,
const struct tree_descr *);
-extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
-extern void simple_release_fs(struct vfsmount **mount, int *count);
extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
loff_t *ppos, const void *from, size_t available);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
new file mode 100644
index 000000000000..1076a44db308
--- /dev/null
+++ b/include/linux/simplefs.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_SIMPLEFS_H
+#define _LINUX_SIMPLEFS_H
+
+#include <linux/fs.h>
+
+extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
+extern void simple_release_fs(struct vfsmount **mount, int *count);
+
+#endif
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d1398cef3b18..fc38a6f0fc11 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
config READABLE_ASM
bool "Generate readable assembler code"
- depends on DEBUG_KERNEL
- help
- Disable some compiler optimizations that tend to generate human unreadable
- assembler output. This may make the kernel slightly slower, but it helps
- to keep kernel developers who have to stare a lot at assembler listings
- sane.
+ depends on DEBUG_KERNEL
+ help
+ Disable some compiler optimizations that tend to generate human unreadable
+ assembler output. This may make the kernel slightly slower, but it helps
+ to keep kernel developers who have to stare a lot at assembler listings
+ sane.
+
+config DEBUG_FS
+ bool "Debug Filesystem"
+ select SIMPLEFS
config HEADERS_INSTALL
bool "Install uapi headers to usr/include"
diff --git a/security/Kconfig b/security/Kconfig
index cd3cc7da3a55..2c6713aa8b4f 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -39,6 +39,7 @@ config SECURITY_WRITABLE_HOOKS
config SECURITYFS
bool "Enable the securityfs filesystem"
+ select SIMPLEFS
help
This will build the securityfs filesystem. It is currently used by
various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM).
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 828bb1eb77ea..d62d3fca47f2 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -18,7 +18,7 @@
#include <linux/namei.h>
#include <linux/capability.h>
#include <linux/rcupdate.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/fs_context.h>
#include <linux/poll.h>
#include <linux/zlib.h>
@@ -2529,6 +2529,7 @@ static int aa_mk_null_file(struct dentry *parent)
struct vfsmount *mount;
struct dentry *dentry;
struct inode *inode;
+ int error;
mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
if (IS_ERR(mount))
diff --git a/security/inode.c b/security/inode.c
index 6c326939750d..a9a9ee4de21d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -12,7 +12,7 @@
/* #define DEBUG */
#include <linux/sysfs.h>
#include <linux/kobject.h>
-#include <linux/fs.h>
+#include <linux/simplefs.h>
#include <linux/fs_context.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
Simplify passing the count and mount to simple_pin_fs and simple_release_fs,
in preparation for adding more high level operations to the simplefs API.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 11 +++++------
drivers/misc/cxl/api.c | 13 ++++++-------
drivers/scsi/cxlflash/ocxl_hw.c | 14 ++++++--------
fs/binfmt_misc.c | 9 ++++-----
fs/configfs/mount.c | 10 ++++------
fs/debugfs/inode.c | 22 ++++++++++------------
fs/simplefs.c | 20 ++++++++++----------
fs/tracefs/inode.c | 18 ++++++++----------
include/linux/simplefs.h | 9 +++++++--
security/apparmor/apparmorfs.c | 25 ++++++++++++-------------
security/inode.c | 11 +++++------
11 files changed, 77 insertions(+), 85 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 187a61091b5c..b4b357725be2 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -514,8 +514,7 @@ EXPORT_SYMBOL(drm_dev_unplug);
* iput(), but this way you'd end up with a new vfsmount for each inode.
*/
-static int drm_fs_cnt;
-static struct vfsmount *drm_fs_mnt;
+static struct simple_fs drm_fs;
static int drm_fs_init_fs_context(struct fs_context *fc)
{
@@ -534,15 +533,15 @@ static struct inode *drm_fs_inode_new(void)
struct inode *inode;
int r;
- r = simple_pin_fs(&drm_fs_type, &drm_fs_mnt, &drm_fs_cnt);
+ r = simple_pin_fs(&drm_fs, &drm_fs_type);
if (r < 0) {
DRM_ERROR("Cannot mount pseudo fs: %d\n", r);
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs_mnt->mnt_sb);
+ inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
if (IS_ERR(inode))
- simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
+ simple_release_fs(&drm_fs);
return inode;
}
@@ -551,7 +550,7 @@ static void drm_fs_inode_free(struct inode *inode)
{
if (inode) {
iput(inode);
- simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
+ simple_release_fs(&drm_fs);
}
}
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 0b8f8de7475a..6c6566d8bc17 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -32,8 +32,7 @@
#define CXL_PSEUDO_FS_MAGIC 0x1697697f
-static int cxl_fs_cnt;
-static struct vfsmount *cxl_vfs_mount;
+static struct simple_fs cxl_fs;
static int cxl_fs_init_fs_context(struct fs_context *fc)
{
@@ -51,7 +50,7 @@ static struct file_system_type cxl_fs_type = {
void cxl_release_mapping(struct cxl_context *ctx)
{
if (ctx->kernelapi && ctx->mapping)
- simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt);
+ simple_release_fs(&cxl_fs);
}
static struct file *cxl_getfile(const char *name,
@@ -67,20 +66,20 @@ static struct file *cxl_getfile(const char *name,
if (fops->owner && !try_module_get(fops->owner))
return ERR_PTR(-ENOENT);
- rc = simple_pin_fs(&cxl_fs_type, &cxl_vfs_mount, &cxl_fs_cnt);
+ rc = simple_pin_fs(&cxl_fs, &cxl_fs_type);
if (rc < 0) {
pr_err("Cannot mount cxl pseudo filesystem: %d\n", rc);
file = ERR_PTR(rc);
goto err_module;
}
- inode = alloc_anon_inode(cxl_vfs_mount->mnt_sb);
+ inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
}
- file = alloc_file_pseudo(inode, cxl_vfs_mount, name,
+ file = alloc_file_pseudo(inode, cxl_fs.mount, name,
flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file))
goto err_inode;
@@ -92,7 +91,7 @@ static struct file *cxl_getfile(const char *name,
err_inode:
iput(inode);
err_fs:
- simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt);
+ simple_release_fs(&cxl_fs);
err_module:
module_put(fops->owner);
return file;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 429f55651090..23afde0c6c0e 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -30,8 +30,7 @@
#define OCXLFLASH_FS_MAGIC 0x1697698f
-static int ocxlflash_fs_cnt;
-static struct vfsmount *ocxlflash_vfs_mount;
+static struct simple_fs ocxlflash_fs;
static int ocxlflash_fs_init_fs_context(struct fs_context *fc)
{
@@ -52,7 +51,7 @@ static struct file_system_type ocxlflash_fs_type = {
static void ocxlflash_release_mapping(struct ocxlflash_context *ctx)
{
if (ctx->mapping)
- simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
+ simple_release_fs(&ocxlflash_fs);
ctx->mapping = NULL;
}
@@ -80,15 +79,14 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err1;
}
- rc = simple_pin_fs(&ocxlflash_fs_type, &ocxlflash_vfs_mount,
- &ocxlflash_fs_cnt);
+ rc = simple_pin_fs(&ocxlflash_fs, &ocxlflash_fs_type);
if (unlikely(rc < 0)) {
dev_err(dev, "%s: Cannot mount ocxlflash pseudofs rc=%d\n",
__func__, rc);
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_vfs_mount->mnt_sb);
+ inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
@@ -96,7 +94,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err3;
}
- file = alloc_file_pseudo(inode, ocxlflash_vfs_mount, name,
+ file = alloc_file_pseudo(inode, ocxlflash_fs.mount, name,
flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file)) {
rc = PTR_ERR(file);
@@ -111,7 +109,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
err4:
iput(inode);
err3:
- simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
+ simple_release_fs(&ocxlflash_fs);
err2:
module_put(fops->owner);
err1:
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index c764110f5f0b..475096a02a1a 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -64,8 +64,7 @@ typedef struct {
static DEFINE_RWLOCK(entries_lock);
static struct file_system_type bm_fs_type;
-static struct vfsmount *bm_mnt;
-static int entry_count;
+static struct simple_fs bm_fs;
/*
* Max length of the register string. Determined by:
@@ -623,7 +622,7 @@ static void kill_node(Node *e)
drop_nlink(d_inode(dentry));
d_drop(dentry);
dput(dentry);
- simple_release_fs(&bm_mnt, &entry_count);
+ simple_release_fs(&bm_fs);
}
/* /<entry> */
@@ -718,7 +717,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (!inode)
goto out2;
- err = simple_pin_fs(&bm_fs_type, &bm_mnt, &entry_count);
+ err = simple_pin_fs(&bm_fs, &bm_fs_type);
if (err) {
iput(inode);
inode = NULL;
@@ -732,7 +731,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (IS_ERR(f)) {
err = PTR_ERR(f);
pr_notice("register: failed to install interpreter file %s\n", e->interpreter);
- simple_release_fs(&bm_mnt, &entry_count);
+ simple_release_fs(&bm_fs);
iput(inode);
inode = NULL;
goto out2;
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 331c2f064f02..a671974f5b6f 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -24,9 +24,8 @@
/* Random magic number */
#define CONFIGFS_MAGIC 0x62656570
-static struct vfsmount *configfs_mount = NULL;
+static struct simple_fs configfs_fs;
struct kmem_cache *configfs_dir_cachep;
-static int configfs_mnt_count = 0;
static void configfs_free_inode(struct inode *inode)
@@ -123,14 +122,13 @@ MODULE_ALIAS_FS("configfs");
struct dentry *configfs_pin_fs(void)
{
- int err = simple_pin_fs(&configfs_fs_type, &configfs_mount,
- &configfs_mnt_count);
- return err ? ERR_PTR(err) : configfs_mount->mnt_root;
+ int err = simple_pin_fs(&configfs_fs, &configfs_fs_type);
+ return err ? ERR_PTR(err) : configfs_fs.mount->mnt_root;
}
void configfs_release_fs(void)
{
- simple_release_fs(&configfs_mount, &configfs_mnt_count);
+ simple_release_fs(&configfs_fs);
}
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 7b9fddced48f..ea54efc74c0d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -32,8 +32,7 @@
#define DEBUGFS_DEFAULT_MODE 0700
-static struct vfsmount *debugfs_mount;
-static int debugfs_mount_count;
+static struct simple_fs debugfs;
static bool debugfs_registered;
/*
@@ -297,7 +296,7 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
return NULL;
if (!parent)
- parent = debugfs_mount->mnt_root;
+ parent = debugfs.mount->mnt_root;
dentry = lookup_positive_unlocked(name, parent, strlen(name));
if (IS_ERR(dentry))
@@ -316,8 +315,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(parent))
return parent;
- error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
- &debugfs_mount_count);
+ error = simple_pin_fs(&debugfs, &debug_fs_type);
if (error) {
pr_err("Unable to pin filesystem for file '%s'\n", name);
return ERR_PTR(error);
@@ -329,7 +327,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
* have around.
*/
if (!parent)
- parent = debugfs_mount->mnt_root;
+ parent = debugfs.mount->mnt_root;
inode_lock(d_inode(parent));
if (unlikely(IS_DEADDIR(d_inode(parent))))
@@ -349,7 +347,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(dentry)) {
inode_unlock(d_inode(parent));
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
return dentry;
@@ -359,7 +357,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
{
inode_unlock(d_inode(dentry->d_parent));
dput(dentry);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
return ERR_PTR(-ENOMEM);
}
@@ -676,9 +674,9 @@ static void __debugfs_file_removed(struct dentry *dentry)
static void remove_one(struct dentry *victim)
{
- if (d_is_reg(victim))
+ if (d_is_reg(victim))
__debugfs_file_removed(victim);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
/**
@@ -699,9 +697,9 @@ void debugfs_remove(struct dentry *dentry)
if (IS_ERR_OR_NULL(dentry))
return;
- simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count);
+ simple_pin_fs(&debugfs, &debug_fs_type);
simple_recursive_removal(dentry, remove_one);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
EXPORT_SYMBOL_GPL(debugfs_remove);
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 226d18963801..790d8beb9cc3 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -4,34 +4,34 @@
static DEFINE_SPINLOCK(pin_fs_lock);
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+int simple_pin_fs(struct simple_fs *fs, struct file_system_type *type)
{
struct vfsmount *mnt = NULL;
spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
+ if (unlikely(!fs->mount)) {
spin_unlock(&pin_fs_lock);
mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
if (IS_ERR(mnt))
return PTR_ERR(mnt);
spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
+ if (!fs->mount)
+ fs->mount = mnt;
}
- mntget(*mount);
- ++*count;
+ mntget(fs->mount);
+ ++fs->count;
spin_unlock(&pin_fs_lock);
mntput(mnt);
return 0;
}
EXPORT_SYMBOL(simple_pin_fs);
-void simple_release_fs(struct vfsmount **mount, int *count)
+void simple_release_fs(struct simple_fs *fs)
{
struct vfsmount *mnt;
spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
+ mnt = fs->mount;
+ if (!--fs->count)
+ fs->mount = NULL;
spin_unlock(&pin_fs_lock);
mntput(mnt);
}
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 4353ca81e1d7..40ccfe737c3a 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -24,8 +24,7 @@
#define TRACEFS_DEFAULT_MODE 0700
-static struct vfsmount *tracefs_mount;
-static int tracefs_mount_count;
+static struct simple_fs tracefs;
static bool tracefs_registered;
static ssize_t default_read_file(struct file *file, char __user *buf,
@@ -316,8 +315,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
pr_debug("tracefs: creating file '%s'\n",name);
- error = simple_pin_fs(&trace_fs_type, &tracefs_mount,
- &tracefs_mount_count);
+ error = simple_pin_fs(&tracefs, &trace_fs_type);
if (error)
return ERR_PTR(error);
@@ -327,7 +325,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
* have around.
*/
if (!parent)
- parent = tracefs_mount->mnt_root;
+ parent = tracefs.mount->mnt_root;
inode_lock(parent->d_inode);
if (unlikely(IS_DEADDIR(parent->d_inode)))
@@ -341,7 +339,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(dentry)) {
inode_unlock(parent->d_inode);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
return dentry;
@@ -351,7 +349,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
{
inode_unlock(dentry->d_parent->d_inode);
dput(dentry);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
return NULL;
}
@@ -504,7 +502,7 @@ __init struct dentry *tracefs_create_instance_dir(const char *name,
static void remove_one(struct dentry *victim)
{
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
/**
@@ -520,9 +518,9 @@ void tracefs_remove(struct dentry *dentry)
if (IS_ERR_OR_NULL(dentry))
return;
- simple_pin_fs(&trace_fs_type, &tracefs_mount, &tracefs_mount_count);
+ simple_pin_fs(&tracefs, &trace_fs_type);
simple_recursive_removal(dentry, remove_one);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
/**
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 1076a44db308..18010414a16f 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -4,7 +4,12 @@
#include <linux/fs.h>
-extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
-extern void simple_release_fs(struct vfsmount **mount, int *count);
+struct simple_fs {
+ struct vfsmount *mount;
+ int count;
+};
+
+extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
+extern void simple_release_fs(struct simple_fs *);
#endif
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index d62d3fca47f2..75d70e6ba0a0 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -140,8 +140,7 @@ static int mangle_name(const char *name, char *target)
*/
#define AAFS_NAME "apparmorfs"
-static struct vfsmount *aafs_mnt;
-static int aafs_count;
+static struct simple_fs aafs;
static int aafs_show_path(struct seq_file *seq, struct dentry *dentry)
@@ -273,7 +272,7 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
if (!(mode & S_IFMT))
mode = (mode & S_IALLUGO) | S_IFREG;
- error = simple_pin_fs(&aafs_ops, &aafs_mnt, &aafs_count);
+ error = simple_pin_fs(&aafs, &aafs_ops);
if (error)
return ERR_PTR(error);
@@ -303,7 +302,7 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
fail_lock:
inode_unlock(dir);
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
return ERR_PTR(error);
}
@@ -395,7 +394,7 @@ static void aafs_remove(struct dentry *dentry)
dput(dentry);
}
inode_unlock(dir);
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
}
@@ -1824,7 +1823,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode)
* for pin_fs
*/
inode_unlock(dir);
- error = simple_pin_fs(&aafs_ops, &aafs_mnt, &aafs_count);
+ error = simple_pin_fs(&aafs, &aafs_ops);
mutex_lock_nested(&parent->lock, parent->level);
inode_lock_nested(dir, I_MUTEX_PARENT);
if (error)
@@ -1845,7 +1844,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode)
aa_put_ns(ns); /* list ref remains */
out_pin:
if (error)
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
out:
mutex_unlock(&parent->lock);
aa_put_ns(parent);
@@ -2580,7 +2579,7 @@ static const char *policy_get_link(struct dentry *dentry,
return ERR_PTR(-ECHILD);
ns = aa_get_current_ns();
- path.mnt = mntget(aafs_mnt);
+ path.mnt = mntget(aafs.mount);
path.dentry = dget(ns_dir(ns));
error = nd_jump_link(&path);
aa_put_ns(ns);
@@ -2631,10 +2630,10 @@ static int __init aa_create_aafs(void)
}
/* setup apparmorfs used to virtualize policy/ */
- aafs_mnt = kern_mount(&aafs_ops);
- if (IS_ERR(aafs_mnt))
+ aafs.mount = kern_mount(&aafs_ops);
+ if (IS_ERR(aafs.mount))
panic("can't set apparmorfs up\n");
- aafs_mnt->mnt_sb->s_flags &= ~SB_NOUSER;
+ aafs.mount->mnt_sb->s_flags &= ~SB_NOUSER;
/* Populate fs tree. */
error = entry_create_dir(&aa_sfs_entry, NULL);
@@ -2667,8 +2666,8 @@ static int __init aa_create_aafs(void)
/* policy tree referenced by magic policy symlink */
mutex_lock_nested(&root_ns->lock, root_ns->level);
- error = __aafs_ns_mkdir(root_ns, aafs_mnt->mnt_root, ".policy",
- aafs_mnt->mnt_root);
+ error = __aafs_ns_mkdir(root_ns, aafs.mount->mnt_root, ".policy",
+ aafs.mount->mnt_root);
mutex_unlock(&root_ns->lock);
if (error)
goto error;
diff --git a/security/inode.c b/security/inode.c
index a9a9ee4de21d..0fcd03299e0d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -22,8 +22,7 @@
#include <linux/lsm_hooks.h>
#include <linux/magic.h>
-static struct vfsmount *mount;
-static int mount_count;
+static struct simple_fs securityfs;
static void securityfs_free_inode(struct inode *inode)
{
@@ -118,12 +117,12 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
pr_debug("securityfs: creating file '%s'\n",name);
- error = simple_pin_fs(&fs_type, &mount, &mount_count);
+ error = simple_pin_fs(&securityfs, &fs_type);
if (error)
return ERR_PTR(error);
if (!parent)
- parent = mount->mnt_root;
+ parent = securityfs.mount->mnt_root;
dir = d_inode(parent);
@@ -168,7 +167,7 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
dentry = ERR_PTR(error);
out:
inode_unlock(dir);
- simple_release_fs(&mount, &mount_count);
+ simple_release_fs(&securityfs);
return dentry;
}
@@ -309,7 +308,7 @@ void securityfs_remove(struct dentry *dentry)
dput(dentry);
}
inode_unlock(dir);
- simple_release_fs(&mount, &mount_count);
+ simple_release_fs(&securityfs);
}
EXPORT_SYMBOL_GPL(securityfs_remove);
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Paolo Bonzini, Emanuele Giuseppe Esposito, Jeremy Kerr,
Arnd Bergmann, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
Simplify passing the count and mount to simple_pin_fs and simple_release_fs,
in preparation for adding more high level operations to the simplefs API.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 11 +++++------
drivers/misc/cxl/api.c | 13 ++++++-------
drivers/scsi/cxlflash/ocxl_hw.c | 14 ++++++--------
fs/binfmt_misc.c | 9 ++++-----
fs/configfs/mount.c | 10 ++++------
fs/debugfs/inode.c | 22 ++++++++++------------
fs/simplefs.c | 20 ++++++++++----------
fs/tracefs/inode.c | 18 ++++++++----------
include/linux/simplefs.h | 9 +++++++--
security/apparmor/apparmorfs.c | 25 ++++++++++++-------------
security/inode.c | 11 +++++------
11 files changed, 77 insertions(+), 85 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 187a61091b5c..b4b357725be2 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -514,8 +514,7 @@ EXPORT_SYMBOL(drm_dev_unplug);
* iput(), but this way you'd end up with a new vfsmount for each inode.
*/
-static int drm_fs_cnt;
-static struct vfsmount *drm_fs_mnt;
+static struct simple_fs drm_fs;
static int drm_fs_init_fs_context(struct fs_context *fc)
{
@@ -534,15 +533,15 @@ static struct inode *drm_fs_inode_new(void)
struct inode *inode;
int r;
- r = simple_pin_fs(&drm_fs_type, &drm_fs_mnt, &drm_fs_cnt);
+ r = simple_pin_fs(&drm_fs, &drm_fs_type);
if (r < 0) {
DRM_ERROR("Cannot mount pseudo fs: %d\n", r);
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs_mnt->mnt_sb);
+ inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
if (IS_ERR(inode))
- simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
+ simple_release_fs(&drm_fs);
return inode;
}
@@ -551,7 +550,7 @@ static void drm_fs_inode_free(struct inode *inode)
{
if (inode) {
iput(inode);
- simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
+ simple_release_fs(&drm_fs);
}
}
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 0b8f8de7475a..6c6566d8bc17 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -32,8 +32,7 @@
#define CXL_PSEUDO_FS_MAGIC 0x1697697f
-static int cxl_fs_cnt;
-static struct vfsmount *cxl_vfs_mount;
+static struct simple_fs cxl_fs;
static int cxl_fs_init_fs_context(struct fs_context *fc)
{
@@ -51,7 +50,7 @@ static struct file_system_type cxl_fs_type = {
void cxl_release_mapping(struct cxl_context *ctx)
{
if (ctx->kernelapi && ctx->mapping)
- simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt);
+ simple_release_fs(&cxl_fs);
}
static struct file *cxl_getfile(const char *name,
@@ -67,20 +66,20 @@ static struct file *cxl_getfile(const char *name,
if (fops->owner && !try_module_get(fops->owner))
return ERR_PTR(-ENOENT);
- rc = simple_pin_fs(&cxl_fs_type, &cxl_vfs_mount, &cxl_fs_cnt);
+ rc = simple_pin_fs(&cxl_fs, &cxl_fs_type);
if (rc < 0) {
pr_err("Cannot mount cxl pseudo filesystem: %d\n", rc);
file = ERR_PTR(rc);
goto err_module;
}
- inode = alloc_anon_inode(cxl_vfs_mount->mnt_sb);
+ inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
}
- file = alloc_file_pseudo(inode, cxl_vfs_mount, name,
+ file = alloc_file_pseudo(inode, cxl_fs.mount, name,
flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file))
goto err_inode;
@@ -92,7 +91,7 @@ static struct file *cxl_getfile(const char *name,
err_inode:
iput(inode);
err_fs:
- simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt);
+ simple_release_fs(&cxl_fs);
err_module:
module_put(fops->owner);
return file;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 429f55651090..23afde0c6c0e 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -30,8 +30,7 @@
#define OCXLFLASH_FS_MAGIC 0x1697698f
-static int ocxlflash_fs_cnt;
-static struct vfsmount *ocxlflash_vfs_mount;
+static struct simple_fs ocxlflash_fs;
static int ocxlflash_fs_init_fs_context(struct fs_context *fc)
{
@@ -52,7 +51,7 @@ static struct file_system_type ocxlflash_fs_type = {
static void ocxlflash_release_mapping(struct ocxlflash_context *ctx)
{
if (ctx->mapping)
- simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
+ simple_release_fs(&ocxlflash_fs);
ctx->mapping = NULL;
}
@@ -80,15 +79,14 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err1;
}
- rc = simple_pin_fs(&ocxlflash_fs_type, &ocxlflash_vfs_mount,
- &ocxlflash_fs_cnt);
+ rc = simple_pin_fs(&ocxlflash_fs, &ocxlflash_fs_type);
if (unlikely(rc < 0)) {
dev_err(dev, "%s: Cannot mount ocxlflash pseudofs rc=%d\n",
__func__, rc);
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_vfs_mount->mnt_sb);
+ inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
@@ -96,7 +94,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err3;
}
- file = alloc_file_pseudo(inode, ocxlflash_vfs_mount, name,
+ file = alloc_file_pseudo(inode, ocxlflash_fs.mount, name,
flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file)) {
rc = PTR_ERR(file);
@@ -111,7 +109,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
err4:
iput(inode);
err3:
- simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
+ simple_release_fs(&ocxlflash_fs);
err2:
module_put(fops->owner);
err1:
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index c764110f5f0b..475096a02a1a 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -64,8 +64,7 @@ typedef struct {
static DEFINE_RWLOCK(entries_lock);
static struct file_system_type bm_fs_type;
-static struct vfsmount *bm_mnt;
-static int entry_count;
+static struct simple_fs bm_fs;
/*
* Max length of the register string. Determined by:
@@ -623,7 +622,7 @@ static void kill_node(Node *e)
drop_nlink(d_inode(dentry));
d_drop(dentry);
dput(dentry);
- simple_release_fs(&bm_mnt, &entry_count);
+ simple_release_fs(&bm_fs);
}
/* /<entry> */
@@ -718,7 +717,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (!inode)
goto out2;
- err = simple_pin_fs(&bm_fs_type, &bm_mnt, &entry_count);
+ err = simple_pin_fs(&bm_fs, &bm_fs_type);
if (err) {
iput(inode);
inode = NULL;
@@ -732,7 +731,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (IS_ERR(f)) {
err = PTR_ERR(f);
pr_notice("register: failed to install interpreter file %s\n", e->interpreter);
- simple_release_fs(&bm_mnt, &entry_count);
+ simple_release_fs(&bm_fs);
iput(inode);
inode = NULL;
goto out2;
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 331c2f064f02..a671974f5b6f 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -24,9 +24,8 @@
/* Random magic number */
#define CONFIGFS_MAGIC 0x62656570
-static struct vfsmount *configfs_mount = NULL;
+static struct simple_fs configfs_fs;
struct kmem_cache *configfs_dir_cachep;
-static int configfs_mnt_count = 0;
static void configfs_free_inode(struct inode *inode)
@@ -123,14 +122,13 @@ MODULE_ALIAS_FS("configfs");
struct dentry *configfs_pin_fs(void)
{
- int err = simple_pin_fs(&configfs_fs_type, &configfs_mount,
- &configfs_mnt_count);
- return err ? ERR_PTR(err) : configfs_mount->mnt_root;
+ int err = simple_pin_fs(&configfs_fs, &configfs_fs_type);
+ return err ? ERR_PTR(err) : configfs_fs.mount->mnt_root;
}
void configfs_release_fs(void)
{
- simple_release_fs(&configfs_mount, &configfs_mnt_count);
+ simple_release_fs(&configfs_fs);
}
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 7b9fddced48f..ea54efc74c0d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -32,8 +32,7 @@
#define DEBUGFS_DEFAULT_MODE 0700
-static struct vfsmount *debugfs_mount;
-static int debugfs_mount_count;
+static struct simple_fs debugfs;
static bool debugfs_registered;
/*
@@ -297,7 +296,7 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
return NULL;
if (!parent)
- parent = debugfs_mount->mnt_root;
+ parent = debugfs.mount->mnt_root;
dentry = lookup_positive_unlocked(name, parent, strlen(name));
if (IS_ERR(dentry))
@@ -316,8 +315,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(parent))
return parent;
- error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
- &debugfs_mount_count);
+ error = simple_pin_fs(&debugfs, &debug_fs_type);
if (error) {
pr_err("Unable to pin filesystem for file '%s'\n", name);
return ERR_PTR(error);
@@ -329,7 +327,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
* have around.
*/
if (!parent)
- parent = debugfs_mount->mnt_root;
+ parent = debugfs.mount->mnt_root;
inode_lock(d_inode(parent));
if (unlikely(IS_DEADDIR(d_inode(parent))))
@@ -349,7 +347,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(dentry)) {
inode_unlock(d_inode(parent));
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
return dentry;
@@ -359,7 +357,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
{
inode_unlock(d_inode(dentry->d_parent));
dput(dentry);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
return ERR_PTR(-ENOMEM);
}
@@ -676,9 +674,9 @@ static void __debugfs_file_removed(struct dentry *dentry)
static void remove_one(struct dentry *victim)
{
- if (d_is_reg(victim))
+ if (d_is_reg(victim))
__debugfs_file_removed(victim);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
/**
@@ -699,9 +697,9 @@ void debugfs_remove(struct dentry *dentry)
if (IS_ERR_OR_NULL(dentry))
return;
- simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count);
+ simple_pin_fs(&debugfs, &debug_fs_type);
simple_recursive_removal(dentry, remove_one);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
EXPORT_SYMBOL_GPL(debugfs_remove);
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 226d18963801..790d8beb9cc3 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -4,34 +4,34 @@
static DEFINE_SPINLOCK(pin_fs_lock);
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+int simple_pin_fs(struct simple_fs *fs, struct file_system_type *type)
{
struct vfsmount *mnt = NULL;
spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
+ if (unlikely(!fs->mount)) {
spin_unlock(&pin_fs_lock);
mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
if (IS_ERR(mnt))
return PTR_ERR(mnt);
spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
+ if (!fs->mount)
+ fs->mount = mnt;
}
- mntget(*mount);
- ++*count;
+ mntget(fs->mount);
+ ++fs->count;
spin_unlock(&pin_fs_lock);
mntput(mnt);
return 0;
}
EXPORT_SYMBOL(simple_pin_fs);
-void simple_release_fs(struct vfsmount **mount, int *count)
+void simple_release_fs(struct simple_fs *fs)
{
struct vfsmount *mnt;
spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
+ mnt = fs->mount;
+ if (!--fs->count)
+ fs->mount = NULL;
spin_unlock(&pin_fs_lock);
mntput(mnt);
}
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 4353ca81e1d7..40ccfe737c3a 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -24,8 +24,7 @@
#define TRACEFS_DEFAULT_MODE 0700
-static struct vfsmount *tracefs_mount;
-static int tracefs_mount_count;
+static struct simple_fs tracefs;
static bool tracefs_registered;
static ssize_t default_read_file(struct file *file, char __user *buf,
@@ -316,8 +315,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
pr_debug("tracefs: creating file '%s'\n",name);
- error = simple_pin_fs(&trace_fs_type, &tracefs_mount,
- &tracefs_mount_count);
+ error = simple_pin_fs(&tracefs, &trace_fs_type);
if (error)
return ERR_PTR(error);
@@ -327,7 +325,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
* have around.
*/
if (!parent)
- parent = tracefs_mount->mnt_root;
+ parent = tracefs.mount->mnt_root;
inode_lock(parent->d_inode);
if (unlikely(IS_DEADDIR(parent->d_inode)))
@@ -341,7 +339,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(dentry)) {
inode_unlock(parent->d_inode);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
return dentry;
@@ -351,7 +349,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
{
inode_unlock(dentry->d_parent->d_inode);
dput(dentry);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
return NULL;
}
@@ -504,7 +502,7 @@ __init struct dentry *tracefs_create_instance_dir(const char *name,
static void remove_one(struct dentry *victim)
{
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
/**
@@ -520,9 +518,9 @@ void tracefs_remove(struct dentry *dentry)
if (IS_ERR_OR_NULL(dentry))
return;
- simple_pin_fs(&trace_fs_type, &tracefs_mount, &tracefs_mount_count);
+ simple_pin_fs(&tracefs, &trace_fs_type);
simple_recursive_removal(dentry, remove_one);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
/**
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 1076a44db308..18010414a16f 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -4,7 +4,12 @@
#include <linux/fs.h>
-extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
-extern void simple_release_fs(struct vfsmount **mount, int *count);
+struct simple_fs {
+ struct vfsmount *mount;
+ int count;
+};
+
+extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
+extern void simple_release_fs(struct simple_fs *);
#endif
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index d62d3fca47f2..75d70e6ba0a0 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -140,8 +140,7 @@ static int mangle_name(const char *name, char *target)
*/
#define AAFS_NAME "apparmorfs"
-static struct vfsmount *aafs_mnt;
-static int aafs_count;
+static struct simple_fs aafs;
static int aafs_show_path(struct seq_file *seq, struct dentry *dentry)
@@ -273,7 +272,7 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
if (!(mode & S_IFMT))
mode = (mode & S_IALLUGO) | S_IFREG;
- error = simple_pin_fs(&aafs_ops, &aafs_mnt, &aafs_count);
+ error = simple_pin_fs(&aafs, &aafs_ops);
if (error)
return ERR_PTR(error);
@@ -303,7 +302,7 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
fail_lock:
inode_unlock(dir);
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
return ERR_PTR(error);
}
@@ -395,7 +394,7 @@ static void aafs_remove(struct dentry *dentry)
dput(dentry);
}
inode_unlock(dir);
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
}
@@ -1824,7 +1823,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode)
* for pin_fs
*/
inode_unlock(dir);
- error = simple_pin_fs(&aafs_ops, &aafs_mnt, &aafs_count);
+ error = simple_pin_fs(&aafs, &aafs_ops);
mutex_lock_nested(&parent->lock, parent->level);
inode_lock_nested(dir, I_MUTEX_PARENT);
if (error)
@@ -1845,7 +1844,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode)
aa_put_ns(ns); /* list ref remains */
out_pin:
if (error)
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
out:
mutex_unlock(&parent->lock);
aa_put_ns(parent);
@@ -2580,7 +2579,7 @@ static const char *policy_get_link(struct dentry *dentry,
return ERR_PTR(-ECHILD);
ns = aa_get_current_ns();
- path.mnt = mntget(aafs_mnt);
+ path.mnt = mntget(aafs.mount);
path.dentry = dget(ns_dir(ns));
error = nd_jump_link(&path);
aa_put_ns(ns);
@@ -2631,10 +2630,10 @@ static int __init aa_create_aafs(void)
}
/* setup apparmorfs used to virtualize policy/ */
- aafs_mnt = kern_mount(&aafs_ops);
- if (IS_ERR(aafs_mnt))
+ aafs.mount = kern_mount(&aafs_ops);
+ if (IS_ERR(aafs.mount))
panic("can't set apparmorfs up\n");
- aafs_mnt->mnt_sb->s_flags &= ~SB_NOUSER;
+ aafs.mount->mnt_sb->s_flags &= ~SB_NOUSER;
/* Populate fs tree. */
error = entry_create_dir(&aa_sfs_entry, NULL);
@@ -2667,8 +2666,8 @@ static int __init aa_create_aafs(void)
/* policy tree referenced by magic policy symlink */
mutex_lock_nested(&root_ns->lock, root_ns->level);
- error = __aafs_ns_mkdir(root_ns, aafs_mnt->mnt_root, ".policy",
- aafs_mnt->mnt_root);
+ error = __aafs_ns_mkdir(root_ns, aafs.mount->mnt_root, ".policy",
+ aafs.mount->mnt_root);
mutex_unlock(&root_ns->lock);
if (error)
goto error;
diff --git a/security/inode.c b/security/inode.c
index a9a9ee4de21d..0fcd03299e0d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -22,8 +22,7 @@
#include <linux/lsm_hooks.h>
#include <linux/magic.h>
-static struct vfsmount *mount;
-static int mount_count;
+static struct simple_fs securityfs;
static void securityfs_free_inode(struct inode *inode)
{
@@ -118,12 +117,12 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
pr_debug("securityfs: creating file '%s'\n",name);
- error = simple_pin_fs(&fs_type, &mount, &mount_count);
+ error = simple_pin_fs(&securityfs, &fs_type);
if (error)
return ERR_PTR(error);
if (!parent)
- parent = mount->mnt_root;
+ parent = securityfs.mount->mnt_root;
dir = d_inode(parent);
@@ -168,7 +167,7 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
dentry = ERR_PTR(error);
out:
inode_unlock(dir);
- simple_release_fs(&mount, &mount_count);
+ simple_release_fs(&securityfs);
return dentry;
}
@@ -309,7 +308,7 @@ void securityfs_remove(struct dentry *dentry)
dput(dentry);
}
inode_unlock(dir);
- simple_release_fs(&mount, &mount_count);
+ simple_release_fs(&securityfs);
}
EXPORT_SYMBOL_GPL(securityfs_remove);
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, linux-fsdevel, Manoj N. Kumar, Alexander Viro,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, Mike Marciniszyn, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
Simplify passing the count and mount to simple_pin_fs and simple_release_fs,
in preparation for adding more high level operations to the simplefs API.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 11 +++++------
drivers/misc/cxl/api.c | 13 ++++++-------
drivers/scsi/cxlflash/ocxl_hw.c | 14 ++++++--------
fs/binfmt_misc.c | 9 ++++-----
fs/configfs/mount.c | 10 ++++------
fs/debugfs/inode.c | 22 ++++++++++------------
fs/simplefs.c | 20 ++++++++++----------
fs/tracefs/inode.c | 18 ++++++++----------
include/linux/simplefs.h | 9 +++++++--
security/apparmor/apparmorfs.c | 25 ++++++++++++-------------
security/inode.c | 11 +++++------
11 files changed, 77 insertions(+), 85 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 187a61091b5c..b4b357725be2 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -514,8 +514,7 @@ EXPORT_SYMBOL(drm_dev_unplug);
* iput(), but this way you'd end up with a new vfsmount for each inode.
*/
-static int drm_fs_cnt;
-static struct vfsmount *drm_fs_mnt;
+static struct simple_fs drm_fs;
static int drm_fs_init_fs_context(struct fs_context *fc)
{
@@ -534,15 +533,15 @@ static struct inode *drm_fs_inode_new(void)
struct inode *inode;
int r;
- r = simple_pin_fs(&drm_fs_type, &drm_fs_mnt, &drm_fs_cnt);
+ r = simple_pin_fs(&drm_fs, &drm_fs_type);
if (r < 0) {
DRM_ERROR("Cannot mount pseudo fs: %d\n", r);
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs_mnt->mnt_sb);
+ inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
if (IS_ERR(inode))
- simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
+ simple_release_fs(&drm_fs);
return inode;
}
@@ -551,7 +550,7 @@ static void drm_fs_inode_free(struct inode *inode)
{
if (inode) {
iput(inode);
- simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
+ simple_release_fs(&drm_fs);
}
}
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 0b8f8de7475a..6c6566d8bc17 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -32,8 +32,7 @@
#define CXL_PSEUDO_FS_MAGIC 0x1697697f
-static int cxl_fs_cnt;
-static struct vfsmount *cxl_vfs_mount;
+static struct simple_fs cxl_fs;
static int cxl_fs_init_fs_context(struct fs_context *fc)
{
@@ -51,7 +50,7 @@ static struct file_system_type cxl_fs_type = {
void cxl_release_mapping(struct cxl_context *ctx)
{
if (ctx->kernelapi && ctx->mapping)
- simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt);
+ simple_release_fs(&cxl_fs);
}
static struct file *cxl_getfile(const char *name,
@@ -67,20 +66,20 @@ static struct file *cxl_getfile(const char *name,
if (fops->owner && !try_module_get(fops->owner))
return ERR_PTR(-ENOENT);
- rc = simple_pin_fs(&cxl_fs_type, &cxl_vfs_mount, &cxl_fs_cnt);
+ rc = simple_pin_fs(&cxl_fs, &cxl_fs_type);
if (rc < 0) {
pr_err("Cannot mount cxl pseudo filesystem: %d\n", rc);
file = ERR_PTR(rc);
goto err_module;
}
- inode = alloc_anon_inode(cxl_vfs_mount->mnt_sb);
+ inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
}
- file = alloc_file_pseudo(inode, cxl_vfs_mount, name,
+ file = alloc_file_pseudo(inode, cxl_fs.mount, name,
flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file))
goto err_inode;
@@ -92,7 +91,7 @@ static struct file *cxl_getfile(const char *name,
err_inode:
iput(inode);
err_fs:
- simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt);
+ simple_release_fs(&cxl_fs);
err_module:
module_put(fops->owner);
return file;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 429f55651090..23afde0c6c0e 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -30,8 +30,7 @@
#define OCXLFLASH_FS_MAGIC 0x1697698f
-static int ocxlflash_fs_cnt;
-static struct vfsmount *ocxlflash_vfs_mount;
+static struct simple_fs ocxlflash_fs;
static int ocxlflash_fs_init_fs_context(struct fs_context *fc)
{
@@ -52,7 +51,7 @@ static struct file_system_type ocxlflash_fs_type = {
static void ocxlflash_release_mapping(struct ocxlflash_context *ctx)
{
if (ctx->mapping)
- simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
+ simple_release_fs(&ocxlflash_fs);
ctx->mapping = NULL;
}
@@ -80,15 +79,14 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err1;
}
- rc = simple_pin_fs(&ocxlflash_fs_type, &ocxlflash_vfs_mount,
- &ocxlflash_fs_cnt);
+ rc = simple_pin_fs(&ocxlflash_fs, &ocxlflash_fs_type);
if (unlikely(rc < 0)) {
dev_err(dev, "%s: Cannot mount ocxlflash pseudofs rc=%d\n",
__func__, rc);
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_vfs_mount->mnt_sb);
+ inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
@@ -96,7 +94,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err3;
}
- file = alloc_file_pseudo(inode, ocxlflash_vfs_mount, name,
+ file = alloc_file_pseudo(inode, ocxlflash_fs.mount, name,
flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file)) {
rc = PTR_ERR(file);
@@ -111,7 +109,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
err4:
iput(inode);
err3:
- simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
+ simple_release_fs(&ocxlflash_fs);
err2:
module_put(fops->owner);
err1:
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index c764110f5f0b..475096a02a1a 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -64,8 +64,7 @@ typedef struct {
static DEFINE_RWLOCK(entries_lock);
static struct file_system_type bm_fs_type;
-static struct vfsmount *bm_mnt;
-static int entry_count;
+static struct simple_fs bm_fs;
/*
* Max length of the register string. Determined by:
@@ -623,7 +622,7 @@ static void kill_node(Node *e)
drop_nlink(d_inode(dentry));
d_drop(dentry);
dput(dentry);
- simple_release_fs(&bm_mnt, &entry_count);
+ simple_release_fs(&bm_fs);
}
/* /<entry> */
@@ -718,7 +717,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (!inode)
goto out2;
- err = simple_pin_fs(&bm_fs_type, &bm_mnt, &entry_count);
+ err = simple_pin_fs(&bm_fs, &bm_fs_type);
if (err) {
iput(inode);
inode = NULL;
@@ -732,7 +731,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (IS_ERR(f)) {
err = PTR_ERR(f);
pr_notice("register: failed to install interpreter file %s\n", e->interpreter);
- simple_release_fs(&bm_mnt, &entry_count);
+ simple_release_fs(&bm_fs);
iput(inode);
inode = NULL;
goto out2;
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 331c2f064f02..a671974f5b6f 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -24,9 +24,8 @@
/* Random magic number */
#define CONFIGFS_MAGIC 0x62656570
-static struct vfsmount *configfs_mount = NULL;
+static struct simple_fs configfs_fs;
struct kmem_cache *configfs_dir_cachep;
-static int configfs_mnt_count = 0;
static void configfs_free_inode(struct inode *inode)
@@ -123,14 +122,13 @@ MODULE_ALIAS_FS("configfs");
struct dentry *configfs_pin_fs(void)
{
- int err = simple_pin_fs(&configfs_fs_type, &configfs_mount,
- &configfs_mnt_count);
- return err ? ERR_PTR(err) : configfs_mount->mnt_root;
+ int err = simple_pin_fs(&configfs_fs, &configfs_fs_type);
+ return err ? ERR_PTR(err) : configfs_fs.mount->mnt_root;
}
void configfs_release_fs(void)
{
- simple_release_fs(&configfs_mount, &configfs_mnt_count);
+ simple_release_fs(&configfs_fs);
}
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 7b9fddced48f..ea54efc74c0d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -32,8 +32,7 @@
#define DEBUGFS_DEFAULT_MODE 0700
-static struct vfsmount *debugfs_mount;
-static int debugfs_mount_count;
+static struct simple_fs debugfs;
static bool debugfs_registered;
/*
@@ -297,7 +296,7 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
return NULL;
if (!parent)
- parent = debugfs_mount->mnt_root;
+ parent = debugfs.mount->mnt_root;
dentry = lookup_positive_unlocked(name, parent, strlen(name));
if (IS_ERR(dentry))
@@ -316,8 +315,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(parent))
return parent;
- error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
- &debugfs_mount_count);
+ error = simple_pin_fs(&debugfs, &debug_fs_type);
if (error) {
pr_err("Unable to pin filesystem for file '%s'\n", name);
return ERR_PTR(error);
@@ -329,7 +327,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
* have around.
*/
if (!parent)
- parent = debugfs_mount->mnt_root;
+ parent = debugfs.mount->mnt_root;
inode_lock(d_inode(parent));
if (unlikely(IS_DEADDIR(d_inode(parent))))
@@ -349,7 +347,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(dentry)) {
inode_unlock(d_inode(parent));
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
return dentry;
@@ -359,7 +357,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
{
inode_unlock(d_inode(dentry->d_parent));
dput(dentry);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
return ERR_PTR(-ENOMEM);
}
@@ -676,9 +674,9 @@ static void __debugfs_file_removed(struct dentry *dentry)
static void remove_one(struct dentry *victim)
{
- if (d_is_reg(victim))
+ if (d_is_reg(victim))
__debugfs_file_removed(victim);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
/**
@@ -699,9 +697,9 @@ void debugfs_remove(struct dentry *dentry)
if (IS_ERR_OR_NULL(dentry))
return;
- simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count);
+ simple_pin_fs(&debugfs, &debug_fs_type);
simple_recursive_removal(dentry, remove_one);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
EXPORT_SYMBOL_GPL(debugfs_remove);
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 226d18963801..790d8beb9cc3 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -4,34 +4,34 @@
static DEFINE_SPINLOCK(pin_fs_lock);
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+int simple_pin_fs(struct simple_fs *fs, struct file_system_type *type)
{
struct vfsmount *mnt = NULL;
spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
+ if (unlikely(!fs->mount)) {
spin_unlock(&pin_fs_lock);
mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
if (IS_ERR(mnt))
return PTR_ERR(mnt);
spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
+ if (!fs->mount)
+ fs->mount = mnt;
}
- mntget(*mount);
- ++*count;
+ mntget(fs->mount);
+ ++fs->count;
spin_unlock(&pin_fs_lock);
mntput(mnt);
return 0;
}
EXPORT_SYMBOL(simple_pin_fs);
-void simple_release_fs(struct vfsmount **mount, int *count)
+void simple_release_fs(struct simple_fs *fs)
{
struct vfsmount *mnt;
spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
+ mnt = fs->mount;
+ if (!--fs->count)
+ fs->mount = NULL;
spin_unlock(&pin_fs_lock);
mntput(mnt);
}
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 4353ca81e1d7..40ccfe737c3a 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -24,8 +24,7 @@
#define TRACEFS_DEFAULT_MODE 0700
-static struct vfsmount *tracefs_mount;
-static int tracefs_mount_count;
+static struct simple_fs tracefs;
static bool tracefs_registered;
static ssize_t default_read_file(struct file *file, char __user *buf,
@@ -316,8 +315,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
pr_debug("tracefs: creating file '%s'\n",name);
- error = simple_pin_fs(&trace_fs_type, &tracefs_mount,
- &tracefs_mount_count);
+ error = simple_pin_fs(&tracefs, &trace_fs_type);
if (error)
return ERR_PTR(error);
@@ -327,7 +325,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
* have around.
*/
if (!parent)
- parent = tracefs_mount->mnt_root;
+ parent = tracefs.mount->mnt_root;
inode_lock(parent->d_inode);
if (unlikely(IS_DEADDIR(parent->d_inode)))
@@ -341,7 +339,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(dentry)) {
inode_unlock(parent->d_inode);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
return dentry;
@@ -351,7 +349,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
{
inode_unlock(dentry->d_parent->d_inode);
dput(dentry);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
return NULL;
}
@@ -504,7 +502,7 @@ __init struct dentry *tracefs_create_instance_dir(const char *name,
static void remove_one(struct dentry *victim)
{
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
/**
@@ -520,9 +518,9 @@ void tracefs_remove(struct dentry *dentry)
if (IS_ERR_OR_NULL(dentry))
return;
- simple_pin_fs(&trace_fs_type, &tracefs_mount, &tracefs_mount_count);
+ simple_pin_fs(&tracefs, &trace_fs_type);
simple_recursive_removal(dentry, remove_one);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
/**
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 1076a44db308..18010414a16f 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -4,7 +4,12 @@
#include <linux/fs.h>
-extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
-extern void simple_release_fs(struct vfsmount **mount, int *count);
+struct simple_fs {
+ struct vfsmount *mount;
+ int count;
+};
+
+extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
+extern void simple_release_fs(struct simple_fs *);
#endif
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index d62d3fca47f2..75d70e6ba0a0 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -140,8 +140,7 @@ static int mangle_name(const char *name, char *target)
*/
#define AAFS_NAME "apparmorfs"
-static struct vfsmount *aafs_mnt;
-static int aafs_count;
+static struct simple_fs aafs;
static int aafs_show_path(struct seq_file *seq, struct dentry *dentry)
@@ -273,7 +272,7 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
if (!(mode & S_IFMT))
mode = (mode & S_IALLUGO) | S_IFREG;
- error = simple_pin_fs(&aafs_ops, &aafs_mnt, &aafs_count);
+ error = simple_pin_fs(&aafs, &aafs_ops);
if (error)
return ERR_PTR(error);
@@ -303,7 +302,7 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
fail_lock:
inode_unlock(dir);
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
return ERR_PTR(error);
}
@@ -395,7 +394,7 @@ static void aafs_remove(struct dentry *dentry)
dput(dentry);
}
inode_unlock(dir);
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
}
@@ -1824,7 +1823,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode)
* for pin_fs
*/
inode_unlock(dir);
- error = simple_pin_fs(&aafs_ops, &aafs_mnt, &aafs_count);
+ error = simple_pin_fs(&aafs, &aafs_ops);
mutex_lock_nested(&parent->lock, parent->level);
inode_lock_nested(dir, I_MUTEX_PARENT);
if (error)
@@ -1845,7 +1844,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode)
aa_put_ns(ns); /* list ref remains */
out_pin:
if (error)
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
out:
mutex_unlock(&parent->lock);
aa_put_ns(parent);
@@ -2580,7 +2579,7 @@ static const char *policy_get_link(struct dentry *dentry,
return ERR_PTR(-ECHILD);
ns = aa_get_current_ns();
- path.mnt = mntget(aafs_mnt);
+ path.mnt = mntget(aafs.mount);
path.dentry = dget(ns_dir(ns));
error = nd_jump_link(&path);
aa_put_ns(ns);
@@ -2631,10 +2630,10 @@ static int __init aa_create_aafs(void)
}
/* setup apparmorfs used to virtualize policy/ */
- aafs_mnt = kern_mount(&aafs_ops);
- if (IS_ERR(aafs_mnt))
+ aafs.mount = kern_mount(&aafs_ops);
+ if (IS_ERR(aafs.mount))
panic("can't set apparmorfs up\n");
- aafs_mnt->mnt_sb->s_flags &= ~SB_NOUSER;
+ aafs.mount->mnt_sb->s_flags &= ~SB_NOUSER;
/* Populate fs tree. */
error = entry_create_dir(&aa_sfs_entry, NULL);
@@ -2667,8 +2666,8 @@ static int __init aa_create_aafs(void)
/* policy tree referenced by magic policy symlink */
mutex_lock_nested(&root_ns->lock, root_ns->level);
- error = __aafs_ns_mkdir(root_ns, aafs_mnt->mnt_root, ".policy",
- aafs_mnt->mnt_root);
+ error = __aafs_ns_mkdir(root_ns, aafs.mount->mnt_root, ".policy",
+ aafs.mount->mnt_root);
mutex_unlock(&root_ns->lock);
if (error)
goto error;
diff --git a/security/inode.c b/security/inode.c
index a9a9ee4de21d..0fcd03299e0d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -22,8 +22,7 @@
#include <linux/lsm_hooks.h>
#include <linux/magic.h>
-static struct vfsmount *mount;
-static int mount_count;
+static struct simple_fs securityfs;
static void securityfs_free_inode(struct inode *inode)
{
@@ -118,12 +117,12 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
pr_debug("securityfs: creating file '%s'\n",name);
- error = simple_pin_fs(&fs_type, &mount, &mount_count);
+ error = simple_pin_fs(&securityfs, &fs_type);
if (error)
return ERR_PTR(error);
if (!parent)
- parent = mount->mnt_root;
+ parent = securityfs.mount->mnt_root;
dir = d_inode(parent);
@@ -168,7 +167,7 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
dentry = ERR_PTR(error);
out:
inode_unlock(dir);
- simple_release_fs(&mount, &mount_count);
+ simple_release_fs(&securityfs);
return dentry;
}
@@ -309,7 +308,7 @@ void securityfs_remove(struct dentry *dentry)
dput(dentry);
}
inode_unlock(dir);
- simple_release_fs(&mount, &mount_count);
+ simple_release_fs(&securityfs);
}
EXPORT_SYMBOL_GPL(securityfs_remove);
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
Simplify passing the count and mount to simple_pin_fs and simple_release_fs,
in preparation for adding more high level operations to the simplefs API.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 11 +++++------
drivers/misc/cxl/api.c | 13 ++++++-------
drivers/scsi/cxlflash/ocxl_hw.c | 14 ++++++--------
fs/binfmt_misc.c | 9 ++++-----
fs/configfs/mount.c | 10 ++++------
fs/debugfs/inode.c | 22 ++++++++++------------
fs/simplefs.c | 20 ++++++++++----------
fs/tracefs/inode.c | 18 ++++++++----------
include/linux/simplefs.h | 9 +++++++--
security/apparmor/apparmorfs.c | 25 ++++++++++++-------------
security/inode.c | 11 +++++------
11 files changed, 77 insertions(+), 85 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 187a61091b5c..b4b357725be2 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -514,8 +514,7 @@ EXPORT_SYMBOL(drm_dev_unplug);
* iput(), but this way you'd end up with a new vfsmount for each inode.
*/
-static int drm_fs_cnt;
-static struct vfsmount *drm_fs_mnt;
+static struct simple_fs drm_fs;
static int drm_fs_init_fs_context(struct fs_context *fc)
{
@@ -534,15 +533,15 @@ static struct inode *drm_fs_inode_new(void)
struct inode *inode;
int r;
- r = simple_pin_fs(&drm_fs_type, &drm_fs_mnt, &drm_fs_cnt);
+ r = simple_pin_fs(&drm_fs, &drm_fs_type);
if (r < 0) {
DRM_ERROR("Cannot mount pseudo fs: %d\n", r);
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs_mnt->mnt_sb);
+ inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
if (IS_ERR(inode))
- simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
+ simple_release_fs(&drm_fs);
return inode;
}
@@ -551,7 +550,7 @@ static void drm_fs_inode_free(struct inode *inode)
{
if (inode) {
iput(inode);
- simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
+ simple_release_fs(&drm_fs);
}
}
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 0b8f8de7475a..6c6566d8bc17 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -32,8 +32,7 @@
#define CXL_PSEUDO_FS_MAGIC 0x1697697f
-static int cxl_fs_cnt;
-static struct vfsmount *cxl_vfs_mount;
+static struct simple_fs cxl_fs;
static int cxl_fs_init_fs_context(struct fs_context *fc)
{
@@ -51,7 +50,7 @@ static struct file_system_type cxl_fs_type = {
void cxl_release_mapping(struct cxl_context *ctx)
{
if (ctx->kernelapi && ctx->mapping)
- simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt);
+ simple_release_fs(&cxl_fs);
}
static struct file *cxl_getfile(const char *name,
@@ -67,20 +66,20 @@ static struct file *cxl_getfile(const char *name,
if (fops->owner && !try_module_get(fops->owner))
return ERR_PTR(-ENOENT);
- rc = simple_pin_fs(&cxl_fs_type, &cxl_vfs_mount, &cxl_fs_cnt);
+ rc = simple_pin_fs(&cxl_fs, &cxl_fs_type);
if (rc < 0) {
pr_err("Cannot mount cxl pseudo filesystem: %d\n", rc);
file = ERR_PTR(rc);
goto err_module;
}
- inode = alloc_anon_inode(cxl_vfs_mount->mnt_sb);
+ inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
}
- file = alloc_file_pseudo(inode, cxl_vfs_mount, name,
+ file = alloc_file_pseudo(inode, cxl_fs.mount, name,
flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file))
goto err_inode;
@@ -92,7 +91,7 @@ static struct file *cxl_getfile(const char *name,
err_inode:
iput(inode);
err_fs:
- simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt);
+ simple_release_fs(&cxl_fs);
err_module:
module_put(fops->owner);
return file;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 429f55651090..23afde0c6c0e 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -30,8 +30,7 @@
#define OCXLFLASH_FS_MAGIC 0x1697698f
-static int ocxlflash_fs_cnt;
-static struct vfsmount *ocxlflash_vfs_mount;
+static struct simple_fs ocxlflash_fs;
static int ocxlflash_fs_init_fs_context(struct fs_context *fc)
{
@@ -52,7 +51,7 @@ static struct file_system_type ocxlflash_fs_type = {
static void ocxlflash_release_mapping(struct ocxlflash_context *ctx)
{
if (ctx->mapping)
- simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
+ simple_release_fs(&ocxlflash_fs);
ctx->mapping = NULL;
}
@@ -80,15 +79,14 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err1;
}
- rc = simple_pin_fs(&ocxlflash_fs_type, &ocxlflash_vfs_mount,
- &ocxlflash_fs_cnt);
+ rc = simple_pin_fs(&ocxlflash_fs, &ocxlflash_fs_type);
if (unlikely(rc < 0)) {
dev_err(dev, "%s: Cannot mount ocxlflash pseudofs rc=%d\n",
__func__, rc);
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_vfs_mount->mnt_sb);
+ inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
@@ -96,7 +94,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err3;
}
- file = alloc_file_pseudo(inode, ocxlflash_vfs_mount, name,
+ file = alloc_file_pseudo(inode, ocxlflash_fs.mount, name,
flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file)) {
rc = PTR_ERR(file);
@@ -111,7 +109,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
err4:
iput(inode);
err3:
- simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
+ simple_release_fs(&ocxlflash_fs);
err2:
module_put(fops->owner);
err1:
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index c764110f5f0b..475096a02a1a 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -64,8 +64,7 @@ typedef struct {
static DEFINE_RWLOCK(entries_lock);
static struct file_system_type bm_fs_type;
-static struct vfsmount *bm_mnt;
-static int entry_count;
+static struct simple_fs bm_fs;
/*
* Max length of the register string. Determined by:
@@ -623,7 +622,7 @@ static void kill_node(Node *e)
drop_nlink(d_inode(dentry));
d_drop(dentry);
dput(dentry);
- simple_release_fs(&bm_mnt, &entry_count);
+ simple_release_fs(&bm_fs);
}
/* /<entry> */
@@ -718,7 +717,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (!inode)
goto out2;
- err = simple_pin_fs(&bm_fs_type, &bm_mnt, &entry_count);
+ err = simple_pin_fs(&bm_fs, &bm_fs_type);
if (err) {
iput(inode);
inode = NULL;
@@ -732,7 +731,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (IS_ERR(f)) {
err = PTR_ERR(f);
pr_notice("register: failed to install interpreter file %s\n", e->interpreter);
- simple_release_fs(&bm_mnt, &entry_count);
+ simple_release_fs(&bm_fs);
iput(inode);
inode = NULL;
goto out2;
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 331c2f064f02..a671974f5b6f 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -24,9 +24,8 @@
/* Random magic number */
#define CONFIGFS_MAGIC 0x62656570
-static struct vfsmount *configfs_mount = NULL;
+static struct simple_fs configfs_fs;
struct kmem_cache *configfs_dir_cachep;
-static int configfs_mnt_count = 0;
static void configfs_free_inode(struct inode *inode)
@@ -123,14 +122,13 @@ MODULE_ALIAS_FS("configfs");
struct dentry *configfs_pin_fs(void)
{
- int err = simple_pin_fs(&configfs_fs_type, &configfs_mount,
- &configfs_mnt_count);
- return err ? ERR_PTR(err) : configfs_mount->mnt_root;
+ int err = simple_pin_fs(&configfs_fs, &configfs_fs_type);
+ return err ? ERR_PTR(err) : configfs_fs.mount->mnt_root;
}
void configfs_release_fs(void)
{
- simple_release_fs(&configfs_mount, &configfs_mnt_count);
+ simple_release_fs(&configfs_fs);
}
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 7b9fddced48f..ea54efc74c0d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -32,8 +32,7 @@
#define DEBUGFS_DEFAULT_MODE 0700
-static struct vfsmount *debugfs_mount;
-static int debugfs_mount_count;
+static struct simple_fs debugfs;
static bool debugfs_registered;
/*
@@ -297,7 +296,7 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
return NULL;
if (!parent)
- parent = debugfs_mount->mnt_root;
+ parent = debugfs.mount->mnt_root;
dentry = lookup_positive_unlocked(name, parent, strlen(name));
if (IS_ERR(dentry))
@@ -316,8 +315,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(parent))
return parent;
- error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
- &debugfs_mount_count);
+ error = simple_pin_fs(&debugfs, &debug_fs_type);
if (error) {
pr_err("Unable to pin filesystem for file '%s'\n", name);
return ERR_PTR(error);
@@ -329,7 +327,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
* have around.
*/
if (!parent)
- parent = debugfs_mount->mnt_root;
+ parent = debugfs.mount->mnt_root;
inode_lock(d_inode(parent));
if (unlikely(IS_DEADDIR(d_inode(parent))))
@@ -349,7 +347,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(dentry)) {
inode_unlock(d_inode(parent));
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
return dentry;
@@ -359,7 +357,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
{
inode_unlock(d_inode(dentry->d_parent));
dput(dentry);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
return ERR_PTR(-ENOMEM);
}
@@ -676,9 +674,9 @@ static void __debugfs_file_removed(struct dentry *dentry)
static void remove_one(struct dentry *victim)
{
- if (d_is_reg(victim))
+ if (d_is_reg(victim))
__debugfs_file_removed(victim);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
/**
@@ -699,9 +697,9 @@ void debugfs_remove(struct dentry *dentry)
if (IS_ERR_OR_NULL(dentry))
return;
- simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count);
+ simple_pin_fs(&debugfs, &debug_fs_type);
simple_recursive_removal(dentry, remove_one);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
EXPORT_SYMBOL_GPL(debugfs_remove);
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 226d18963801..790d8beb9cc3 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -4,34 +4,34 @@
static DEFINE_SPINLOCK(pin_fs_lock);
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+int simple_pin_fs(struct simple_fs *fs, struct file_system_type *type)
{
struct vfsmount *mnt = NULL;
spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
+ if (unlikely(!fs->mount)) {
spin_unlock(&pin_fs_lock);
mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
if (IS_ERR(mnt))
return PTR_ERR(mnt);
spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
+ if (!fs->mount)
+ fs->mount = mnt;
}
- mntget(*mount);
- ++*count;
+ mntget(fs->mount);
+ ++fs->count;
spin_unlock(&pin_fs_lock);
mntput(mnt);
return 0;
}
EXPORT_SYMBOL(simple_pin_fs);
-void simple_release_fs(struct vfsmount **mount, int *count)
+void simple_release_fs(struct simple_fs *fs)
{
struct vfsmount *mnt;
spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
+ mnt = fs->mount;
+ if (!--fs->count)
+ fs->mount = NULL;
spin_unlock(&pin_fs_lock);
mntput(mnt);
}
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 4353ca81e1d7..40ccfe737c3a 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -24,8 +24,7 @@
#define TRACEFS_DEFAULT_MODE 0700
-static struct vfsmount *tracefs_mount;
-static int tracefs_mount_count;
+static struct simple_fs tracefs;
static bool tracefs_registered;
static ssize_t default_read_file(struct file *file, char __user *buf,
@@ -316,8 +315,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
pr_debug("tracefs: creating file '%s'\n",name);
- error = simple_pin_fs(&trace_fs_type, &tracefs_mount,
- &tracefs_mount_count);
+ error = simple_pin_fs(&tracefs, &trace_fs_type);
if (error)
return ERR_PTR(error);
@@ -327,7 +325,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
* have around.
*/
if (!parent)
- parent = tracefs_mount->mnt_root;
+ parent = tracefs.mount->mnt_root;
inode_lock(parent->d_inode);
if (unlikely(IS_DEADDIR(parent->d_inode)))
@@ -341,7 +339,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(dentry)) {
inode_unlock(parent->d_inode);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
return dentry;
@@ -351,7 +349,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
{
inode_unlock(dentry->d_parent->d_inode);
dput(dentry);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
return NULL;
}
@@ -504,7 +502,7 @@ __init struct dentry *tracefs_create_instance_dir(const char *name,
static void remove_one(struct dentry *victim)
{
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
/**
@@ -520,9 +518,9 @@ void tracefs_remove(struct dentry *dentry)
if (IS_ERR_OR_NULL(dentry))
return;
- simple_pin_fs(&trace_fs_type, &tracefs_mount, &tracefs_mount_count);
+ simple_pin_fs(&tracefs, &trace_fs_type);
simple_recursive_removal(dentry, remove_one);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
/**
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 1076a44db308..18010414a16f 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -4,7 +4,12 @@
#include <linux/fs.h>
-extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
-extern void simple_release_fs(struct vfsmount **mount, int *count);
+struct simple_fs {
+ struct vfsmount *mount;
+ int count;
+};
+
+extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
+extern void simple_release_fs(struct simple_fs *);
#endif
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index d62d3fca47f2..75d70e6ba0a0 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -140,8 +140,7 @@ static int mangle_name(const char *name, char *target)
*/
#define AAFS_NAME "apparmorfs"
-static struct vfsmount *aafs_mnt;
-static int aafs_count;
+static struct simple_fs aafs;
static int aafs_show_path(struct seq_file *seq, struct dentry *dentry)
@@ -273,7 +272,7 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
if (!(mode & S_IFMT))
mode = (mode & S_IALLUGO) | S_IFREG;
- error = simple_pin_fs(&aafs_ops, &aafs_mnt, &aafs_count);
+ error = simple_pin_fs(&aafs, &aafs_ops);
if (error)
return ERR_PTR(error);
@@ -303,7 +302,7 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
fail_lock:
inode_unlock(dir);
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
return ERR_PTR(error);
}
@@ -395,7 +394,7 @@ static void aafs_remove(struct dentry *dentry)
dput(dentry);
}
inode_unlock(dir);
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
}
@@ -1824,7 +1823,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode)
* for pin_fs
*/
inode_unlock(dir);
- error = simple_pin_fs(&aafs_ops, &aafs_mnt, &aafs_count);
+ error = simple_pin_fs(&aafs, &aafs_ops);
mutex_lock_nested(&parent->lock, parent->level);
inode_lock_nested(dir, I_MUTEX_PARENT);
if (error)
@@ -1845,7 +1844,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode)
aa_put_ns(ns); /* list ref remains */
out_pin:
if (error)
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
out:
mutex_unlock(&parent->lock);
aa_put_ns(parent);
@@ -2580,7 +2579,7 @@ static const char *policy_get_link(struct dentry *dentry,
return ERR_PTR(-ECHILD);
ns = aa_get_current_ns();
- path.mnt = mntget(aafs_mnt);
+ path.mnt = mntget(aafs.mount);
path.dentry = dget(ns_dir(ns));
error = nd_jump_link(&path);
aa_put_ns(ns);
@@ -2631,10 +2630,10 @@ static int __init aa_create_aafs(void)
}
/* setup apparmorfs used to virtualize policy/ */
- aafs_mnt = kern_mount(&aafs_ops);
- if (IS_ERR(aafs_mnt))
+ aafs.mount = kern_mount(&aafs_ops);
+ if (IS_ERR(aafs.mount))
panic("can't set apparmorfs up\n");
- aafs_mnt->mnt_sb->s_flags &= ~SB_NOUSER;
+ aafs.mount->mnt_sb->s_flags &= ~SB_NOUSER;
/* Populate fs tree. */
error = entry_create_dir(&aa_sfs_entry, NULL);
@@ -2667,8 +2666,8 @@ static int __init aa_create_aafs(void)
/* policy tree referenced by magic policy symlink */
mutex_lock_nested(&root_ns->lock, root_ns->level);
- error = __aafs_ns_mkdir(root_ns, aafs_mnt->mnt_root, ".policy",
- aafs_mnt->mnt_root);
+ error = __aafs_ns_mkdir(root_ns, aafs.mount->mnt_root, ".policy",
+ aafs.mount->mnt_root);
mutex_unlock(&root_ns->lock);
if (error)
goto error;
diff --git a/security/inode.c b/security/inode.c
index a9a9ee4de21d..0fcd03299e0d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -22,8 +22,7 @@
#include <linux/lsm_hooks.h>
#include <linux/magic.h>
-static struct vfsmount *mount;
-static int mount_count;
+static struct simple_fs securityfs;
static void securityfs_free_inode(struct inode *inode)
{
@@ -118,12 +117,12 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
pr_debug("securityfs: creating file '%s'\n",name);
- error = simple_pin_fs(&fs_type, &mount, &mount_count);
+ error = simple_pin_fs(&securityfs, &fs_type);
if (error)
return ERR_PTR(error);
if (!parent)
- parent = mount->mnt_root;
+ parent = securityfs.mount->mnt_root;
dir = d_inode(parent);
@@ -168,7 +167,7 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
dentry = ERR_PTR(error);
out:
inode_unlock(dir);
- simple_release_fs(&mount, &mount_count);
+ simple_release_fs(&securityfs);
return dentry;
}
@@ -309,7 +308,7 @@ void securityfs_remove(struct dentry *dentry)
dput(dentry);
}
inode_unlock(dir);
- simple_release_fs(&mount, &mount_count);
+ simple_release_fs(&securityfs);
}
EXPORT_SYMBOL_GPL(securityfs_remove);
--
2.25.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh
Simplify passing the count and mount to simple_pin_fs and simple_release_fs,
in preparation for adding more high level operations to the simplefs API.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 11 +++++------
drivers/misc/cxl/api.c | 13 ++++++-------
drivers/scsi/cxlflash/ocxl_hw.c | 14 ++++++--------
fs/binfmt_misc.c | 9 ++++-----
fs/configfs/mount.c | 10 ++++------
fs/debugfs/inode.c | 22 ++++++++++------------
fs/simplefs.c | 20 ++++++++++----------
fs/tracefs/inode.c | 18 ++++++++----------
include/linux/simplefs.h | 9 +++++++--
security/apparmor/apparmorfs.c | 25 ++++++++++++-------------
security/inode.c | 11 +++++------
11 files changed, 77 insertions(+), 85 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 187a61091b5c..b4b357725be2 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -514,8 +514,7 @@ EXPORT_SYMBOL(drm_dev_unplug);
* iput(), but this way you'd end up with a new vfsmount for each inode.
*/
-static int drm_fs_cnt;
-static struct vfsmount *drm_fs_mnt;
+static struct simple_fs drm_fs;
static int drm_fs_init_fs_context(struct fs_context *fc)
{
@@ -534,15 +533,15 @@ static struct inode *drm_fs_inode_new(void)
struct inode *inode;
int r;
- r = simple_pin_fs(&drm_fs_type, &drm_fs_mnt, &drm_fs_cnt);
+ r = simple_pin_fs(&drm_fs, &drm_fs_type);
if (r < 0) {
DRM_ERROR("Cannot mount pseudo fs: %d\n", r);
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs_mnt->mnt_sb);
+ inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
if (IS_ERR(inode))
- simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
+ simple_release_fs(&drm_fs);
return inode;
}
@@ -551,7 +550,7 @@ static void drm_fs_inode_free(struct inode *inode)
{
if (inode) {
iput(inode);
- simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
+ simple_release_fs(&drm_fs);
}
}
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 0b8f8de7475a..6c6566d8bc17 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -32,8 +32,7 @@
#define CXL_PSEUDO_FS_MAGIC 0x1697697f
-static int cxl_fs_cnt;
-static struct vfsmount *cxl_vfs_mount;
+static struct simple_fs cxl_fs;
static int cxl_fs_init_fs_context(struct fs_context *fc)
{
@@ -51,7 +50,7 @@ static struct file_system_type cxl_fs_type = {
void cxl_release_mapping(struct cxl_context *ctx)
{
if (ctx->kernelapi && ctx->mapping)
- simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt);
+ simple_release_fs(&cxl_fs);
}
static struct file *cxl_getfile(const char *name,
@@ -67,20 +66,20 @@ static struct file *cxl_getfile(const char *name,
if (fops->owner && !try_module_get(fops->owner))
return ERR_PTR(-ENOENT);
- rc = simple_pin_fs(&cxl_fs_type, &cxl_vfs_mount, &cxl_fs_cnt);
+ rc = simple_pin_fs(&cxl_fs, &cxl_fs_type);
if (rc < 0) {
pr_err("Cannot mount cxl pseudo filesystem: %d\n", rc);
file = ERR_PTR(rc);
goto err_module;
}
- inode = alloc_anon_inode(cxl_vfs_mount->mnt_sb);
+ inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
}
- file = alloc_file_pseudo(inode, cxl_vfs_mount, name,
+ file = alloc_file_pseudo(inode, cxl_fs.mount, name,
flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file))
goto err_inode;
@@ -92,7 +91,7 @@ static struct file *cxl_getfile(const char *name,
err_inode:
iput(inode);
err_fs:
- simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt);
+ simple_release_fs(&cxl_fs);
err_module:
module_put(fops->owner);
return file;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 429f55651090..23afde0c6c0e 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -30,8 +30,7 @@
#define OCXLFLASH_FS_MAGIC 0x1697698f
-static int ocxlflash_fs_cnt;
-static struct vfsmount *ocxlflash_vfs_mount;
+static struct simple_fs ocxlflash_fs;
static int ocxlflash_fs_init_fs_context(struct fs_context *fc)
{
@@ -52,7 +51,7 @@ static struct file_system_type ocxlflash_fs_type = {
static void ocxlflash_release_mapping(struct ocxlflash_context *ctx)
{
if (ctx->mapping)
- simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
+ simple_release_fs(&ocxlflash_fs);
ctx->mapping = NULL;
}
@@ -80,15 +79,14 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err1;
}
- rc = simple_pin_fs(&ocxlflash_fs_type, &ocxlflash_vfs_mount,
- &ocxlflash_fs_cnt);
+ rc = simple_pin_fs(&ocxlflash_fs, &ocxlflash_fs_type);
if (unlikely(rc < 0)) {
dev_err(dev, "%s: Cannot mount ocxlflash pseudofs rc=%d\n",
__func__, rc);
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_vfs_mount->mnt_sb);
+ inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
@@ -96,7 +94,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err3;
}
- file = alloc_file_pseudo(inode, ocxlflash_vfs_mount, name,
+ file = alloc_file_pseudo(inode, ocxlflash_fs.mount, name,
flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file)) {
rc = PTR_ERR(file);
@@ -111,7 +109,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
err4:
iput(inode);
err3:
- simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
+ simple_release_fs(&ocxlflash_fs);
err2:
module_put(fops->owner);
err1:
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index c764110f5f0b..475096a02a1a 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -64,8 +64,7 @@ typedef struct {
static DEFINE_RWLOCK(entries_lock);
static struct file_system_type bm_fs_type;
-static struct vfsmount *bm_mnt;
-static int entry_count;
+static struct simple_fs bm_fs;
/*
* Max length of the register string. Determined by:
@@ -623,7 +622,7 @@ static void kill_node(Node *e)
drop_nlink(d_inode(dentry));
d_drop(dentry);
dput(dentry);
- simple_release_fs(&bm_mnt, &entry_count);
+ simple_release_fs(&bm_fs);
}
/* /<entry> */
@@ -718,7 +717,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (!inode)
goto out2;
- err = simple_pin_fs(&bm_fs_type, &bm_mnt, &entry_count);
+ err = simple_pin_fs(&bm_fs, &bm_fs_type);
if (err) {
iput(inode);
inode = NULL;
@@ -732,7 +731,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (IS_ERR(f)) {
err = PTR_ERR(f);
pr_notice("register: failed to install interpreter file %s\n", e->interpreter);
- simple_release_fs(&bm_mnt, &entry_count);
+ simple_release_fs(&bm_fs);
iput(inode);
inode = NULL;
goto out2;
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 331c2f064f02..a671974f5b6f 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -24,9 +24,8 @@
/* Random magic number */
#define CONFIGFS_MAGIC 0x62656570
-static struct vfsmount *configfs_mount = NULL;
+static struct simple_fs configfs_fs;
struct kmem_cache *configfs_dir_cachep;
-static int configfs_mnt_count = 0;
static void configfs_free_inode(struct inode *inode)
@@ -123,14 +122,13 @@ MODULE_ALIAS_FS("configfs");
struct dentry *configfs_pin_fs(void)
{
- int err = simple_pin_fs(&configfs_fs_type, &configfs_mount,
- &configfs_mnt_count);
- return err ? ERR_PTR(err) : configfs_mount->mnt_root;
+ int err = simple_pin_fs(&configfs_fs, &configfs_fs_type);
+ return err ? ERR_PTR(err) : configfs_fs.mount->mnt_root;
}
void configfs_release_fs(void)
{
- simple_release_fs(&configfs_mount, &configfs_mnt_count);
+ simple_release_fs(&configfs_fs);
}
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 7b9fddced48f..ea54efc74c0d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -32,8 +32,7 @@
#define DEBUGFS_DEFAULT_MODE 0700
-static struct vfsmount *debugfs_mount;
-static int debugfs_mount_count;
+static struct simple_fs debugfs;
static bool debugfs_registered;
/*
@@ -297,7 +296,7 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
return NULL;
if (!parent)
- parent = debugfs_mount->mnt_root;
+ parent = debugfs.mount->mnt_root;
dentry = lookup_positive_unlocked(name, parent, strlen(name));
if (IS_ERR(dentry))
@@ -316,8 +315,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(parent))
return parent;
- error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
- &debugfs_mount_count);
+ error = simple_pin_fs(&debugfs, &debug_fs_type);
if (error) {
pr_err("Unable to pin filesystem for file '%s'\n", name);
return ERR_PTR(error);
@@ -329,7 +327,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
* have around.
*/
if (!parent)
- parent = debugfs_mount->mnt_root;
+ parent = debugfs.mount->mnt_root;
inode_lock(d_inode(parent));
if (unlikely(IS_DEADDIR(d_inode(parent))))
@@ -349,7 +347,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(dentry)) {
inode_unlock(d_inode(parent));
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
return dentry;
@@ -359,7 +357,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
{
inode_unlock(d_inode(dentry->d_parent));
dput(dentry);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
return ERR_PTR(-ENOMEM);
}
@@ -676,9 +674,9 @@ static void __debugfs_file_removed(struct dentry *dentry)
static void remove_one(struct dentry *victim)
{
- if (d_is_reg(victim))
+ if (d_is_reg(victim))
__debugfs_file_removed(victim);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
/**
@@ -699,9 +697,9 @@ void debugfs_remove(struct dentry *dentry)
if (IS_ERR_OR_NULL(dentry))
return;
- simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count);
+ simple_pin_fs(&debugfs, &debug_fs_type);
simple_recursive_removal(dentry, remove_one);
- simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ simple_release_fs(&debugfs);
}
EXPORT_SYMBOL_GPL(debugfs_remove);
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 226d18963801..790d8beb9cc3 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -4,34 +4,34 @@
static DEFINE_SPINLOCK(pin_fs_lock);
-int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *count)
+int simple_pin_fs(struct simple_fs *fs, struct file_system_type *type)
{
struct vfsmount *mnt = NULL;
spin_lock(&pin_fs_lock);
- if (unlikely(!*mount)) {
+ if (unlikely(!fs->mount)) {
spin_unlock(&pin_fs_lock);
mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
if (IS_ERR(mnt))
return PTR_ERR(mnt);
spin_lock(&pin_fs_lock);
- if (!*mount)
- *mount = mnt;
+ if (!fs->mount)
+ fs->mount = mnt;
}
- mntget(*mount);
- ++*count;
+ mntget(fs->mount);
+ ++fs->count;
spin_unlock(&pin_fs_lock);
mntput(mnt);
return 0;
}
EXPORT_SYMBOL(simple_pin_fs);
-void simple_release_fs(struct vfsmount **mount, int *count)
+void simple_release_fs(struct simple_fs *fs)
{
struct vfsmount *mnt;
spin_lock(&pin_fs_lock);
- mnt = *mount;
- if (!--*count)
- *mount = NULL;
+ mnt = fs->mount;
+ if (!--fs->count)
+ fs->mount = NULL;
spin_unlock(&pin_fs_lock);
mntput(mnt);
}
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 4353ca81e1d7..40ccfe737c3a 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -24,8 +24,7 @@
#define TRACEFS_DEFAULT_MODE 0700
-static struct vfsmount *tracefs_mount;
-static int tracefs_mount_count;
+static struct simple_fs tracefs;
static bool tracefs_registered;
static ssize_t default_read_file(struct file *file, char __user *buf,
@@ -316,8 +315,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
pr_debug("tracefs: creating file '%s'\n",name);
- error = simple_pin_fs(&trace_fs_type, &tracefs_mount,
- &tracefs_mount_count);
+ error = simple_pin_fs(&tracefs, &trace_fs_type);
if (error)
return ERR_PTR(error);
@@ -327,7 +325,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
* have around.
*/
if (!parent)
- parent = tracefs_mount->mnt_root;
+ parent = tracefs.mount->mnt_root;
inode_lock(parent->d_inode);
if (unlikely(IS_DEADDIR(parent->d_inode)))
@@ -341,7 +339,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
if (IS_ERR(dentry)) {
inode_unlock(parent->d_inode);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
return dentry;
@@ -351,7 +349,7 @@ static struct dentry *failed_creating(struct dentry *dentry)
{
inode_unlock(dentry->d_parent->d_inode);
dput(dentry);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
return NULL;
}
@@ -504,7 +502,7 @@ __init struct dentry *tracefs_create_instance_dir(const char *name,
static void remove_one(struct dentry *victim)
{
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
/**
@@ -520,9 +518,9 @@ void tracefs_remove(struct dentry *dentry)
if (IS_ERR_OR_NULL(dentry))
return;
- simple_pin_fs(&trace_fs_type, &tracefs_mount, &tracefs_mount_count);
+ simple_pin_fs(&tracefs, &trace_fs_type);
simple_recursive_removal(dentry, remove_one);
- simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+ simple_release_fs(&tracefs);
}
/**
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 1076a44db308..18010414a16f 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -4,7 +4,12 @@
#include <linux/fs.h>
-extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
-extern void simple_release_fs(struct vfsmount **mount, int *count);
+struct simple_fs {
+ struct vfsmount *mount;
+ int count;
+};
+
+extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
+extern void simple_release_fs(struct simple_fs *);
#endif
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index d62d3fca47f2..75d70e6ba0a0 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -140,8 +140,7 @@ static int mangle_name(const char *name, char *target)
*/
#define AAFS_NAME "apparmorfs"
-static struct vfsmount *aafs_mnt;
-static int aafs_count;
+static struct simple_fs aafs;
static int aafs_show_path(struct seq_file *seq, struct dentry *dentry)
@@ -273,7 +272,7 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
if (!(mode & S_IFMT))
mode = (mode & S_IALLUGO) | S_IFREG;
- error = simple_pin_fs(&aafs_ops, &aafs_mnt, &aafs_count);
+ error = simple_pin_fs(&aafs, &aafs_ops);
if (error)
return ERR_PTR(error);
@@ -303,7 +302,7 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
fail_lock:
inode_unlock(dir);
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
return ERR_PTR(error);
}
@@ -395,7 +394,7 @@ static void aafs_remove(struct dentry *dentry)
dput(dentry);
}
inode_unlock(dir);
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
}
@@ -1824,7 +1823,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode)
* for pin_fs
*/
inode_unlock(dir);
- error = simple_pin_fs(&aafs_ops, &aafs_mnt, &aafs_count);
+ error = simple_pin_fs(&aafs, &aafs_ops);
mutex_lock_nested(&parent->lock, parent->level);
inode_lock_nested(dir, I_MUTEX_PARENT);
if (error)
@@ -1845,7 +1844,7 @@ static int ns_mkdir_op(struct inode *dir, struct dentry *dentry, umode_t mode)
aa_put_ns(ns); /* list ref remains */
out_pin:
if (error)
- simple_release_fs(&aafs_mnt, &aafs_count);
+ simple_release_fs(&aafs);
out:
mutex_unlock(&parent->lock);
aa_put_ns(parent);
@@ -2580,7 +2579,7 @@ static const char *policy_get_link(struct dentry *dentry,
return ERR_PTR(-ECHILD);
ns = aa_get_current_ns();
- path.mnt = mntget(aafs_mnt);
+ path.mnt = mntget(aafs.mount);
path.dentry = dget(ns_dir(ns));
error = nd_jump_link(&path);
aa_put_ns(ns);
@@ -2631,10 +2630,10 @@ static int __init aa_create_aafs(void)
}
/* setup apparmorfs used to virtualize policy/ */
- aafs_mnt = kern_mount(&aafs_ops);
- if (IS_ERR(aafs_mnt))
+ aafs.mount = kern_mount(&aafs_ops);
+ if (IS_ERR(aafs.mount))
panic("can't set apparmorfs up\n");
- aafs_mnt->mnt_sb->s_flags &= ~SB_NOUSER;
+ aafs.mount->mnt_sb->s_flags &= ~SB_NOUSER;
/* Populate fs tree. */
error = entry_create_dir(&aa_sfs_entry, NULL);
@@ -2667,8 +2666,8 @@ static int __init aa_create_aafs(void)
/* policy tree referenced by magic policy symlink */
mutex_lock_nested(&root_ns->lock, root_ns->level);
- error = __aafs_ns_mkdir(root_ns, aafs_mnt->mnt_root, ".policy",
- aafs_mnt->mnt_root);
+ error = __aafs_ns_mkdir(root_ns, aafs.mount->mnt_root, ".policy",
+ aafs.mount->mnt_root);
mutex_unlock(&root_ns->lock);
if (error)
goto error;
diff --git a/security/inode.c b/security/inode.c
index a9a9ee4de21d..0fcd03299e0d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -22,8 +22,7 @@
#include <linux/lsm_hooks.h>
#include <linux/magic.h>
-static struct vfsmount *mount;
-static int mount_count;
+static struct simple_fs securityfs;
static void securityfs_free_inode(struct inode *inode)
{
@@ -118,12 +117,12 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
pr_debug("securityfs: creating file '%s'\n",name);
- error = simple_pin_fs(&fs_type, &mount, &mount_count);
+ error = simple_pin_fs(&securityfs, &fs_type);
if (error)
return ERR_PTR(error);
if (!parent)
- parent = mount->mnt_root;
+ parent = securityfs.mount->mnt_root;
dir = d_inode(parent);
@@ -168,7 +167,7 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
dentry = ERR_PTR(error);
out:
inode_unlock(dir);
- simple_release_fs(&mount, &mount_count);
+ simple_release_fs(&securityfs);
return dentry;
}
@@ -309,7 +308,7 @@ void securityfs_remove(struct dentry *dentry)
dput(dentry);
}
inode_unlock(dir);
- simple_release_fs(&mount, &mount_count);
+ simple_release_fs(&securityfs);
}
EXPORT_SYMBOL_GPL(securityfs_remove);
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 4/8] fs: introduce simple_new_inode
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
It is a common special case for new_inode to initialize the
time to the current time and the inode to get_next_ino().
Introduce a core function that does it and use it throughout
Linux.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
arch/powerpc/platforms/cell/spufs/inode.c | 4 +---
arch/s390/hypfs/inode.c | 4 +---
drivers/infiniband/hw/qib/qib_fs.c | 6 +-----
drivers/misc/ibmasm/ibmasmfs.c | 8 +++-----
drivers/oprofile/oprofilefs.c | 8 +++-----
drivers/usb/gadget/function/f_fs.c | 8 +-------
fs/autofs/inode.c | 4 +---
fs/binfmt_misc.c | 16 ++--------------
fs/debugfs/inode.c | 19 ++++---------------
fs/efivarfs/inode.c | 4 +---
fs/fuse/control.c | 4 +---
fs/hugetlbfs/inode.c | 8 ++------
fs/libfs.c | 12 ++++++++++++
fs/ocfs2/dlmfs/dlmfs.c | 8 ++------
fs/proc/base.c | 4 +---
fs/proc/proc_sysctl.c | 5 +----
fs/pstore/inode.c | 14 ++------------
fs/ramfs/inode.c | 4 +---
fs/tracefs/inode.c | 14 ++------------
include/linux/fs.h | 1 +
ipc/mqueue.c | 4 +---
kernel/bpf/inode.c | 7 +------
mm/shmem.c | 4 +---
net/sunrpc/rpc_pipe.c | 4 +---
security/apparmor/apparmorfs.c | 8 ++------
security/inode.c | 4 +---
26 files changed, 50 insertions(+), 136 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 25390569e24c..5167b11d41ed 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -77,15 +77,13 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
{
struct inode *inode;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto out;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
out:
return inode;
}
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 5c97f48cea91..97d11561f35c 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -93,15 +93,13 @@ static void hypfs_delete_tree(struct dentry *root)
static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode)
{
- struct inode *ret = new_inode(sb);
+ struct inode *ret = simple_new_inode(sb);
if (ret) {
struct hypfs_sb_info *hypfs_info = sb->s_fs_info;
- ret->i_ino = get_next_ino();
ret->i_mode = mode;
ret->i_uid = hypfs_info->uid;
ret->i_gid = hypfs_info->gid;
- ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
if (S_ISDIR(mode))
set_nlink(ret, 2);
}
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index e336d778e076..d402c3b1c552 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -53,21 +53,17 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
void *data)
{
int error;
- struct inode *inode = new_inode(dir->i_sb);
+ struct inode *inode = simple_new_inode(dir->i_sb);
if (!inode) {
error = -EPERM;
goto bail;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = GLOBAL_ROOT_UID;
inode->i_gid = GLOBAL_ROOT_GID;
inode->i_blocks = 0;
- inode->i_atime = current_time(inode);
- inode->i_mtime = inode->i_atime;
- inode->i_ctime = inode->i_atime;
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 35fec1bf1b3d..72aa02505f45 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -134,13 +134,11 @@ static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc)
static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
{
- struct inode *ret = new_inode(sb);
+ struct inode *ret = simple_new_inode(sb);
- if (ret) {
- ret->i_ino = get_next_ino();
+ if (ret)
ret->i_mode = mode;
- ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
- }
+
return ret;
}
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 0875f2f122b3..a903dff693c9 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -26,13 +26,11 @@ DEFINE_RAW_SPINLOCK(oprofilefs_lock);
static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
+ if (inode)
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
+
return inode;
}
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index c81023b195c3..d5ca23682f28 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1385,18 +1385,12 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
ENTER();
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (likely(inode)) {
- struct timespec64 ts = current_time(inode);
-
- inode->i_ino = get_next_ino();
inode->i_mode = perms->mode;
inode->i_uid = perms->uid;
inode->i_gid = perms->gid;
- inode->i_atime = ts;
- inode->i_mtime = ts;
- inode->i_ctime = ts;
inode->i_private = data;
if (fops)
inode->i_fop = fops;
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index 9edf243713eb..26710b7d5ade 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -359,7 +359,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (inode == NULL)
return NULL;
@@ -369,8 +369,6 @@ struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
inode->i_uid = d_inode(sb->s_root)->i_uid;
inode->i_gid = d_inode(sb->s_root)->i_gid;
}
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- inode->i_ino = get_next_ino();
if (S_ISDIR(mode)) {
set_nlink(inode, 2);
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 475096a02a1a..cd27039ffbdf 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -586,19 +586,6 @@ static void entry_status(Node *e, char *page)
}
}
-static struct inode *bm_get_inode(struct super_block *sb, int mode)
-{
- struct inode *inode = new_inode(sb);
-
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime =
- current_time(inode);
- }
- return inode;
-}
-
static void bm_evict_inode(struct inode *inode)
{
Node *e = inode->i_private;
@@ -711,12 +698,13 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (d_really_is_positive(dentry))
goto out2;
- inode = bm_get_inode(sb, S_IFREG | 0644);
+ inode = simple_new_inode(sb);
err = -ENOMEM;
if (!inode)
goto out2;
+ inode->i_mode = S_IFREG | 0644;
err = simple_pin_fs(&bm_fs, &bm_fs_type);
if (err) {
iput(inode);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index ea54efc74c0d..834b5872ca0d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -61,17 +61,6 @@ static const struct inode_operations debugfs_symlink_inode_operations = {
.setattr = debugfs_setattr,
};
-static struct inode *debugfs_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime =
- inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
struct debugfs_mount_opts {
kuid_t uid;
kgid_t gid;
@@ -383,7 +372,7 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create file '%s'\n",
name);
@@ -539,7 +528,7 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create directory '%s'\n",
name);
@@ -581,7 +570,7 @@ struct dentry *debugfs_create_automount(const char *name,
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create automount '%s'\n",
name);
@@ -639,7 +628,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
return dentry;
}
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create symlink '%s'\n",
name);
diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c
index 96c0c86f3fff..f8f459f43920 100644
--- a/fs/efivarfs/inode.c
+++ b/fs/efivarfs/inode.c
@@ -16,12 +16,10 @@ struct inode *efivarfs_get_inode(struct super_block *sb,
const struct inode *dir, int mode,
dev_t dev, bool is_removable)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_flags = is_removable ? 0 : S_IMMUTABLE;
switch (mode & S_IFMT) {
case S_IFREG:
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index c23f6f243ad4..6a9f35aca480 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -232,17 +232,15 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
if (!dentry)
return NULL;
- inode = new_inode(fuse_control_sb);
+ inode = simple_new_inode(fuse_control_sb);
if (!inode) {
dput(dentry);
return NULL;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = fc->user_id;
inode->i_gid = fc->group_id;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
/* setting ->i_op to NULL is not allowed */
if (iop)
inode->i_op = iop;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 991c60c7ffe0..4064389c2c23 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -739,13 +739,11 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
{
struct inode *inode;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode->i_mode = S_IFDIR | ctx->mode;
inode->i_uid = ctx->uid;
inode->i_gid = ctx->gid;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_op = &hugetlbfs_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
/* directory inodes start off with i_nlink == 2 (for "." entry) */
@@ -780,16 +778,14 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
return NULL;
}
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode);
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,
&hugetlbfs_i_mmap_rwsem_key);
inode->i_mapping->a_ops = &hugetlbfs_aops;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_mapping->private_data = resv_map;
info->seals = F_SEAL_SEAL;
switch (mode & S_IFMT) {
diff --git a/fs/libfs.c b/fs/libfs.c
index 26ec729f7bcd..20bdee9361d5 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
}
EXPORT_SYMBOL(simple_write_end);
+struct inode *simple_new_inode(struct super_block *sb)
+{
+ struct inode *inode = new_inode(sb);
+ if (inode) {
+ inode->i_ino = get_next_ino();
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_time(inode);
+ }
+ return inode;
+}
+EXPORT_SYMBOL(simple_new_inode);
+
/*
* the inodes created here are not hashed. If you use iunique to generate
* unique inode values later for this filesystem, then you must take care
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 8e4f1ace467c..6285c174f9f2 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -371,13 +371,11 @@ static void dlmfs_evict_inode(struct inode *inode)
static struct inode *dlmfs_get_root_inode(struct super_block *sb)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
umode_t mode = S_IFDIR | 0755;
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, NULL, mode);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inc_nlink(inode);
inode->i_fop = &simple_dir_operations;
@@ -392,15 +390,13 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
umode_t mode)
{
struct super_block *sb = parent->i_sb;
- struct inode * inode = new_inode(sb);
+ struct inode * inode = simple_new_inode(sb);
struct dlmfs_inode_private *ip;
if (!inode)
return NULL;
- inode->i_ino = get_next_ino();
inode_init_owner(inode, parent, mode);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
ip = DLMFS_I(inode);
ip->ip_conn = DLMFS_I(parent)->ip_conn;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 74f948a6b621..3ef16f4f14c9 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1856,15 +1856,13 @@ struct inode *proc_pid_make_inode(struct super_block * sb,
/* We need a new inode */
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto out;
/* Common stuff */
ei = PROC_I(inode);
inode->i_mode = mode;
- inode->i_ino = get_next_ino();
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_op = &proc_def_inode_operations;
/*
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index b6f5d459b087..3464ab94cf79 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -434,12 +434,10 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
struct inode *inode;
struct proc_inode *ei;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
return ERR_PTR(-ENOMEM);
- inode->i_ino = get_next_ino();
-
ei = PROC_I(inode);
spin_lock(&sysctl_lock);
@@ -454,7 +452,6 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
head->count++;
spin_unlock(&sysctl_lock);
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_mode = table->mode;
if (!S_ISDIR(table->mode)) {
inode->i_mode |= S_IFREG;
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index d99b5d39aa90..d6cad315a839 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -208,16 +208,6 @@ static const struct inode_operations pstore_dir_inode_operations = {
.unlink = pstore_unlink,
};
-static struct inode *pstore_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
enum {
Opt_kmsg_bytes, Opt_err
};
@@ -316,7 +306,7 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
return rc;
rc = -ENOMEM;
- inode = pstore_get_inode(root->d_sb);
+ inode = simple_new_inode(root->d_sb);
if (!inode)
goto fail;
inode->i_mode = S_IFREG | 0444;
@@ -394,7 +384,7 @@ static int pstore_fill_super(struct super_block *sb, void *data, int silent)
parse_options(data);
- inode = pstore_get_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
inode->i_mode = S_IFDIR | 0750;
inode->i_op = &pstore_dir_inode_operations;
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index ee179a81b3da..cf2ce7bc4c9d 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -63,15 +63,13 @@ static const struct address_space_operations ramfs_aops = {
struct inode *ramfs_get_inode(struct super_block *sb,
const struct inode *dir, umode_t mode, dev_t dev)
{
- struct inode * inode = new_inode(sb);
+ struct inode * inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
inode->i_mapping->a_ops = &ramfs_aops;
mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
mapping_set_unevictable(inode->i_mapping);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
switch (mode & S_IFMT) {
default:
init_special_inode(inode, mode, dev);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 40ccfe737c3a..a30837a8e1d4 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -124,16 +124,6 @@ static const struct inode_operations tracefs_dir_inode_operations = {
.rmdir = tracefs_syscall_rmdir,
};
-static struct inode *tracefs_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
struct tracefs_mount_opts {
kuid_t uid;
kgid_t gid;
@@ -403,7 +393,7 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return NULL;
- inode = tracefs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode))
return failed_creating(dentry);
@@ -424,7 +414,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
if (IS_ERR(dentry))
return NULL;
- inode = tracefs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode))
return failed_creating(dentry);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 55b679b89c8a..6136f5ba2680 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3088,6 +3088,7 @@ extern void clear_inode(struct inode *);
extern void __destroy_inode(struct inode *);
extern struct inode *new_inode_pseudo(struct super_block *sb);
extern struct inode *new_inode(struct super_block *sb);
+extern struct inode *simple_new_inode(struct super_block *sb);
extern void free_inode_nonrcu(struct inode *inode);
extern int should_remove_suid(struct dentry *);
extern int file_remove_privs(struct file *);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 49a05ba3000d..74c4f852a688 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -296,15 +296,13 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
struct inode *inode;
int ret = -ENOMEM;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto err;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_mtime = inode->i_ctime = inode->i_atime = current_time(inode);
if (S_ISREG(mode)) {
struct mqueue_inode_info *info;
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 95087d9f4ed3..532a733c474a 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -112,15 +112,10 @@ static struct inode *bpf_get_inode(struct super_block *sb,
return ERR_PTR(-EINVAL);
}
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
return ERR_PTR(-ENOSPC);
- inode->i_ino = get_next_ino();
- inode->i_atime = current_time(inode);
- inode->i_mtime = inode->i_atime;
- inode->i_ctime = inode->i_atime;
-
inode_init_owner(inode, dir, mode);
return inode;
diff --git a/mm/shmem.c b/mm/shmem.c
index f47347cb30f6..50ca377464e2 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2246,12 +2246,10 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
if (shmem_reserve_inode(sb))
return NULL;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
inode->i_blocks = 0;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_generation = prandom_u32();
info = SHMEM_I(inode);
memset(info, 0, (char *)inode - (char *)info);
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 39e14d5edaf1..fa48b8f55ba9 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -467,12 +467,10 @@ struct rpc_filelist {
static struct inode *
rpc_get_inode(struct super_block *sb, umode_t mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (!inode)
return NULL;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
switch (mode & S_IFMT) {
case S_IFDIR:
inode->i_fop = &simple_dir_operations;
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 75d70e6ba0a0..1a8afe9d7110 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -212,7 +212,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
const struct file_operations *fops,
const struct inode_operations *iops)
{
- struct inode *inode = new_inode(dir->i_sb);
+ struct inode *inode = simple_new_inode(dir->i_sb);
AA_BUG(!dir);
AA_BUG(!dentry);
@@ -220,9 +220,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
if (!inode)
return -ENOMEM;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = iops ? iops : &simple_dir_inode_operations;
@@ -2540,15 +2538,13 @@ static int aa_mk_null_file(struct dentry *parent)
error = PTR_ERR(dentry);
goto out;
}
- inode = new_inode(parent->d_inode->i_sb);
+ inode = simple_new_inode(parent->d_inode->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
}
- inode->i_ino = get_next_ino();
inode->i_mode = S_IFCHR | S_IRUGO | S_IWUGO;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO,
MKDEV(MEM_MAJOR, 3));
d_instantiate(dentry, inode);
diff --git a/security/inode.c b/security/inode.c
index 0fcd03299e0d..8a1a7f73ee9c 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -136,15 +136,13 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
goto out1;
}
- inode = new_inode(dir->i_sb);
+ inode = simple_new_inode(dir->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Paolo Bonzini, Emanuele Giuseppe Esposito, Jeremy Kerr,
Arnd Bergmann, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
It is a common special case for new_inode to initialize the
time to the current time and the inode to get_next_ino().
Introduce a core function that does it and use it throughout
Linux.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
arch/powerpc/platforms/cell/spufs/inode.c | 4 +---
arch/s390/hypfs/inode.c | 4 +---
drivers/infiniband/hw/qib/qib_fs.c | 6 +-----
drivers/misc/ibmasm/ibmasmfs.c | 8 +++-----
drivers/oprofile/oprofilefs.c | 8 +++-----
drivers/usb/gadget/function/f_fs.c | 8 +-------
fs/autofs/inode.c | 4 +---
fs/binfmt_misc.c | 16 ++--------------
fs/debugfs/inode.c | 19 ++++---------------
fs/efivarfs/inode.c | 4 +---
fs/fuse/control.c | 4 +---
fs/hugetlbfs/inode.c | 8 ++------
fs/libfs.c | 12 ++++++++++++
fs/ocfs2/dlmfs/dlmfs.c | 8 ++------
fs/proc/base.c | 4 +---
fs/proc/proc_sysctl.c | 5 +----
fs/pstore/inode.c | 14 ++------------
fs/ramfs/inode.c | 4 +---
fs/tracefs/inode.c | 14 ++------------
include/linux/fs.h | 1 +
ipc/mqueue.c | 4 +---
kernel/bpf/inode.c | 7 +------
mm/shmem.c | 4 +---
net/sunrpc/rpc_pipe.c | 4 +---
security/apparmor/apparmorfs.c | 8 ++------
security/inode.c | 4 +---
26 files changed, 50 insertions(+), 136 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 25390569e24c..5167b11d41ed 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -77,15 +77,13 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
{
struct inode *inode;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto out;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
out:
return inode;
}
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 5c97f48cea91..97d11561f35c 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -93,15 +93,13 @@ static void hypfs_delete_tree(struct dentry *root)
static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode)
{
- struct inode *ret = new_inode(sb);
+ struct inode *ret = simple_new_inode(sb);
if (ret) {
struct hypfs_sb_info *hypfs_info = sb->s_fs_info;
- ret->i_ino = get_next_ino();
ret->i_mode = mode;
ret->i_uid = hypfs_info->uid;
ret->i_gid = hypfs_info->gid;
- ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
if (S_ISDIR(mode))
set_nlink(ret, 2);
}
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index e336d778e076..d402c3b1c552 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -53,21 +53,17 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
void *data)
{
int error;
- struct inode *inode = new_inode(dir->i_sb);
+ struct inode *inode = simple_new_inode(dir->i_sb);
if (!inode) {
error = -EPERM;
goto bail;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = GLOBAL_ROOT_UID;
inode->i_gid = GLOBAL_ROOT_GID;
inode->i_blocks = 0;
- inode->i_atime = current_time(inode);
- inode->i_mtime = inode->i_atime;
- inode->i_ctime = inode->i_atime;
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 35fec1bf1b3d..72aa02505f45 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -134,13 +134,11 @@ static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc)
static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
{
- struct inode *ret = new_inode(sb);
+ struct inode *ret = simple_new_inode(sb);
- if (ret) {
- ret->i_ino = get_next_ino();
+ if (ret)
ret->i_mode = mode;
- ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
- }
+
return ret;
}
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 0875f2f122b3..a903dff693c9 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -26,13 +26,11 @@ DEFINE_RAW_SPINLOCK(oprofilefs_lock);
static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
+ if (inode)
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
+
return inode;
}
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index c81023b195c3..d5ca23682f28 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1385,18 +1385,12 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
ENTER();
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (likely(inode)) {
- struct timespec64 ts = current_time(inode);
-
- inode->i_ino = get_next_ino();
inode->i_mode = perms->mode;
inode->i_uid = perms->uid;
inode->i_gid = perms->gid;
- inode->i_atime = ts;
- inode->i_mtime = ts;
- inode->i_ctime = ts;
inode->i_private = data;
if (fops)
inode->i_fop = fops;
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index 9edf243713eb..26710b7d5ade 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -359,7 +359,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (inode == NULL)
return NULL;
@@ -369,8 +369,6 @@ struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
inode->i_uid = d_inode(sb->s_root)->i_uid;
inode->i_gid = d_inode(sb->s_root)->i_gid;
}
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- inode->i_ino = get_next_ino();
if (S_ISDIR(mode)) {
set_nlink(inode, 2);
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 475096a02a1a..cd27039ffbdf 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -586,19 +586,6 @@ static void entry_status(Node *e, char *page)
}
}
-static struct inode *bm_get_inode(struct super_block *sb, int mode)
-{
- struct inode *inode = new_inode(sb);
-
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime =
- current_time(inode);
- }
- return inode;
-}
-
static void bm_evict_inode(struct inode *inode)
{
Node *e = inode->i_private;
@@ -711,12 +698,13 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (d_really_is_positive(dentry))
goto out2;
- inode = bm_get_inode(sb, S_IFREG | 0644);
+ inode = simple_new_inode(sb);
err = -ENOMEM;
if (!inode)
goto out2;
+ inode->i_mode = S_IFREG | 0644;
err = simple_pin_fs(&bm_fs, &bm_fs_type);
if (err) {
iput(inode);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index ea54efc74c0d..834b5872ca0d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -61,17 +61,6 @@ static const struct inode_operations debugfs_symlink_inode_operations = {
.setattr = debugfs_setattr,
};
-static struct inode *debugfs_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime =
- inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
struct debugfs_mount_opts {
kuid_t uid;
kgid_t gid;
@@ -383,7 +372,7 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create file '%s'\n",
name);
@@ -539,7 +528,7 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create directory '%s'\n",
name);
@@ -581,7 +570,7 @@ struct dentry *debugfs_create_automount(const char *name,
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create automount '%s'\n",
name);
@@ -639,7 +628,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
return dentry;
}
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create symlink '%s'\n",
name);
diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c
index 96c0c86f3fff..f8f459f43920 100644
--- a/fs/efivarfs/inode.c
+++ b/fs/efivarfs/inode.c
@@ -16,12 +16,10 @@ struct inode *efivarfs_get_inode(struct super_block *sb,
const struct inode *dir, int mode,
dev_t dev, bool is_removable)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_flags = is_removable ? 0 : S_IMMUTABLE;
switch (mode & S_IFMT) {
case S_IFREG:
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index c23f6f243ad4..6a9f35aca480 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -232,17 +232,15 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
if (!dentry)
return NULL;
- inode = new_inode(fuse_control_sb);
+ inode = simple_new_inode(fuse_control_sb);
if (!inode) {
dput(dentry);
return NULL;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = fc->user_id;
inode->i_gid = fc->group_id;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
/* setting ->i_op to NULL is not allowed */
if (iop)
inode->i_op = iop;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 991c60c7ffe0..4064389c2c23 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -739,13 +739,11 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
{
struct inode *inode;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode->i_mode = S_IFDIR | ctx->mode;
inode->i_uid = ctx->uid;
inode->i_gid = ctx->gid;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_op = &hugetlbfs_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
/* directory inodes start off with i_nlink == 2 (for "." entry) */
@@ -780,16 +778,14 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
return NULL;
}
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode);
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,
&hugetlbfs_i_mmap_rwsem_key);
inode->i_mapping->a_ops = &hugetlbfs_aops;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_mapping->private_data = resv_map;
info->seals = F_SEAL_SEAL;
switch (mode & S_IFMT) {
diff --git a/fs/libfs.c b/fs/libfs.c
index 26ec729f7bcd..20bdee9361d5 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
}
EXPORT_SYMBOL(simple_write_end);
+struct inode *simple_new_inode(struct super_block *sb)
+{
+ struct inode *inode = new_inode(sb);
+ if (inode) {
+ inode->i_ino = get_next_ino();
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_time(inode);
+ }
+ return inode;
+}
+EXPORT_SYMBOL(simple_new_inode);
+
/*
* the inodes created here are not hashed. If you use iunique to generate
* unique inode values later for this filesystem, then you must take care
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 8e4f1ace467c..6285c174f9f2 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -371,13 +371,11 @@ static void dlmfs_evict_inode(struct inode *inode)
static struct inode *dlmfs_get_root_inode(struct super_block *sb)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
umode_t mode = S_IFDIR | 0755;
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, NULL, mode);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inc_nlink(inode);
inode->i_fop = &simple_dir_operations;
@@ -392,15 +390,13 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
umode_t mode)
{
struct super_block *sb = parent->i_sb;
- struct inode * inode = new_inode(sb);
+ struct inode * inode = simple_new_inode(sb);
struct dlmfs_inode_private *ip;
if (!inode)
return NULL;
- inode->i_ino = get_next_ino();
inode_init_owner(inode, parent, mode);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
ip = DLMFS_I(inode);
ip->ip_conn = DLMFS_I(parent)->ip_conn;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 74f948a6b621..3ef16f4f14c9 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1856,15 +1856,13 @@ struct inode *proc_pid_make_inode(struct super_block * sb,
/* We need a new inode */
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto out;
/* Common stuff */
ei = PROC_I(inode);
inode->i_mode = mode;
- inode->i_ino = get_next_ino();
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_op = &proc_def_inode_operations;
/*
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index b6f5d459b087..3464ab94cf79 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -434,12 +434,10 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
struct inode *inode;
struct proc_inode *ei;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
return ERR_PTR(-ENOMEM);
- inode->i_ino = get_next_ino();
-
ei = PROC_I(inode);
spin_lock(&sysctl_lock);
@@ -454,7 +452,6 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
head->count++;
spin_unlock(&sysctl_lock);
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_mode = table->mode;
if (!S_ISDIR(table->mode)) {
inode->i_mode |= S_IFREG;
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index d99b5d39aa90..d6cad315a839 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -208,16 +208,6 @@ static const struct inode_operations pstore_dir_inode_operations = {
.unlink = pstore_unlink,
};
-static struct inode *pstore_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
enum {
Opt_kmsg_bytes, Opt_err
};
@@ -316,7 +306,7 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
return rc;
rc = -ENOMEM;
- inode = pstore_get_inode(root->d_sb);
+ inode = simple_new_inode(root->d_sb);
if (!inode)
goto fail;
inode->i_mode = S_IFREG | 0444;
@@ -394,7 +384,7 @@ static int pstore_fill_super(struct super_block *sb, void *data, int silent)
parse_options(data);
- inode = pstore_get_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
inode->i_mode = S_IFDIR | 0750;
inode->i_op = &pstore_dir_inode_operations;
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index ee179a81b3da..cf2ce7bc4c9d 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -63,15 +63,13 @@ static const struct address_space_operations ramfs_aops = {
struct inode *ramfs_get_inode(struct super_block *sb,
const struct inode *dir, umode_t mode, dev_t dev)
{
- struct inode * inode = new_inode(sb);
+ struct inode * inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
inode->i_mapping->a_ops = &ramfs_aops;
mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
mapping_set_unevictable(inode->i_mapping);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
switch (mode & S_IFMT) {
default:
init_special_inode(inode, mode, dev);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 40ccfe737c3a..a30837a8e1d4 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -124,16 +124,6 @@ static const struct inode_operations tracefs_dir_inode_operations = {
.rmdir = tracefs_syscall_rmdir,
};
-static struct inode *tracefs_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
struct tracefs_mount_opts {
kuid_t uid;
kgid_t gid;
@@ -403,7 +393,7 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return NULL;
- inode = tracefs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode))
return failed_creating(dentry);
@@ -424,7 +414,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
if (IS_ERR(dentry))
return NULL;
- inode = tracefs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode))
return failed_creating(dentry);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 55b679b89c8a..6136f5ba2680 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3088,6 +3088,7 @@ extern void clear_inode(struct inode *);
extern void __destroy_inode(struct inode *);
extern struct inode *new_inode_pseudo(struct super_block *sb);
extern struct inode *new_inode(struct super_block *sb);
+extern struct inode *simple_new_inode(struct super_block *sb);
extern void free_inode_nonrcu(struct inode *inode);
extern int should_remove_suid(struct dentry *);
extern int file_remove_privs(struct file *);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 49a05ba3000d..74c4f852a688 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -296,15 +296,13 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
struct inode *inode;
int ret = -ENOMEM;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto err;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_mtime = inode->i_ctime = inode->i_atime = current_time(inode);
if (S_ISREG(mode)) {
struct mqueue_inode_info *info;
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 95087d9f4ed3..532a733c474a 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -112,15 +112,10 @@ static struct inode *bpf_get_inode(struct super_block *sb,
return ERR_PTR(-EINVAL);
}
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
return ERR_PTR(-ENOSPC);
- inode->i_ino = get_next_ino();
- inode->i_atime = current_time(inode);
- inode->i_mtime = inode->i_atime;
- inode->i_ctime = inode->i_atime;
-
inode_init_owner(inode, dir, mode);
return inode;
diff --git a/mm/shmem.c b/mm/shmem.c
index f47347cb30f6..50ca377464e2 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2246,12 +2246,10 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
if (shmem_reserve_inode(sb))
return NULL;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
inode->i_blocks = 0;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_generation = prandom_u32();
info = SHMEM_I(inode);
memset(info, 0, (char *)inode - (char *)info);
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 39e14d5edaf1..fa48b8f55ba9 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -467,12 +467,10 @@ struct rpc_filelist {
static struct inode *
rpc_get_inode(struct super_block *sb, umode_t mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (!inode)
return NULL;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
switch (mode & S_IFMT) {
case S_IFDIR:
inode->i_fop = &simple_dir_operations;
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 75d70e6ba0a0..1a8afe9d7110 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -212,7 +212,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
const struct file_operations *fops,
const struct inode_operations *iops)
{
- struct inode *inode = new_inode(dir->i_sb);
+ struct inode *inode = simple_new_inode(dir->i_sb);
AA_BUG(!dir);
AA_BUG(!dentry);
@@ -220,9 +220,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
if (!inode)
return -ENOMEM;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = iops ? iops : &simple_dir_inode_operations;
@@ -2540,15 +2538,13 @@ static int aa_mk_null_file(struct dentry *parent)
error = PTR_ERR(dentry);
goto out;
}
- inode = new_inode(parent->d_inode->i_sb);
+ inode = simple_new_inode(parent->d_inode->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
}
- inode->i_ino = get_next_ino();
inode->i_mode = S_IFCHR | S_IRUGO | S_IWUGO;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO,
MKDEV(MEM_MAJOR, 3));
d_instantiate(dentry, inode);
diff --git a/security/inode.c b/security/inode.c
index 0fcd03299e0d..8a1a7f73ee9c 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -136,15 +136,13 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
goto out1;
}
- inode = new_inode(dir->i_sb);
+ inode = simple_new_inode(dir->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, linux-fsdevel, Manoj N. Kumar, Alexander Viro,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, Mike Marciniszyn, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
It is a common special case for new_inode to initialize the
time to the current time and the inode to get_next_ino().
Introduce a core function that does it and use it throughout
Linux.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
arch/powerpc/platforms/cell/spufs/inode.c | 4 +---
arch/s390/hypfs/inode.c | 4 +---
drivers/infiniband/hw/qib/qib_fs.c | 6 +-----
drivers/misc/ibmasm/ibmasmfs.c | 8 +++-----
drivers/oprofile/oprofilefs.c | 8 +++-----
drivers/usb/gadget/function/f_fs.c | 8 +-------
fs/autofs/inode.c | 4 +---
fs/binfmt_misc.c | 16 ++--------------
fs/debugfs/inode.c | 19 ++++---------------
fs/efivarfs/inode.c | 4 +---
fs/fuse/control.c | 4 +---
fs/hugetlbfs/inode.c | 8 ++------
fs/libfs.c | 12 ++++++++++++
fs/ocfs2/dlmfs/dlmfs.c | 8 ++------
fs/proc/base.c | 4 +---
fs/proc/proc_sysctl.c | 5 +----
fs/pstore/inode.c | 14 ++------------
fs/ramfs/inode.c | 4 +---
fs/tracefs/inode.c | 14 ++------------
include/linux/fs.h | 1 +
ipc/mqueue.c | 4 +---
kernel/bpf/inode.c | 7 +------
mm/shmem.c | 4 +---
net/sunrpc/rpc_pipe.c | 4 +---
security/apparmor/apparmorfs.c | 8 ++------
security/inode.c | 4 +---
26 files changed, 50 insertions(+), 136 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 25390569e24c..5167b11d41ed 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -77,15 +77,13 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
{
struct inode *inode;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto out;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
out:
return inode;
}
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 5c97f48cea91..97d11561f35c 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -93,15 +93,13 @@ static void hypfs_delete_tree(struct dentry *root)
static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode)
{
- struct inode *ret = new_inode(sb);
+ struct inode *ret = simple_new_inode(sb);
if (ret) {
struct hypfs_sb_info *hypfs_info = sb->s_fs_info;
- ret->i_ino = get_next_ino();
ret->i_mode = mode;
ret->i_uid = hypfs_info->uid;
ret->i_gid = hypfs_info->gid;
- ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
if (S_ISDIR(mode))
set_nlink(ret, 2);
}
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index e336d778e076..d402c3b1c552 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -53,21 +53,17 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
void *data)
{
int error;
- struct inode *inode = new_inode(dir->i_sb);
+ struct inode *inode = simple_new_inode(dir->i_sb);
if (!inode) {
error = -EPERM;
goto bail;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = GLOBAL_ROOT_UID;
inode->i_gid = GLOBAL_ROOT_GID;
inode->i_blocks = 0;
- inode->i_atime = current_time(inode);
- inode->i_mtime = inode->i_atime;
- inode->i_ctime = inode->i_atime;
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 35fec1bf1b3d..72aa02505f45 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -134,13 +134,11 @@ static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc)
static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
{
- struct inode *ret = new_inode(sb);
+ struct inode *ret = simple_new_inode(sb);
- if (ret) {
- ret->i_ino = get_next_ino();
+ if (ret)
ret->i_mode = mode;
- ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
- }
+
return ret;
}
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 0875f2f122b3..a903dff693c9 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -26,13 +26,11 @@ DEFINE_RAW_SPINLOCK(oprofilefs_lock);
static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
+ if (inode)
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
+
return inode;
}
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index c81023b195c3..d5ca23682f28 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1385,18 +1385,12 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
ENTER();
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (likely(inode)) {
- struct timespec64 ts = current_time(inode);
-
- inode->i_ino = get_next_ino();
inode->i_mode = perms->mode;
inode->i_uid = perms->uid;
inode->i_gid = perms->gid;
- inode->i_atime = ts;
- inode->i_mtime = ts;
- inode->i_ctime = ts;
inode->i_private = data;
if (fops)
inode->i_fop = fops;
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index 9edf243713eb..26710b7d5ade 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -359,7 +359,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (inode == NULL)
return NULL;
@@ -369,8 +369,6 @@ struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
inode->i_uid = d_inode(sb->s_root)->i_uid;
inode->i_gid = d_inode(sb->s_root)->i_gid;
}
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- inode->i_ino = get_next_ino();
if (S_ISDIR(mode)) {
set_nlink(inode, 2);
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 475096a02a1a..cd27039ffbdf 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -586,19 +586,6 @@ static void entry_status(Node *e, char *page)
}
}
-static struct inode *bm_get_inode(struct super_block *sb, int mode)
-{
- struct inode *inode = new_inode(sb);
-
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime =
- current_time(inode);
- }
- return inode;
-}
-
static void bm_evict_inode(struct inode *inode)
{
Node *e = inode->i_private;
@@ -711,12 +698,13 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (d_really_is_positive(dentry))
goto out2;
- inode = bm_get_inode(sb, S_IFREG | 0644);
+ inode = simple_new_inode(sb);
err = -ENOMEM;
if (!inode)
goto out2;
+ inode->i_mode = S_IFREG | 0644;
err = simple_pin_fs(&bm_fs, &bm_fs_type);
if (err) {
iput(inode);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index ea54efc74c0d..834b5872ca0d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -61,17 +61,6 @@ static const struct inode_operations debugfs_symlink_inode_operations = {
.setattr = debugfs_setattr,
};
-static struct inode *debugfs_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime =
- inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
struct debugfs_mount_opts {
kuid_t uid;
kgid_t gid;
@@ -383,7 +372,7 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create file '%s'\n",
name);
@@ -539,7 +528,7 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create directory '%s'\n",
name);
@@ -581,7 +570,7 @@ struct dentry *debugfs_create_automount(const char *name,
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create automount '%s'\n",
name);
@@ -639,7 +628,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
return dentry;
}
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create symlink '%s'\n",
name);
diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c
index 96c0c86f3fff..f8f459f43920 100644
--- a/fs/efivarfs/inode.c
+++ b/fs/efivarfs/inode.c
@@ -16,12 +16,10 @@ struct inode *efivarfs_get_inode(struct super_block *sb,
const struct inode *dir, int mode,
dev_t dev, bool is_removable)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_flags = is_removable ? 0 : S_IMMUTABLE;
switch (mode & S_IFMT) {
case S_IFREG:
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index c23f6f243ad4..6a9f35aca480 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -232,17 +232,15 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
if (!dentry)
return NULL;
- inode = new_inode(fuse_control_sb);
+ inode = simple_new_inode(fuse_control_sb);
if (!inode) {
dput(dentry);
return NULL;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = fc->user_id;
inode->i_gid = fc->group_id;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
/* setting ->i_op to NULL is not allowed */
if (iop)
inode->i_op = iop;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 991c60c7ffe0..4064389c2c23 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -739,13 +739,11 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
{
struct inode *inode;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode->i_mode = S_IFDIR | ctx->mode;
inode->i_uid = ctx->uid;
inode->i_gid = ctx->gid;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_op = &hugetlbfs_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
/* directory inodes start off with i_nlink == 2 (for "." entry) */
@@ -780,16 +778,14 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
return NULL;
}
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode);
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,
&hugetlbfs_i_mmap_rwsem_key);
inode->i_mapping->a_ops = &hugetlbfs_aops;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_mapping->private_data = resv_map;
info->seals = F_SEAL_SEAL;
switch (mode & S_IFMT) {
diff --git a/fs/libfs.c b/fs/libfs.c
index 26ec729f7bcd..20bdee9361d5 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
}
EXPORT_SYMBOL(simple_write_end);
+struct inode *simple_new_inode(struct super_block *sb)
+{
+ struct inode *inode = new_inode(sb);
+ if (inode) {
+ inode->i_ino = get_next_ino();
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_time(inode);
+ }
+ return inode;
+}
+EXPORT_SYMBOL(simple_new_inode);
+
/*
* the inodes created here are not hashed. If you use iunique to generate
* unique inode values later for this filesystem, then you must take care
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 8e4f1ace467c..6285c174f9f2 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -371,13 +371,11 @@ static void dlmfs_evict_inode(struct inode *inode)
static struct inode *dlmfs_get_root_inode(struct super_block *sb)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
umode_t mode = S_IFDIR | 0755;
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, NULL, mode);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inc_nlink(inode);
inode->i_fop = &simple_dir_operations;
@@ -392,15 +390,13 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
umode_t mode)
{
struct super_block *sb = parent->i_sb;
- struct inode * inode = new_inode(sb);
+ struct inode * inode = simple_new_inode(sb);
struct dlmfs_inode_private *ip;
if (!inode)
return NULL;
- inode->i_ino = get_next_ino();
inode_init_owner(inode, parent, mode);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
ip = DLMFS_I(inode);
ip->ip_conn = DLMFS_I(parent)->ip_conn;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 74f948a6b621..3ef16f4f14c9 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1856,15 +1856,13 @@ struct inode *proc_pid_make_inode(struct super_block * sb,
/* We need a new inode */
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto out;
/* Common stuff */
ei = PROC_I(inode);
inode->i_mode = mode;
- inode->i_ino = get_next_ino();
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_op = &proc_def_inode_operations;
/*
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index b6f5d459b087..3464ab94cf79 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -434,12 +434,10 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
struct inode *inode;
struct proc_inode *ei;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
return ERR_PTR(-ENOMEM);
- inode->i_ino = get_next_ino();
-
ei = PROC_I(inode);
spin_lock(&sysctl_lock);
@@ -454,7 +452,6 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
head->count++;
spin_unlock(&sysctl_lock);
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_mode = table->mode;
if (!S_ISDIR(table->mode)) {
inode->i_mode |= S_IFREG;
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index d99b5d39aa90..d6cad315a839 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -208,16 +208,6 @@ static const struct inode_operations pstore_dir_inode_operations = {
.unlink = pstore_unlink,
};
-static struct inode *pstore_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
enum {
Opt_kmsg_bytes, Opt_err
};
@@ -316,7 +306,7 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
return rc;
rc = -ENOMEM;
- inode = pstore_get_inode(root->d_sb);
+ inode = simple_new_inode(root->d_sb);
if (!inode)
goto fail;
inode->i_mode = S_IFREG | 0444;
@@ -394,7 +384,7 @@ static int pstore_fill_super(struct super_block *sb, void *data, int silent)
parse_options(data);
- inode = pstore_get_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
inode->i_mode = S_IFDIR | 0750;
inode->i_op = &pstore_dir_inode_operations;
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index ee179a81b3da..cf2ce7bc4c9d 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -63,15 +63,13 @@ static const struct address_space_operations ramfs_aops = {
struct inode *ramfs_get_inode(struct super_block *sb,
const struct inode *dir, umode_t mode, dev_t dev)
{
- struct inode * inode = new_inode(sb);
+ struct inode * inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
inode->i_mapping->a_ops = &ramfs_aops;
mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
mapping_set_unevictable(inode->i_mapping);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
switch (mode & S_IFMT) {
default:
init_special_inode(inode, mode, dev);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 40ccfe737c3a..a30837a8e1d4 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -124,16 +124,6 @@ static const struct inode_operations tracefs_dir_inode_operations = {
.rmdir = tracefs_syscall_rmdir,
};
-static struct inode *tracefs_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
struct tracefs_mount_opts {
kuid_t uid;
kgid_t gid;
@@ -403,7 +393,7 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return NULL;
- inode = tracefs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode))
return failed_creating(dentry);
@@ -424,7 +414,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
if (IS_ERR(dentry))
return NULL;
- inode = tracefs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode))
return failed_creating(dentry);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 55b679b89c8a..6136f5ba2680 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3088,6 +3088,7 @@ extern void clear_inode(struct inode *);
extern void __destroy_inode(struct inode *);
extern struct inode *new_inode_pseudo(struct super_block *sb);
extern struct inode *new_inode(struct super_block *sb);
+extern struct inode *simple_new_inode(struct super_block *sb);
extern void free_inode_nonrcu(struct inode *inode);
extern int should_remove_suid(struct dentry *);
extern int file_remove_privs(struct file *);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 49a05ba3000d..74c4f852a688 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -296,15 +296,13 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
struct inode *inode;
int ret = -ENOMEM;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto err;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_mtime = inode->i_ctime = inode->i_atime = current_time(inode);
if (S_ISREG(mode)) {
struct mqueue_inode_info *info;
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 95087d9f4ed3..532a733c474a 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -112,15 +112,10 @@ static struct inode *bpf_get_inode(struct super_block *sb,
return ERR_PTR(-EINVAL);
}
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
return ERR_PTR(-ENOSPC);
- inode->i_ino = get_next_ino();
- inode->i_atime = current_time(inode);
- inode->i_mtime = inode->i_atime;
- inode->i_ctime = inode->i_atime;
-
inode_init_owner(inode, dir, mode);
return inode;
diff --git a/mm/shmem.c b/mm/shmem.c
index f47347cb30f6..50ca377464e2 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2246,12 +2246,10 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
if (shmem_reserve_inode(sb))
return NULL;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
inode->i_blocks = 0;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_generation = prandom_u32();
info = SHMEM_I(inode);
memset(info, 0, (char *)inode - (char *)info);
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 39e14d5edaf1..fa48b8f55ba9 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -467,12 +467,10 @@ struct rpc_filelist {
static struct inode *
rpc_get_inode(struct super_block *sb, umode_t mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (!inode)
return NULL;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
switch (mode & S_IFMT) {
case S_IFDIR:
inode->i_fop = &simple_dir_operations;
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 75d70e6ba0a0..1a8afe9d7110 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -212,7 +212,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
const struct file_operations *fops,
const struct inode_operations *iops)
{
- struct inode *inode = new_inode(dir->i_sb);
+ struct inode *inode = simple_new_inode(dir->i_sb);
AA_BUG(!dir);
AA_BUG(!dentry);
@@ -220,9 +220,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
if (!inode)
return -ENOMEM;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = iops ? iops : &simple_dir_inode_operations;
@@ -2540,15 +2538,13 @@ static int aa_mk_null_file(struct dentry *parent)
error = PTR_ERR(dentry);
goto out;
}
- inode = new_inode(parent->d_inode->i_sb);
+ inode = simple_new_inode(parent->d_inode->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
}
- inode->i_ino = get_next_ino();
inode->i_mode = S_IFCHR | S_IRUGO | S_IWUGO;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO,
MKDEV(MEM_MAJOR, 3));
d_instantiate(dentry, inode);
diff --git a/security/inode.c b/security/inode.c
index 0fcd03299e0d..8a1a7f73ee9c 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -136,15 +136,13 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
goto out1;
}
- inode = new_inode(dir->i_sb);
+ inode = simple_new_inode(dir->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
It is a common special case for new_inode to initialize the
time to the current time and the inode to get_next_ino().
Introduce a core function that does it and use it throughout
Linux.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
arch/powerpc/platforms/cell/spufs/inode.c | 4 +---
arch/s390/hypfs/inode.c | 4 +---
drivers/infiniband/hw/qib/qib_fs.c | 6 +-----
drivers/misc/ibmasm/ibmasmfs.c | 8 +++-----
drivers/oprofile/oprofilefs.c | 8 +++-----
drivers/usb/gadget/function/f_fs.c | 8 +-------
fs/autofs/inode.c | 4 +---
fs/binfmt_misc.c | 16 ++--------------
fs/debugfs/inode.c | 19 ++++---------------
fs/efivarfs/inode.c | 4 +---
fs/fuse/control.c | 4 +---
fs/hugetlbfs/inode.c | 8 ++------
fs/libfs.c | 12 ++++++++++++
fs/ocfs2/dlmfs/dlmfs.c | 8 ++------
fs/proc/base.c | 4 +---
fs/proc/proc_sysctl.c | 5 +----
fs/pstore/inode.c | 14 ++------------
fs/ramfs/inode.c | 4 +---
fs/tracefs/inode.c | 14 ++------------
include/linux/fs.h | 1 +
ipc/mqueue.c | 4 +---
kernel/bpf/inode.c | 7 +------
mm/shmem.c | 4 +---
net/sunrpc/rpc_pipe.c | 4 +---
security/apparmor/apparmorfs.c | 8 ++------
security/inode.c | 4 +---
26 files changed, 50 insertions(+), 136 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 25390569e24c..5167b11d41ed 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -77,15 +77,13 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
{
struct inode *inode;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto out;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
out:
return inode;
}
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 5c97f48cea91..97d11561f35c 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -93,15 +93,13 @@ static void hypfs_delete_tree(struct dentry *root)
static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode)
{
- struct inode *ret = new_inode(sb);
+ struct inode *ret = simple_new_inode(sb);
if (ret) {
struct hypfs_sb_info *hypfs_info = sb->s_fs_info;
- ret->i_ino = get_next_ino();
ret->i_mode = mode;
ret->i_uid = hypfs_info->uid;
ret->i_gid = hypfs_info->gid;
- ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
if (S_ISDIR(mode))
set_nlink(ret, 2);
}
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index e336d778e076..d402c3b1c552 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -53,21 +53,17 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
void *data)
{
int error;
- struct inode *inode = new_inode(dir->i_sb);
+ struct inode *inode = simple_new_inode(dir->i_sb);
if (!inode) {
error = -EPERM;
goto bail;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = GLOBAL_ROOT_UID;
inode->i_gid = GLOBAL_ROOT_GID;
inode->i_blocks = 0;
- inode->i_atime = current_time(inode);
- inode->i_mtime = inode->i_atime;
- inode->i_ctime = inode->i_atime;
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 35fec1bf1b3d..72aa02505f45 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -134,13 +134,11 @@ static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc)
static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
{
- struct inode *ret = new_inode(sb);
+ struct inode *ret = simple_new_inode(sb);
- if (ret) {
- ret->i_ino = get_next_ino();
+ if (ret)
ret->i_mode = mode;
- ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
- }
+
return ret;
}
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 0875f2f122b3..a903dff693c9 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -26,13 +26,11 @@ DEFINE_RAW_SPINLOCK(oprofilefs_lock);
static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
+ if (inode)
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
+
return inode;
}
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index c81023b195c3..d5ca23682f28 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1385,18 +1385,12 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
ENTER();
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (likely(inode)) {
- struct timespec64 ts = current_time(inode);
-
- inode->i_ino = get_next_ino();
inode->i_mode = perms->mode;
inode->i_uid = perms->uid;
inode->i_gid = perms->gid;
- inode->i_atime = ts;
- inode->i_mtime = ts;
- inode->i_ctime = ts;
inode->i_private = data;
if (fops)
inode->i_fop = fops;
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index 9edf243713eb..26710b7d5ade 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -359,7 +359,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (inode == NULL)
return NULL;
@@ -369,8 +369,6 @@ struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
inode->i_uid = d_inode(sb->s_root)->i_uid;
inode->i_gid = d_inode(sb->s_root)->i_gid;
}
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- inode->i_ino = get_next_ino();
if (S_ISDIR(mode)) {
set_nlink(inode, 2);
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 475096a02a1a..cd27039ffbdf 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -586,19 +586,6 @@ static void entry_status(Node *e, char *page)
}
}
-static struct inode *bm_get_inode(struct super_block *sb, int mode)
-{
- struct inode *inode = new_inode(sb);
-
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime =
- current_time(inode);
- }
- return inode;
-}
-
static void bm_evict_inode(struct inode *inode)
{
Node *e = inode->i_private;
@@ -711,12 +698,13 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (d_really_is_positive(dentry))
goto out2;
- inode = bm_get_inode(sb, S_IFREG | 0644);
+ inode = simple_new_inode(sb);
err = -ENOMEM;
if (!inode)
goto out2;
+ inode->i_mode = S_IFREG | 0644;
err = simple_pin_fs(&bm_fs, &bm_fs_type);
if (err) {
iput(inode);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index ea54efc74c0d..834b5872ca0d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -61,17 +61,6 @@ static const struct inode_operations debugfs_symlink_inode_operations = {
.setattr = debugfs_setattr,
};
-static struct inode *debugfs_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime =
- inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
struct debugfs_mount_opts {
kuid_t uid;
kgid_t gid;
@@ -383,7 +372,7 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create file '%s'\n",
name);
@@ -539,7 +528,7 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create directory '%s'\n",
name);
@@ -581,7 +570,7 @@ struct dentry *debugfs_create_automount(const char *name,
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create automount '%s'\n",
name);
@@ -639,7 +628,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
return dentry;
}
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create symlink '%s'\n",
name);
diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c
index 96c0c86f3fff..f8f459f43920 100644
--- a/fs/efivarfs/inode.c
+++ b/fs/efivarfs/inode.c
@@ -16,12 +16,10 @@ struct inode *efivarfs_get_inode(struct super_block *sb,
const struct inode *dir, int mode,
dev_t dev, bool is_removable)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_flags = is_removable ? 0 : S_IMMUTABLE;
switch (mode & S_IFMT) {
case S_IFREG:
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index c23f6f243ad4..6a9f35aca480 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -232,17 +232,15 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
if (!dentry)
return NULL;
- inode = new_inode(fuse_control_sb);
+ inode = simple_new_inode(fuse_control_sb);
if (!inode) {
dput(dentry);
return NULL;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = fc->user_id;
inode->i_gid = fc->group_id;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
/* setting ->i_op to NULL is not allowed */
if (iop)
inode->i_op = iop;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 991c60c7ffe0..4064389c2c23 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -739,13 +739,11 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
{
struct inode *inode;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode->i_mode = S_IFDIR | ctx->mode;
inode->i_uid = ctx->uid;
inode->i_gid = ctx->gid;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_op = &hugetlbfs_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
/* directory inodes start off with i_nlink == 2 (for "." entry) */
@@ -780,16 +778,14 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
return NULL;
}
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode);
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,
&hugetlbfs_i_mmap_rwsem_key);
inode->i_mapping->a_ops = &hugetlbfs_aops;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_mapping->private_data = resv_map;
info->seals = F_SEAL_SEAL;
switch (mode & S_IFMT) {
diff --git a/fs/libfs.c b/fs/libfs.c
index 26ec729f7bcd..20bdee9361d5 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
}
EXPORT_SYMBOL(simple_write_end);
+struct inode *simple_new_inode(struct super_block *sb)
+{
+ struct inode *inode = new_inode(sb);
+ if (inode) {
+ inode->i_ino = get_next_ino();
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_time(inode);
+ }
+ return inode;
+}
+EXPORT_SYMBOL(simple_new_inode);
+
/*
* the inodes created here are not hashed. If you use iunique to generate
* unique inode values later for this filesystem, then you must take care
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 8e4f1ace467c..6285c174f9f2 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -371,13 +371,11 @@ static void dlmfs_evict_inode(struct inode *inode)
static struct inode *dlmfs_get_root_inode(struct super_block *sb)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
umode_t mode = S_IFDIR | 0755;
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, NULL, mode);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inc_nlink(inode);
inode->i_fop = &simple_dir_operations;
@@ -392,15 +390,13 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
umode_t mode)
{
struct super_block *sb = parent->i_sb;
- struct inode * inode = new_inode(sb);
+ struct inode * inode = simple_new_inode(sb);
struct dlmfs_inode_private *ip;
if (!inode)
return NULL;
- inode->i_ino = get_next_ino();
inode_init_owner(inode, parent, mode);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
ip = DLMFS_I(inode);
ip->ip_conn = DLMFS_I(parent)->ip_conn;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 74f948a6b621..3ef16f4f14c9 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1856,15 +1856,13 @@ struct inode *proc_pid_make_inode(struct super_block * sb,
/* We need a new inode */
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto out;
/* Common stuff */
ei = PROC_I(inode);
inode->i_mode = mode;
- inode->i_ino = get_next_ino();
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_op = &proc_def_inode_operations;
/*
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index b6f5d459b087..3464ab94cf79 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -434,12 +434,10 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
struct inode *inode;
struct proc_inode *ei;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
return ERR_PTR(-ENOMEM);
- inode->i_ino = get_next_ino();
-
ei = PROC_I(inode);
spin_lock(&sysctl_lock);
@@ -454,7 +452,6 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
head->count++;
spin_unlock(&sysctl_lock);
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_mode = table->mode;
if (!S_ISDIR(table->mode)) {
inode->i_mode |= S_IFREG;
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index d99b5d39aa90..d6cad315a839 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -208,16 +208,6 @@ static const struct inode_operations pstore_dir_inode_operations = {
.unlink = pstore_unlink,
};
-static struct inode *pstore_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
enum {
Opt_kmsg_bytes, Opt_err
};
@@ -316,7 +306,7 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
return rc;
rc = -ENOMEM;
- inode = pstore_get_inode(root->d_sb);
+ inode = simple_new_inode(root->d_sb);
if (!inode)
goto fail;
inode->i_mode = S_IFREG | 0444;
@@ -394,7 +384,7 @@ static int pstore_fill_super(struct super_block *sb, void *data, int silent)
parse_options(data);
- inode = pstore_get_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
inode->i_mode = S_IFDIR | 0750;
inode->i_op = &pstore_dir_inode_operations;
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index ee179a81b3da..cf2ce7bc4c9d 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -63,15 +63,13 @@ static const struct address_space_operations ramfs_aops = {
struct inode *ramfs_get_inode(struct super_block *sb,
const struct inode *dir, umode_t mode, dev_t dev)
{
- struct inode * inode = new_inode(sb);
+ struct inode * inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
inode->i_mapping->a_ops = &ramfs_aops;
mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
mapping_set_unevictable(inode->i_mapping);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
switch (mode & S_IFMT) {
default:
init_special_inode(inode, mode, dev);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 40ccfe737c3a..a30837a8e1d4 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -124,16 +124,6 @@ static const struct inode_operations tracefs_dir_inode_operations = {
.rmdir = tracefs_syscall_rmdir,
};
-static struct inode *tracefs_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
struct tracefs_mount_opts {
kuid_t uid;
kgid_t gid;
@@ -403,7 +393,7 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return NULL;
- inode = tracefs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode))
return failed_creating(dentry);
@@ -424,7 +414,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
if (IS_ERR(dentry))
return NULL;
- inode = tracefs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode))
return failed_creating(dentry);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 55b679b89c8a..6136f5ba2680 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3088,6 +3088,7 @@ extern void clear_inode(struct inode *);
extern void __destroy_inode(struct inode *);
extern struct inode *new_inode_pseudo(struct super_block *sb);
extern struct inode *new_inode(struct super_block *sb);
+extern struct inode *simple_new_inode(struct super_block *sb);
extern void free_inode_nonrcu(struct inode *inode);
extern int should_remove_suid(struct dentry *);
extern int file_remove_privs(struct file *);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 49a05ba3000d..74c4f852a688 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -296,15 +296,13 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
struct inode *inode;
int ret = -ENOMEM;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto err;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_mtime = inode->i_ctime = inode->i_atime = current_time(inode);
if (S_ISREG(mode)) {
struct mqueue_inode_info *info;
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 95087d9f4ed3..532a733c474a 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -112,15 +112,10 @@ static struct inode *bpf_get_inode(struct super_block *sb,
return ERR_PTR(-EINVAL);
}
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
return ERR_PTR(-ENOSPC);
- inode->i_ino = get_next_ino();
- inode->i_atime = current_time(inode);
- inode->i_mtime = inode->i_atime;
- inode->i_ctime = inode->i_atime;
-
inode_init_owner(inode, dir, mode);
return inode;
diff --git a/mm/shmem.c b/mm/shmem.c
index f47347cb30f6..50ca377464e2 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2246,12 +2246,10 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
if (shmem_reserve_inode(sb))
return NULL;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
inode->i_blocks = 0;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_generation = prandom_u32();
info = SHMEM_I(inode);
memset(info, 0, (char *)inode - (char *)info);
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 39e14d5edaf1..fa48b8f55ba9 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -467,12 +467,10 @@ struct rpc_filelist {
static struct inode *
rpc_get_inode(struct super_block *sb, umode_t mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (!inode)
return NULL;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
switch (mode & S_IFMT) {
case S_IFDIR:
inode->i_fop = &simple_dir_operations;
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 75d70e6ba0a0..1a8afe9d7110 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -212,7 +212,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
const struct file_operations *fops,
const struct inode_operations *iops)
{
- struct inode *inode = new_inode(dir->i_sb);
+ struct inode *inode = simple_new_inode(dir->i_sb);
AA_BUG(!dir);
AA_BUG(!dentry);
@@ -220,9 +220,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
if (!inode)
return -ENOMEM;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = iops ? iops : &simple_dir_inode_operations;
@@ -2540,15 +2538,13 @@ static int aa_mk_null_file(struct dentry *parent)
error = PTR_ERR(dentry);
goto out;
}
- inode = new_inode(parent->d_inode->i_sb);
+ inode = simple_new_inode(parent->d_inode->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
}
- inode->i_ino = get_next_ino();
inode->i_mode = S_IFCHR | S_IRUGO | S_IWUGO;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO,
MKDEV(MEM_MAJOR, 3));
d_instantiate(dentry, inode);
diff --git a/security/inode.c b/security/inode.c
index 0fcd03299e0d..8a1a7f73ee9c 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -136,15 +136,13 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
goto out1;
}
- inode = new_inode(dir->i_sb);
+ inode = simple_new_inode(dir->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
--
2.25.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh
It is a common special case for new_inode to initialize the
time to the current time and the inode to get_next_ino().
Introduce a core function that does it and use it throughout
Linux.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
arch/powerpc/platforms/cell/spufs/inode.c | 4 +---
arch/s390/hypfs/inode.c | 4 +---
drivers/infiniband/hw/qib/qib_fs.c | 6 +-----
drivers/misc/ibmasm/ibmasmfs.c | 8 +++-----
drivers/oprofile/oprofilefs.c | 8 +++-----
drivers/usb/gadget/function/f_fs.c | 8 +-------
fs/autofs/inode.c | 4 +---
fs/binfmt_misc.c | 16 ++--------------
fs/debugfs/inode.c | 19 ++++---------------
fs/efivarfs/inode.c | 4 +---
fs/fuse/control.c | 4 +---
fs/hugetlbfs/inode.c | 8 ++------
fs/libfs.c | 12 ++++++++++++
fs/ocfs2/dlmfs/dlmfs.c | 8 ++------
fs/proc/base.c | 4 +---
fs/proc/proc_sysctl.c | 5 +----
fs/pstore/inode.c | 14 ++------------
fs/ramfs/inode.c | 4 +---
fs/tracefs/inode.c | 14 ++------------
include/linux/fs.h | 1 +
ipc/mqueue.c | 4 +---
kernel/bpf/inode.c | 7 +------
mm/shmem.c | 4 +---
net/sunrpc/rpc_pipe.c | 4 +---
security/apparmor/apparmorfs.c | 8 ++------
security/inode.c | 4 +---
26 files changed, 50 insertions(+), 136 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 25390569e24c..5167b11d41ed 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -77,15 +77,13 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
{
struct inode *inode;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto out;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
out:
return inode;
}
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 5c97f48cea91..97d11561f35c 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -93,15 +93,13 @@ static void hypfs_delete_tree(struct dentry *root)
static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode)
{
- struct inode *ret = new_inode(sb);
+ struct inode *ret = simple_new_inode(sb);
if (ret) {
struct hypfs_sb_info *hypfs_info = sb->s_fs_info;
- ret->i_ino = get_next_ino();
ret->i_mode = mode;
ret->i_uid = hypfs_info->uid;
ret->i_gid = hypfs_info->gid;
- ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
if (S_ISDIR(mode))
set_nlink(ret, 2);
}
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index e336d778e076..d402c3b1c552 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -53,21 +53,17 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
void *data)
{
int error;
- struct inode *inode = new_inode(dir->i_sb);
+ struct inode *inode = simple_new_inode(dir->i_sb);
if (!inode) {
error = -EPERM;
goto bail;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = GLOBAL_ROOT_UID;
inode->i_gid = GLOBAL_ROOT_GID;
inode->i_blocks = 0;
- inode->i_atime = current_time(inode);
- inode->i_mtime = inode->i_atime;
- inode->i_ctime = inode->i_atime;
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 35fec1bf1b3d..72aa02505f45 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -134,13 +134,11 @@ static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc)
static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
{
- struct inode *ret = new_inode(sb);
+ struct inode *ret = simple_new_inode(sb);
- if (ret) {
- ret->i_ino = get_next_ino();
+ if (ret)
ret->i_mode = mode;
- ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
- }
+
return ret;
}
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 0875f2f122b3..a903dff693c9 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -26,13 +26,11 @@ DEFINE_RAW_SPINLOCK(oprofilefs_lock);
static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
+ if (inode)
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
+
return inode;
}
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index c81023b195c3..d5ca23682f28 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1385,18 +1385,12 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
ENTER();
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (likely(inode)) {
- struct timespec64 ts = current_time(inode);
-
- inode->i_ino = get_next_ino();
inode->i_mode = perms->mode;
inode->i_uid = perms->uid;
inode->i_gid = perms->gid;
- inode->i_atime = ts;
- inode->i_mtime = ts;
- inode->i_ctime = ts;
inode->i_private = data;
if (fops)
inode->i_fop = fops;
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index 9edf243713eb..26710b7d5ade 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -359,7 +359,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (inode == NULL)
return NULL;
@@ -369,8 +369,6 @@ struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
inode->i_uid = d_inode(sb->s_root)->i_uid;
inode->i_gid = d_inode(sb->s_root)->i_gid;
}
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- inode->i_ino = get_next_ino();
if (S_ISDIR(mode)) {
set_nlink(inode, 2);
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 475096a02a1a..cd27039ffbdf 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -586,19 +586,6 @@ static void entry_status(Node *e, char *page)
}
}
-static struct inode *bm_get_inode(struct super_block *sb, int mode)
-{
- struct inode *inode = new_inode(sb);
-
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime =
- current_time(inode);
- }
- return inode;
-}
-
static void bm_evict_inode(struct inode *inode)
{
Node *e = inode->i_private;
@@ -711,12 +698,13 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (d_really_is_positive(dentry))
goto out2;
- inode = bm_get_inode(sb, S_IFREG | 0644);
+ inode = simple_new_inode(sb);
err = -ENOMEM;
if (!inode)
goto out2;
+ inode->i_mode = S_IFREG | 0644;
err = simple_pin_fs(&bm_fs, &bm_fs_type);
if (err) {
iput(inode);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index ea54efc74c0d..834b5872ca0d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -61,17 +61,6 @@ static const struct inode_operations debugfs_symlink_inode_operations = {
.setattr = debugfs_setattr,
};
-static struct inode *debugfs_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime =
- inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
struct debugfs_mount_opts {
kuid_t uid;
kgid_t gid;
@@ -383,7 +372,7 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create file '%s'\n",
name);
@@ -539,7 +528,7 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create directory '%s'\n",
name);
@@ -581,7 +570,7 @@ struct dentry *debugfs_create_automount(const char *name,
if (IS_ERR(dentry))
return dentry;
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create automount '%s'\n",
name);
@@ -639,7 +628,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
return dentry;
}
- inode = debugfs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode)) {
pr_err("out of free dentries, can not create symlink '%s'\n",
name);
diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c
index 96c0c86f3fff..f8f459f43920 100644
--- a/fs/efivarfs/inode.c
+++ b/fs/efivarfs/inode.c
@@ -16,12 +16,10 @@ struct inode *efivarfs_get_inode(struct super_block *sb,
const struct inode *dir, int mode,
dev_t dev, bool is_removable)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_flags = is_removable ? 0 : S_IMMUTABLE;
switch (mode & S_IFMT) {
case S_IFREG:
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index c23f6f243ad4..6a9f35aca480 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -232,17 +232,15 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
if (!dentry)
return NULL;
- inode = new_inode(fuse_control_sb);
+ inode = simple_new_inode(fuse_control_sb);
if (!inode) {
dput(dentry);
return NULL;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = fc->user_id;
inode->i_gid = fc->group_id;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
/* setting ->i_op to NULL is not allowed */
if (iop)
inode->i_op = iop;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 991c60c7ffe0..4064389c2c23 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -739,13 +739,11 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
{
struct inode *inode;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode->i_mode = S_IFDIR | ctx->mode;
inode->i_uid = ctx->uid;
inode->i_gid = ctx->gid;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_op = &hugetlbfs_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
/* directory inodes start off with i_nlink == 2 (for "." entry) */
@@ -780,16 +778,14 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
return NULL;
}
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode);
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,
&hugetlbfs_i_mmap_rwsem_key);
inode->i_mapping->a_ops = &hugetlbfs_aops;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_mapping->private_data = resv_map;
info->seals = F_SEAL_SEAL;
switch (mode & S_IFMT) {
diff --git a/fs/libfs.c b/fs/libfs.c
index 26ec729f7bcd..20bdee9361d5 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
}
EXPORT_SYMBOL(simple_write_end);
+struct inode *simple_new_inode(struct super_block *sb)
+{
+ struct inode *inode = new_inode(sb);
+ if (inode) {
+ inode->i_ino = get_next_ino();
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_time(inode);
+ }
+ return inode;
+}
+EXPORT_SYMBOL(simple_new_inode);
+
/*
* the inodes created here are not hashed. If you use iunique to generate
* unique inode values later for this filesystem, then you must take care
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 8e4f1ace467c..6285c174f9f2 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -371,13 +371,11 @@ static void dlmfs_evict_inode(struct inode *inode)
static struct inode *dlmfs_get_root_inode(struct super_block *sb)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
umode_t mode = S_IFDIR | 0755;
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, NULL, mode);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inc_nlink(inode);
inode->i_fop = &simple_dir_operations;
@@ -392,15 +390,13 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
umode_t mode)
{
struct super_block *sb = parent->i_sb;
- struct inode * inode = new_inode(sb);
+ struct inode * inode = simple_new_inode(sb);
struct dlmfs_inode_private *ip;
if (!inode)
return NULL;
- inode->i_ino = get_next_ino();
inode_init_owner(inode, parent, mode);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
ip = DLMFS_I(inode);
ip->ip_conn = DLMFS_I(parent)->ip_conn;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 74f948a6b621..3ef16f4f14c9 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1856,15 +1856,13 @@ struct inode *proc_pid_make_inode(struct super_block * sb,
/* We need a new inode */
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto out;
/* Common stuff */
ei = PROC_I(inode);
inode->i_mode = mode;
- inode->i_ino = get_next_ino();
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_op = &proc_def_inode_operations;
/*
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index b6f5d459b087..3464ab94cf79 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -434,12 +434,10 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
struct inode *inode;
struct proc_inode *ei;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
return ERR_PTR(-ENOMEM);
- inode->i_ino = get_next_ino();
-
ei = PROC_I(inode);
spin_lock(&sysctl_lock);
@@ -454,7 +452,6 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
head->count++;
spin_unlock(&sysctl_lock);
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_mode = table->mode;
if (!S_ISDIR(table->mode)) {
inode->i_mode |= S_IFREG;
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index d99b5d39aa90..d6cad315a839 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -208,16 +208,6 @@ static const struct inode_operations pstore_dir_inode_operations = {
.unlink = pstore_unlink,
};
-static struct inode *pstore_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
enum {
Opt_kmsg_bytes, Opt_err
};
@@ -316,7 +306,7 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
return rc;
rc = -ENOMEM;
- inode = pstore_get_inode(root->d_sb);
+ inode = simple_new_inode(root->d_sb);
if (!inode)
goto fail;
inode->i_mode = S_IFREG | 0444;
@@ -394,7 +384,7 @@ static int pstore_fill_super(struct super_block *sb, void *data, int silent)
parse_options(data);
- inode = pstore_get_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
inode->i_mode = S_IFDIR | 0750;
inode->i_op = &pstore_dir_inode_operations;
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index ee179a81b3da..cf2ce7bc4c9d 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -63,15 +63,13 @@ static const struct address_space_operations ramfs_aops = {
struct inode *ramfs_get_inode(struct super_block *sb,
const struct inode *dir, umode_t mode, dev_t dev)
{
- struct inode * inode = new_inode(sb);
+ struct inode * inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
inode->i_mapping->a_ops = &ramfs_aops;
mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
mapping_set_unevictable(inode->i_mapping);
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
switch (mode & S_IFMT) {
default:
init_special_inode(inode, mode, dev);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 40ccfe737c3a..a30837a8e1d4 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -124,16 +124,6 @@ static const struct inode_operations tracefs_dir_inode_operations = {
.rmdir = tracefs_syscall_rmdir,
};
-static struct inode *tracefs_get_inode(struct super_block *sb)
-{
- struct inode *inode = new_inode(sb);
- if (inode) {
- inode->i_ino = get_next_ino();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
- }
- return inode;
-}
-
struct tracefs_mount_opts {
kuid_t uid;
kgid_t gid;
@@ -403,7 +393,7 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (IS_ERR(dentry))
return NULL;
- inode = tracefs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode))
return failed_creating(dentry);
@@ -424,7 +414,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
if (IS_ERR(dentry))
return NULL;
- inode = tracefs_get_inode(dentry->d_sb);
+ inode = simple_new_inode(dentry->d_sb);
if (unlikely(!inode))
return failed_creating(dentry);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 55b679b89c8a..6136f5ba2680 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3088,6 +3088,7 @@ extern void clear_inode(struct inode *);
extern void __destroy_inode(struct inode *);
extern struct inode *new_inode_pseudo(struct super_block *sb);
extern struct inode *new_inode(struct super_block *sb);
+extern struct inode *simple_new_inode(struct super_block *sb);
extern void free_inode_nonrcu(struct inode *inode);
extern int should_remove_suid(struct dentry *);
extern int file_remove_privs(struct file *);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 49a05ba3000d..74c4f852a688 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -296,15 +296,13 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
struct inode *inode;
int ret = -ENOMEM;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
goto err;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_mtime = inode->i_ctime = inode->i_atime = current_time(inode);
if (S_ISREG(mode)) {
struct mqueue_inode_info *info;
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 95087d9f4ed3..532a733c474a 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -112,15 +112,10 @@ static struct inode *bpf_get_inode(struct super_block *sb,
return ERR_PTR(-EINVAL);
}
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (!inode)
return ERR_PTR(-ENOSPC);
- inode->i_ino = get_next_ino();
- inode->i_atime = current_time(inode);
- inode->i_mtime = inode->i_atime;
- inode->i_ctime = inode->i_atime;
-
inode_init_owner(inode, dir, mode);
return inode;
diff --git a/mm/shmem.c b/mm/shmem.c
index f47347cb30f6..50ca377464e2 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2246,12 +2246,10 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
if (shmem_reserve_inode(sb))
return NULL;
- inode = new_inode(sb);
+ inode = simple_new_inode(sb);
if (inode) {
- inode->i_ino = get_next_ino();
inode_init_owner(inode, dir, mode);
inode->i_blocks = 0;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_generation = prandom_u32();
info = SHMEM_I(inode);
memset(info, 0, (char *)inode - (char *)info);
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 39e14d5edaf1..fa48b8f55ba9 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -467,12 +467,10 @@ struct rpc_filelist {
static struct inode *
rpc_get_inode(struct super_block *sb, umode_t mode)
{
- struct inode *inode = new_inode(sb);
+ struct inode *inode = simple_new_inode(sb);
if (!inode)
return NULL;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
switch (mode & S_IFMT) {
case S_IFDIR:
inode->i_fop = &simple_dir_operations;
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 75d70e6ba0a0..1a8afe9d7110 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -212,7 +212,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
const struct file_operations *fops,
const struct inode_operations *iops)
{
- struct inode *inode = new_inode(dir->i_sb);
+ struct inode *inode = simple_new_inode(dir->i_sb);
AA_BUG(!dir);
AA_BUG(!dentry);
@@ -220,9 +220,7 @@ static int __aafs_setup_d_inode(struct inode *dir, struct dentry *dentry,
if (!inode)
return -ENOMEM;
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = iops ? iops : &simple_dir_inode_operations;
@@ -2540,15 +2538,13 @@ static int aa_mk_null_file(struct dentry *parent)
error = PTR_ERR(dentry);
goto out;
}
- inode = new_inode(parent->d_inode->i_sb);
+ inode = simple_new_inode(parent->d_inode->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
}
- inode->i_ino = get_next_ino();
inode->i_mode = S_IFCHR | S_IRUGO | S_IWUGO;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO,
MKDEV(MEM_MAJOR, 3));
d_instantiate(dentry, inode);
diff --git a/security/inode.c b/security/inode.c
index 0fcd03299e0d..8a1a7f73ee9c 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -136,15 +136,13 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode,
goto out1;
}
- inode = new_inode(dir->i_sb);
+ inode = simple_new_inode(dir->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
}
- inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
inode->i_private = data;
if (S_ISDIR(mode)) {
inode->i_op = &simple_dir_inode_operations;
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
Start adding file creation wrappers, the simplest returns an anonymous
inode.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/api.c | 2 +-
drivers/scsi/cxlflash/ocxl_hw.c | 2 +-
fs/simplefs.c | 6 ++++++
include/linux/simplefs.h | 2 ++
5 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index b4b357725be2..4e4ea1bf312c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -539,7 +539,7 @@ static struct inode *drm_fs_inode_new(void)
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&drm_fs);
if (IS_ERR(inode))
simple_release_fs(&drm_fs);
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 6c6566d8bc17..a3d2682eb3a7 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -73,7 +73,7 @@ static struct file *cxl_getfile(const char *name,
goto err_module;
}
- inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&cxl_fs);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 23afde0c6c0e..770fdf186028 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -86,7 +86,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&ocxlflash_fs);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 790d8beb9cc3..c59eb8d996be 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -36,3 +36,9 @@ void simple_release_fs(struct simple_fs *fs)
mntput(mnt);
}
EXPORT_SYMBOL(simple_release_fs);
+
+struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
+{
+ return alloc_anon_inode(fs->mount->mnt_sb);
+}
+EXPORT_SYMBOL(simple_alloc_anon_inode);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 18010414a16f..c62ab526414e 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -12,4 +12,6 @@ struct simple_fs {
extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
extern void simple_release_fs(struct simple_fs *);
+extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+
#endif
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Paolo Bonzini, Emanuele Giuseppe Esposito, Jeremy Kerr,
Arnd Bergmann, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, Trond Myklebust, Anna Schumaker,
J. Bruce Fields, Chuck Lever, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
Start adding file creation wrappers, the simplest returns an anonymous
inode.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/api.c | 2 +-
drivers/scsi/cxlflash/ocxl_hw.c | 2 +-
fs/simplefs.c | 6 ++++++
include/linux/simplefs.h | 2 ++
5 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index b4b357725be2..4e4ea1bf312c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -539,7 +539,7 @@ static struct inode *drm_fs_inode_new(void)
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&drm_fs);
if (IS_ERR(inode))
simple_release_fs(&drm_fs);
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 6c6566d8bc17..a3d2682eb3a7 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -73,7 +73,7 @@ static struct file *cxl_getfile(const char *name,
goto err_module;
}
- inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&cxl_fs);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 23afde0c6c0e..770fdf186028 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -86,7 +86,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&ocxlflash_fs);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 790d8beb9cc3..c59eb8d996be 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -36,3 +36,9 @@ void simple_release_fs(struct simple_fs *fs)
mntput(mnt);
}
EXPORT_SYMBOL(simple_release_fs);
+
+struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
+{
+ return alloc_anon_inode(fs->mount->mnt_sb);
+}
+EXPORT_SYMBOL(simple_alloc_anon_inode);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 18010414a16f..c62ab526414e 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -12,4 +12,6 @@ struct simple_fs {
extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
extern void simple_release_fs(struct simple_fs *);
+extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+
#endif
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, linux-fsdevel, Manoj N. Kumar, Alexander Viro,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, Mike Marciniszyn, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
Start adding file creation wrappers, the simplest returns an anonymous
inode.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/api.c | 2 +-
drivers/scsi/cxlflash/ocxl_hw.c | 2 +-
fs/simplefs.c | 6 ++++++
include/linux/simplefs.h | 2 ++
5 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index b4b357725be2..4e4ea1bf312c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -539,7 +539,7 @@ static struct inode *drm_fs_inode_new(void)
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&drm_fs);
if (IS_ERR(inode))
simple_release_fs(&drm_fs);
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 6c6566d8bc17..a3d2682eb3a7 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -73,7 +73,7 @@ static struct file *cxl_getfile(const char *name,
goto err_module;
}
- inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&cxl_fs);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 23afde0c6c0e..770fdf186028 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -86,7 +86,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&ocxlflash_fs);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 790d8beb9cc3..c59eb8d996be 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -36,3 +36,9 @@ void simple_release_fs(struct simple_fs *fs)
mntput(mnt);
}
EXPORT_SYMBOL(simple_release_fs);
+
+struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
+{
+ return alloc_anon_inode(fs->mount->mnt_sb);
+}
+EXPORT_SYMBOL(simple_alloc_anon_inode);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 18010414a16f..c62ab526414e 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -12,4 +12,6 @@ struct simple_fs {
extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
extern void simple_release_fs(struct simple_fs *);
+extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+
#endif
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
Start adding file creation wrappers, the simplest returns an anonymous
inode.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/api.c | 2 +-
drivers/scsi/cxlflash/ocxl_hw.c | 2 +-
fs/simplefs.c | 6 ++++++
include/linux/simplefs.h | 2 ++
5 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index b4b357725be2..4e4ea1bf312c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -539,7 +539,7 @@ static struct inode *drm_fs_inode_new(void)
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&drm_fs);
if (IS_ERR(inode))
simple_release_fs(&drm_fs);
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 6c6566d8bc17..a3d2682eb3a7 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -73,7 +73,7 @@ static struct file *cxl_getfile(const char *name,
goto err_module;
}
- inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&cxl_fs);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 23afde0c6c0e..770fdf186028 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -86,7 +86,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&ocxlflash_fs);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 790d8beb9cc3..c59eb8d996be 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -36,3 +36,9 @@ void simple_release_fs(struct simple_fs *fs)
mntput(mnt);
}
EXPORT_SYMBOL(simple_release_fs);
+
+struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
+{
+ return alloc_anon_inode(fs->mount->mnt_sb);
+}
+EXPORT_SYMBOL(simple_alloc_anon_inode);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 18010414a16f..c62ab526414e 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -12,4 +12,6 @@ struct simple_fs {
extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
extern void simple_release_fs(struct simple_fs *);
+extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+
#endif
--
2.25.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
@ 2020-04-14 12:42 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:42 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh
Start adding file creation wrappers, the simplest returns an anonymous
inode.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/misc/cxl/api.c | 2 +-
drivers/scsi/cxlflash/ocxl_hw.c | 2 +-
fs/simplefs.c | 6 ++++++
include/linux/simplefs.h | 2 ++
5 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index b4b357725be2..4e4ea1bf312c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -539,7 +539,7 @@ static struct inode *drm_fs_inode_new(void)
return ERR_PTR(r);
}
- inode = alloc_anon_inode(drm_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&drm_fs);
if (IS_ERR(inode))
simple_release_fs(&drm_fs);
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 6c6566d8bc17..a3d2682eb3a7 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -73,7 +73,7 @@ static struct file *cxl_getfile(const char *name,
goto err_module;
}
- inode = alloc_anon_inode(cxl_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&cxl_fs);
if (IS_ERR(inode)) {
file = ERR_CAST(inode);
goto err_fs;
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
index 23afde0c6c0e..770fdf186028 100644
--- a/drivers/scsi/cxlflash/ocxl_hw.c
+++ b/drivers/scsi/cxlflash/ocxl_hw.c
@@ -86,7 +86,7 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto err2;
}
- inode = alloc_anon_inode(ocxlflash_fs.mount->mnt_sb);
+ inode = simple_alloc_anon_inode(&ocxlflash_fs);
if (IS_ERR(inode)) {
rc = PTR_ERR(inode);
dev_err(dev, "%s: alloc_anon_inode failed rc=%d\n",
diff --git a/fs/simplefs.c b/fs/simplefs.c
index 790d8beb9cc3..c59eb8d996be 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -36,3 +36,9 @@ void simple_release_fs(struct simple_fs *fs)
mntput(mnt);
}
EXPORT_SYMBOL(simple_release_fs);
+
+struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
+{
+ return alloc_anon_inode(fs->mount->mnt_sb);
+}
+EXPORT_SYMBOL(simple_alloc_anon_inode);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index 18010414a16f..c62ab526414e 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -12,4 +12,6 @@ struct simple_fs {
extern int simple_pin_fs(struct simple_fs *, struct file_system_type *);
extern void simple_release_fs(struct simple_fs *);
+extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+
#endif
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 6/8] simplefs: add file creation functions
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
A bunch of code is duplicated between debugfs and tracefs, unify it to the
simplefs library.
The code is very similar, except that dentry and inode creation are unified
into a single function (unlike start_creating in debugfs and tracefs, which
only takes care of dentries). This adds an output parameter to the creation
functions, but pushes all error recovery into fs/simplefs.c.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
include/linux/simplefs.h | 19 +++++
2 files changed, 169 insertions(+)
diff --git a/fs/simplefs.c b/fs/simplefs.c
index c59eb8d996be..3e48a288beb3 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/simplefs.h>
#include <linux/mount.h>
+#include <linux/namei.h>
+#include <linux/fsnotify.h>
static DEFINE_SPINLOCK(pin_fs_lock);
@@ -42,3 +44,151 @@ struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
return alloc_anon_inode(fs->mount->mnt_sb);
}
EXPORT_SYMBOL(simple_alloc_anon_inode);
+
+static struct dentry *failed_creating(struct simple_fs *fs, struct dentry *dentry)
+{
+ inode_unlock(d_inode(dentry->d_parent));
+ dput(dentry);
+ simple_release_fs(fs);
+ return ERR_PTR(-ENOMEM);
+}
+
+struct dentry *simplefs_create_dentry(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+ int error;
+
+ pr_debug("creating file '%s'\n", name);
+
+ if (IS_ERR(parent))
+ return parent;
+
+ error = simple_pin_fs(fs, type);
+ if (error) {
+ pr_err("Unable to pin filesystem for file '%s'\n", name);
+ return ERR_PTR(error);
+ }
+
+ /* If the parent is not specified, we create it in the root.
+ * We need the root dentry to do this, which is in the super
+ * block. A pointer to that is in the struct vfsmount that we
+ * have around.
+ */
+ if (!parent)
+ parent = fs->mount->mnt_root;
+
+ inode_lock(d_inode(parent));
+ dentry = lookup_one_len(name, parent, strlen(name));
+ if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
+ if (d_is_dir(dentry))
+ pr_err("Directory '%s' with parent '%s' already present!\n",
+ name, parent->d_name.name);
+ else
+ pr_err("File '%s' in directory '%s' already present!\n",
+ name, parent->d_name.name);
+ dput(dentry);
+ dentry = ERR_PTR(-EEXIST);
+ }
+
+ if (IS_ERR(dentry)) {
+ inode_unlock(d_inode(parent));
+ simple_release_fs(fs);
+ }
+
+
+ if (IS_ERR(dentry))
+ return dentry;
+
+ *inode = simple_new_inode(fs->mount->mnt_sb);
+ if (unlikely(!(*inode))) {
+ pr_err("out of free inodes, can not create file '%s'\n",
+ name);
+ return failed_creating(fs, dentry);
+ }
+
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_dentry);
+
+struct dentry *simplefs_create_file(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode,
+ struct dentry *parent, void *data,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+
+ WARN_ON((mode & S_IFMT) && !S_ISREG(mode));
+ mode |= S_IFREG;
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+
+ if (IS_ERR(dentry))
+ return dentry;
+
+ (*inode)->i_mode = mode;
+ (*inode)->i_private = data;
+
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_file);
+
+struct dentry *simplefs_finish_dentry(struct dentry *dentry, struct inode *inode)
+{
+ d_instantiate(dentry, inode);
+ if (S_ISDIR(inode->i_mode)) {
+ inc_nlink(d_inode(dentry->d_parent));
+ fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
+ } else {
+ fsnotify_create(d_inode(dentry->d_parent), dentry);
+ }
+ inode_unlock(d_inode(dentry->d_parent));
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_finish_dentry);
+
+struct dentry *simplefs_create_dir(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode, struct dentry *parent,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+
+ WARN_ON((mode & S_IFMT) && !S_ISDIR(mode));
+ mode |= S_IFDIR;
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+ if (IS_ERR(dentry))
+ return dentry;
+
+ (*inode)->i_mode = mode;
+ (*inode)->i_op = &simple_dir_inode_operations;
+ (*inode)->i_fop = &simple_dir_operations;
+
+ /* directory inodes start off with i_nlink == 2 (for "." entry) */
+ inc_nlink(*inode);
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_dir);
+
+struct dentry *simplefs_create_symlink(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ const char *target, struct inode **inode)
+{
+ struct dentry *dentry;
+ char *link = kstrdup(target, GFP_KERNEL);
+ if (!link)
+ return ERR_PTR(-ENOMEM);
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+ if (IS_ERR(dentry)) {
+ kfree_link(link);
+ return dentry;
+ }
+
+ (*inode)->i_mode = S_IFLNK | S_IRWXUGO;
+ (*inode)->i_link = link;
+ (*inode)->i_op = &simple_symlink_inode_operations;
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_symlink);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index c62ab526414e..cc53eed0bc3d 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -14,4 +14,23 @@ extern void simple_release_fs(struct simple_fs *);
extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+extern struct dentry *simplefs_create_dentry(struct simple_fs *fs,
+ struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ struct inode **inode);
+struct dentry *simplefs_finish_dentry(struct dentry *dentry, struct inode *inode);
+
+extern struct dentry *simplefs_create_file(struct simple_fs *fs,
+ struct file_system_type *type,
+ const char *name, umode_t mode,
+ struct dentry *parent, void *data,
+ struct inode **inode);
+extern struct dentry *simplefs_create_dir(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode, struct dentry *parent,
+ struct inode **inode);
+extern struct dentry *simplefs_create_symlink(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ const char *target, struct inode **inode);
+
+
#endif
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Paolo Bonzini, Emanuele Giuseppe Esposito, Jeremy Kerr,
Arnd Bergmann, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
A bunch of code is duplicated between debugfs and tracefs, unify it to the
simplefs library.
The code is very similar, except that dentry and inode creation are unified
into a single function (unlike start_creating in debugfs and tracefs, which
only takes care of dentries). This adds an output parameter to the creation
functions, but pushes all error recovery into fs/simplefs.c.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
include/linux/simplefs.h | 19 +++++
2 files changed, 169 insertions(+)
diff --git a/fs/simplefs.c b/fs/simplefs.c
index c59eb8d996be..3e48a288beb3 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/simplefs.h>
#include <linux/mount.h>
+#include <linux/namei.h>
+#include <linux/fsnotify.h>
static DEFINE_SPINLOCK(pin_fs_lock);
@@ -42,3 +44,151 @@ struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
return alloc_anon_inode(fs->mount->mnt_sb);
}
EXPORT_SYMBOL(simple_alloc_anon_inode);
+
+static struct dentry *failed_creating(struct simple_fs *fs, struct dentry *dentry)
+{
+ inode_unlock(d_inode(dentry->d_parent));
+ dput(dentry);
+ simple_release_fs(fs);
+ return ERR_PTR(-ENOMEM);
+}
+
+struct dentry *simplefs_create_dentry(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+ int error;
+
+ pr_debug("creating file '%s'\n", name);
+
+ if (IS_ERR(parent))
+ return parent;
+
+ error = simple_pin_fs(fs, type);
+ if (error) {
+ pr_err("Unable to pin filesystem for file '%s'\n", name);
+ return ERR_PTR(error);
+ }
+
+ /* If the parent is not specified, we create it in the root.
+ * We need the root dentry to do this, which is in the super
+ * block. A pointer to that is in the struct vfsmount that we
+ * have around.
+ */
+ if (!parent)
+ parent = fs->mount->mnt_root;
+
+ inode_lock(d_inode(parent));
+ dentry = lookup_one_len(name, parent, strlen(name));
+ if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
+ if (d_is_dir(dentry))
+ pr_err("Directory '%s' with parent '%s' already present!\n",
+ name, parent->d_name.name);
+ else
+ pr_err("File '%s' in directory '%s' already present!\n",
+ name, parent->d_name.name);
+ dput(dentry);
+ dentry = ERR_PTR(-EEXIST);
+ }
+
+ if (IS_ERR(dentry)) {
+ inode_unlock(d_inode(parent));
+ simple_release_fs(fs);
+ }
+
+
+ if (IS_ERR(dentry))
+ return dentry;
+
+ *inode = simple_new_inode(fs->mount->mnt_sb);
+ if (unlikely(!(*inode))) {
+ pr_err("out of free inodes, can not create file '%s'\n",
+ name);
+ return failed_creating(fs, dentry);
+ }
+
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_dentry);
+
+struct dentry *simplefs_create_file(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode,
+ struct dentry *parent, void *data,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+
+ WARN_ON((mode & S_IFMT) && !S_ISREG(mode));
+ mode |= S_IFREG;
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+
+ if (IS_ERR(dentry))
+ return dentry;
+
+ (*inode)->i_mode = mode;
+ (*inode)->i_private = data;
+
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_file);
+
+struct dentry *simplefs_finish_dentry(struct dentry *dentry, struct inode *inode)
+{
+ d_instantiate(dentry, inode);
+ if (S_ISDIR(inode->i_mode)) {
+ inc_nlink(d_inode(dentry->d_parent));
+ fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
+ } else {
+ fsnotify_create(d_inode(dentry->d_parent), dentry);
+ }
+ inode_unlock(d_inode(dentry->d_parent));
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_finish_dentry);
+
+struct dentry *simplefs_create_dir(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode, struct dentry *parent,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+
+ WARN_ON((mode & S_IFMT) && !S_ISDIR(mode));
+ mode |= S_IFDIR;
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+ if (IS_ERR(dentry))
+ return dentry;
+
+ (*inode)->i_mode = mode;
+ (*inode)->i_op = &simple_dir_inode_operations;
+ (*inode)->i_fop = &simple_dir_operations;
+
+ /* directory inodes start off with i_nlink == 2 (for "." entry) */
+ inc_nlink(*inode);
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_dir);
+
+struct dentry *simplefs_create_symlink(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ const char *target, struct inode **inode)
+{
+ struct dentry *dentry;
+ char *link = kstrdup(target, GFP_KERNEL);
+ if (!link)
+ return ERR_PTR(-ENOMEM);
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+ if (IS_ERR(dentry)) {
+ kfree_link(link);
+ return dentry;
+ }
+
+ (*inode)->i_mode = S_IFLNK | S_IRWXUGO;
+ (*inode)->i_link = link;
+ (*inode)->i_op = &simple_symlink_inode_operations;
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_symlink);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index c62ab526414e..cc53eed0bc3d 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -14,4 +14,23 @@ extern void simple_release_fs(struct simple_fs *);
extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+extern struct dentry *simplefs_create_dentry(struct simple_fs *fs,
+ struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ struct inode **inode);
+struct dentry *simplefs_finish_dentry(struct dentry *dentry, struct inode *inode);
+
+extern struct dentry *simplefs_create_file(struct simple_fs *fs,
+ struct file_system_type *type,
+ const char *name, umode_t mode,
+ struct dentry *parent, void *data,
+ struct inode **inode);
+extern struct dentry *simplefs_create_dir(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode, struct dentry *parent,
+ struct inode **inode);
+extern struct dentry *simplefs_create_symlink(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ const char *target, struct inode **inode);
+
+
#endif
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, linux-fsdevel, Manoj N. Kumar, Alexander Viro,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, Mike Marciniszyn, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
A bunch of code is duplicated between debugfs and tracefs, unify it to the
simplefs library.
The code is very similar, except that dentry and inode creation are unified
into a single function (unlike start_creating in debugfs and tracefs, which
only takes care of dentries). This adds an output parameter to the creation
functions, but pushes all error recovery into fs/simplefs.c.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
include/linux/simplefs.h | 19 +++++
2 files changed, 169 insertions(+)
diff --git a/fs/simplefs.c b/fs/simplefs.c
index c59eb8d996be..3e48a288beb3 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/simplefs.h>
#include <linux/mount.h>
+#include <linux/namei.h>
+#include <linux/fsnotify.h>
static DEFINE_SPINLOCK(pin_fs_lock);
@@ -42,3 +44,151 @@ struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
return alloc_anon_inode(fs->mount->mnt_sb);
}
EXPORT_SYMBOL(simple_alloc_anon_inode);
+
+static struct dentry *failed_creating(struct simple_fs *fs, struct dentry *dentry)
+{
+ inode_unlock(d_inode(dentry->d_parent));
+ dput(dentry);
+ simple_release_fs(fs);
+ return ERR_PTR(-ENOMEM);
+}
+
+struct dentry *simplefs_create_dentry(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+ int error;
+
+ pr_debug("creating file '%s'\n", name);
+
+ if (IS_ERR(parent))
+ return parent;
+
+ error = simple_pin_fs(fs, type);
+ if (error) {
+ pr_err("Unable to pin filesystem for file '%s'\n", name);
+ return ERR_PTR(error);
+ }
+
+ /* If the parent is not specified, we create it in the root.
+ * We need the root dentry to do this, which is in the super
+ * block. A pointer to that is in the struct vfsmount that we
+ * have around.
+ */
+ if (!parent)
+ parent = fs->mount->mnt_root;
+
+ inode_lock(d_inode(parent));
+ dentry = lookup_one_len(name, parent, strlen(name));
+ if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
+ if (d_is_dir(dentry))
+ pr_err("Directory '%s' with parent '%s' already present!\n",
+ name, parent->d_name.name);
+ else
+ pr_err("File '%s' in directory '%s' already present!\n",
+ name, parent->d_name.name);
+ dput(dentry);
+ dentry = ERR_PTR(-EEXIST);
+ }
+
+ if (IS_ERR(dentry)) {
+ inode_unlock(d_inode(parent));
+ simple_release_fs(fs);
+ }
+
+
+ if (IS_ERR(dentry))
+ return dentry;
+
+ *inode = simple_new_inode(fs->mount->mnt_sb);
+ if (unlikely(!(*inode))) {
+ pr_err("out of free inodes, can not create file '%s'\n",
+ name);
+ return failed_creating(fs, dentry);
+ }
+
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_dentry);
+
+struct dentry *simplefs_create_file(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode,
+ struct dentry *parent, void *data,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+
+ WARN_ON((mode & S_IFMT) && !S_ISREG(mode));
+ mode |= S_IFREG;
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+
+ if (IS_ERR(dentry))
+ return dentry;
+
+ (*inode)->i_mode = mode;
+ (*inode)->i_private = data;
+
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_file);
+
+struct dentry *simplefs_finish_dentry(struct dentry *dentry, struct inode *inode)
+{
+ d_instantiate(dentry, inode);
+ if (S_ISDIR(inode->i_mode)) {
+ inc_nlink(d_inode(dentry->d_parent));
+ fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
+ } else {
+ fsnotify_create(d_inode(dentry->d_parent), dentry);
+ }
+ inode_unlock(d_inode(dentry->d_parent));
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_finish_dentry);
+
+struct dentry *simplefs_create_dir(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode, struct dentry *parent,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+
+ WARN_ON((mode & S_IFMT) && !S_ISDIR(mode));
+ mode |= S_IFDIR;
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+ if (IS_ERR(dentry))
+ return dentry;
+
+ (*inode)->i_mode = mode;
+ (*inode)->i_op = &simple_dir_inode_operations;
+ (*inode)->i_fop = &simple_dir_operations;
+
+ /* directory inodes start off with i_nlink == 2 (for "." entry) */
+ inc_nlink(*inode);
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_dir);
+
+struct dentry *simplefs_create_symlink(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ const char *target, struct inode **inode)
+{
+ struct dentry *dentry;
+ char *link = kstrdup(target, GFP_KERNEL);
+ if (!link)
+ return ERR_PTR(-ENOMEM);
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+ if (IS_ERR(dentry)) {
+ kfree_link(link);
+ return dentry;
+ }
+
+ (*inode)->i_mode = S_IFLNK | S_IRWXUGO;
+ (*inode)->i_link = link;
+ (*inode)->i_op = &simple_symlink_inode_operations;
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_symlink);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index c62ab526414e..cc53eed0bc3d 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -14,4 +14,23 @@ extern void simple_release_fs(struct simple_fs *);
extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+extern struct dentry *simplefs_create_dentry(struct simple_fs *fs,
+ struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ struct inode **inode);
+struct dentry *simplefs_finish_dentry(struct dentry *dentry, struct inode *inode);
+
+extern struct dentry *simplefs_create_file(struct simple_fs *fs,
+ struct file_system_type *type,
+ const char *name, umode_t mode,
+ struct dentry *parent, void *data,
+ struct inode **inode);
+extern struct dentry *simplefs_create_dir(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode, struct dentry *parent,
+ struct inode **inode);
+extern struct dentry *simplefs_create_symlink(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ const char *target, struct inode **inode);
+
+
#endif
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
A bunch of code is duplicated between debugfs and tracefs, unify it to the
simplefs library.
The code is very similar, except that dentry and inode creation are unified
into a single function (unlike start_creating in debugfs and tracefs, which
only takes care of dentries). This adds an output parameter to the creation
functions, but pushes all error recovery into fs/simplefs.c.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
include/linux/simplefs.h | 19 +++++
2 files changed, 169 insertions(+)
diff --git a/fs/simplefs.c b/fs/simplefs.c
index c59eb8d996be..3e48a288beb3 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/simplefs.h>
#include <linux/mount.h>
+#include <linux/namei.h>
+#include <linux/fsnotify.h>
static DEFINE_SPINLOCK(pin_fs_lock);
@@ -42,3 +44,151 @@ struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
return alloc_anon_inode(fs->mount->mnt_sb);
}
EXPORT_SYMBOL(simple_alloc_anon_inode);
+
+static struct dentry *failed_creating(struct simple_fs *fs, struct dentry *dentry)
+{
+ inode_unlock(d_inode(dentry->d_parent));
+ dput(dentry);
+ simple_release_fs(fs);
+ return ERR_PTR(-ENOMEM);
+}
+
+struct dentry *simplefs_create_dentry(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+ int error;
+
+ pr_debug("creating file '%s'\n", name);
+
+ if (IS_ERR(parent))
+ return parent;
+
+ error = simple_pin_fs(fs, type);
+ if (error) {
+ pr_err("Unable to pin filesystem for file '%s'\n", name);
+ return ERR_PTR(error);
+ }
+
+ /* If the parent is not specified, we create it in the root.
+ * We need the root dentry to do this, which is in the super
+ * block. A pointer to that is in the struct vfsmount that we
+ * have around.
+ */
+ if (!parent)
+ parent = fs->mount->mnt_root;
+
+ inode_lock(d_inode(parent));
+ dentry = lookup_one_len(name, parent, strlen(name));
+ if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
+ if (d_is_dir(dentry))
+ pr_err("Directory '%s' with parent '%s' already present!\n",
+ name, parent->d_name.name);
+ else
+ pr_err("File '%s' in directory '%s' already present!\n",
+ name, parent->d_name.name);
+ dput(dentry);
+ dentry = ERR_PTR(-EEXIST);
+ }
+
+ if (IS_ERR(dentry)) {
+ inode_unlock(d_inode(parent));
+ simple_release_fs(fs);
+ }
+
+
+ if (IS_ERR(dentry))
+ return dentry;
+
+ *inode = simple_new_inode(fs->mount->mnt_sb);
+ if (unlikely(!(*inode))) {
+ pr_err("out of free inodes, can not create file '%s'\n",
+ name);
+ return failed_creating(fs, dentry);
+ }
+
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_dentry);
+
+struct dentry *simplefs_create_file(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode,
+ struct dentry *parent, void *data,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+
+ WARN_ON((mode & S_IFMT) && !S_ISREG(mode));
+ mode |= S_IFREG;
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+
+ if (IS_ERR(dentry))
+ return dentry;
+
+ (*inode)->i_mode = mode;
+ (*inode)->i_private = data;
+
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_file);
+
+struct dentry *simplefs_finish_dentry(struct dentry *dentry, struct inode *inode)
+{
+ d_instantiate(dentry, inode);
+ if (S_ISDIR(inode->i_mode)) {
+ inc_nlink(d_inode(dentry->d_parent));
+ fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
+ } else {
+ fsnotify_create(d_inode(dentry->d_parent), dentry);
+ }
+ inode_unlock(d_inode(dentry->d_parent));
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_finish_dentry);
+
+struct dentry *simplefs_create_dir(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode, struct dentry *parent,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+
+ WARN_ON((mode & S_IFMT) && !S_ISDIR(mode));
+ mode |= S_IFDIR;
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+ if (IS_ERR(dentry))
+ return dentry;
+
+ (*inode)->i_mode = mode;
+ (*inode)->i_op = &simple_dir_inode_operations;
+ (*inode)->i_fop = &simple_dir_operations;
+
+ /* directory inodes start off with i_nlink == 2 (for "." entry) */
+ inc_nlink(*inode);
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_dir);
+
+struct dentry *simplefs_create_symlink(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ const char *target, struct inode **inode)
+{
+ struct dentry *dentry;
+ char *link = kstrdup(target, GFP_KERNEL);
+ if (!link)
+ return ERR_PTR(-ENOMEM);
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+ if (IS_ERR(dentry)) {
+ kfree_link(link);
+ return dentry;
+ }
+
+ (*inode)->i_mode = S_IFLNK | S_IRWXUGO;
+ (*inode)->i_link = link;
+ (*inode)->i_op = &simple_symlink_inode_operations;
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_symlink);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index c62ab526414e..cc53eed0bc3d 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -14,4 +14,23 @@ extern void simple_release_fs(struct simple_fs *);
extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+extern struct dentry *simplefs_create_dentry(struct simple_fs *fs,
+ struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ struct inode **inode);
+struct dentry *simplefs_finish_dentry(struct dentry *dentry, struct inode *inode);
+
+extern struct dentry *simplefs_create_file(struct simple_fs *fs,
+ struct file_system_type *type,
+ const char *name, umode_t mode,
+ struct dentry *parent, void *data,
+ struct inode **inode);
+extern struct dentry *simplefs_create_dir(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode, struct dentry *parent,
+ struct inode **inode);
+extern struct dentry *simplefs_create_symlink(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ const char *target, struct inode **inode);
+
+
#endif
--
2.25.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh
A bunch of code is duplicated between debugfs and tracefs, unify it to the
simplefs library.
The code is very similar, except that dentry and inode creation are unified
into a single function (unlike start_creating in debugfs and tracefs, which
only takes care of dentries). This adds an output parameter to the creation
functions, but pushes all error recovery into fs/simplefs.c.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
include/linux/simplefs.h | 19 +++++
2 files changed, 169 insertions(+)
diff --git a/fs/simplefs.c b/fs/simplefs.c
index c59eb8d996be..3e48a288beb3 100644
--- a/fs/simplefs.c
+++ b/fs/simplefs.c
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/simplefs.h>
#include <linux/mount.h>
+#include <linux/namei.h>
+#include <linux/fsnotify.h>
static DEFINE_SPINLOCK(pin_fs_lock);
@@ -42,3 +44,151 @@ struct inode *simple_alloc_anon_inode(struct simple_fs *fs)
return alloc_anon_inode(fs->mount->mnt_sb);
}
EXPORT_SYMBOL(simple_alloc_anon_inode);
+
+static struct dentry *failed_creating(struct simple_fs *fs, struct dentry *dentry)
+{
+ inode_unlock(d_inode(dentry->d_parent));
+ dput(dentry);
+ simple_release_fs(fs);
+ return ERR_PTR(-ENOMEM);
+}
+
+struct dentry *simplefs_create_dentry(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+ int error;
+
+ pr_debug("creating file '%s'\n", name);
+
+ if (IS_ERR(parent))
+ return parent;
+
+ error = simple_pin_fs(fs, type);
+ if (error) {
+ pr_err("Unable to pin filesystem for file '%s'\n", name);
+ return ERR_PTR(error);
+ }
+
+ /* If the parent is not specified, we create it in the root.
+ * We need the root dentry to do this, which is in the super
+ * block. A pointer to that is in the struct vfsmount that we
+ * have around.
+ */
+ if (!parent)
+ parent = fs->mount->mnt_root;
+
+ inode_lock(d_inode(parent));
+ dentry = lookup_one_len(name, parent, strlen(name));
+ if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
+ if (d_is_dir(dentry))
+ pr_err("Directory '%s' with parent '%s' already present!\n",
+ name, parent->d_name.name);
+ else
+ pr_err("File '%s' in directory '%s' already present!\n",
+ name, parent->d_name.name);
+ dput(dentry);
+ dentry = ERR_PTR(-EEXIST);
+ }
+
+ if (IS_ERR(dentry)) {
+ inode_unlock(d_inode(parent));
+ simple_release_fs(fs);
+ }
+
+
+ if (IS_ERR(dentry))
+ return dentry;
+
+ *inode = simple_new_inode(fs->mount->mnt_sb);
+ if (unlikely(!(*inode))) {
+ pr_err("out of free inodes, can not create file '%s'\n",
+ name);
+ return failed_creating(fs, dentry);
+ }
+
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_dentry);
+
+struct dentry *simplefs_create_file(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode,
+ struct dentry *parent, void *data,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+
+ WARN_ON((mode & S_IFMT) && !S_ISREG(mode));
+ mode |= S_IFREG;
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+
+ if (IS_ERR(dentry))
+ return dentry;
+
+ (*inode)->i_mode = mode;
+ (*inode)->i_private = data;
+
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_file);
+
+struct dentry *simplefs_finish_dentry(struct dentry *dentry, struct inode *inode)
+{
+ d_instantiate(dentry, inode);
+ if (S_ISDIR(inode->i_mode)) {
+ inc_nlink(d_inode(dentry->d_parent));
+ fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
+ } else {
+ fsnotify_create(d_inode(dentry->d_parent), dentry);
+ }
+ inode_unlock(d_inode(dentry->d_parent));
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_finish_dentry);
+
+struct dentry *simplefs_create_dir(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode, struct dentry *parent,
+ struct inode **inode)
+{
+ struct dentry *dentry;
+
+ WARN_ON((mode & S_IFMT) && !S_ISDIR(mode));
+ mode |= S_IFDIR;
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+ if (IS_ERR(dentry))
+ return dentry;
+
+ (*inode)->i_mode = mode;
+ (*inode)->i_op = &simple_dir_inode_operations;
+ (*inode)->i_fop = &simple_dir_operations;
+
+ /* directory inodes start off with i_nlink == 2 (for "." entry) */
+ inc_nlink(*inode);
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_dir);
+
+struct dentry *simplefs_create_symlink(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ const char *target, struct inode **inode)
+{
+ struct dentry *dentry;
+ char *link = kstrdup(target, GFP_KERNEL);
+ if (!link)
+ return ERR_PTR(-ENOMEM);
+
+ dentry = simplefs_create_dentry(fs, type, name, parent, inode);
+ if (IS_ERR(dentry)) {
+ kfree_link(link);
+ return dentry;
+ }
+
+ (*inode)->i_mode = S_IFLNK | S_IRWXUGO;
+ (*inode)->i_link = link;
+ (*inode)->i_op = &simple_symlink_inode_operations;
+ return dentry;
+}
+EXPORT_SYMBOL(simplefs_create_symlink);
diff --git a/include/linux/simplefs.h b/include/linux/simplefs.h
index c62ab526414e..cc53eed0bc3d 100644
--- a/include/linux/simplefs.h
+++ b/include/linux/simplefs.h
@@ -14,4 +14,23 @@ extern void simple_release_fs(struct simple_fs *);
extern struct inode *simple_alloc_anon_inode(struct simple_fs *fs);
+extern struct dentry *simplefs_create_dentry(struct simple_fs *fs,
+ struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ struct inode **inode);
+struct dentry *simplefs_finish_dentry(struct dentry *dentry, struct inode *inode);
+
+extern struct dentry *simplefs_create_file(struct simple_fs *fs,
+ struct file_system_type *type,
+ const char *name, umode_t mode,
+ struct dentry *parent, void *data,
+ struct inode **inode);
+extern struct dentry *simplefs_create_dir(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, umode_t mode, struct dentry *parent,
+ struct inode **inode);
+extern struct dentry *simplefs_create_symlink(struct simple_fs *fs, struct file_system_type *type,
+ const char *name, struct dentry *parent,
+ const char *target, struct inode **inode);
+
+
#endif
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 7/8] debugfs: switch to simplefs inode creation API
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
The only difference, compared to the pre-existing code, is that symlink
creation now triggers fsnotify_create. This was a bug in the debugfs
code, since for example vfs_symlink does call fsnotify_create.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/debugfs/inode.c | 144 +++++----------------------------------------
1 file changed, 15 insertions(+), 129 deletions(-)
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 834b5872ca0d..7a2369373b85 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -294,68 +294,6 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
}
EXPORT_SYMBOL_GPL(debugfs_lookup);
-static struct dentry *start_creating(const char *name, struct dentry *parent)
-{
- struct dentry *dentry;
- int error;
-
- pr_debug("creating file '%s'\n", name);
-
- if (IS_ERR(parent))
- return parent;
-
- error = simple_pin_fs(&debugfs, &debug_fs_type);
- if (error) {
- pr_err("Unable to pin filesystem for file '%s'\n", name);
- return ERR_PTR(error);
- }
-
- /* If the parent is not specified, we create it in the root.
- * We need the root dentry to do this, which is in the super
- * block. A pointer to that is in the struct vfsmount that we
- * have around.
- */
- if (!parent)
- parent = debugfs.mount->mnt_root;
-
- inode_lock(d_inode(parent));
- if (unlikely(IS_DEADDIR(d_inode(parent))))
- dentry = ERR_PTR(-ENOENT);
- else
- dentry = lookup_one_len(name, parent, strlen(name));
- if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
- if (d_is_dir(dentry))
- pr_err("Directory '%s' with parent '%s' already present!\n",
- name, parent->d_name.name);
- else
- pr_err("File '%s' in directory '%s' already present!\n",
- name, parent->d_name.name);
- dput(dentry);
- dentry = ERR_PTR(-EEXIST);
- }
-
- if (IS_ERR(dentry)) {
- inode_unlock(d_inode(parent));
- simple_release_fs(&debugfs);
- }
-
- return dentry;
-}
-
-static struct dentry *failed_creating(struct dentry *dentry)
-{
- inode_unlock(d_inode(dentry->d_parent));
- dput(dentry);
- simple_release_fs(&debugfs);
- return ERR_PTR(-ENOMEM);
-}
-
-static struct dentry *end_creating(struct dentry *dentry)
-{
- inode_unlock(d_inode(dentry->d_parent));
- return dentry;
-}
-
static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *proxy_fops,
@@ -364,32 +302,17 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
struct dentry *dentry;
struct inode *inode;
- if (!(mode & S_IFMT))
- mode |= S_IFREG;
- BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
-
+ dentry = simplefs_create_file(&debugfs, &debug_fs_type,
+ name, mode, parent, data, &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create file '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
- inode->i_mode = mode;
- inode->i_private = data;
-
inode->i_op = &debugfs_file_inode_operations;
inode->i_fop = proxy_fops;
dentry->d_fsdata = (void *)((unsigned long)real_fops |
DEBUGFS_FSDATA_IS_REAL_FOPS_BIT);
- d_instantiate(dentry, inode);
- fsnotify_create(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
/**
@@ -522,29 +445,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_size);
*/
struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dir(&debugfs, &debug_fs_type,
+ name, 0755, parent, &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create directory '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = &debugfs_dir_inode_operations;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(d_inode(dentry->d_parent));
- fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL_GPL(debugfs_create_dir);
@@ -564,29 +474,19 @@ struct dentry *debugfs_create_automount(const char *name,
debugfs_automount_t f,
void *data)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dentry(&debugfs, &debug_fs_type, name, parent,
+ &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create automount '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
make_empty_dir_inode(inode);
inode->i_flags |= S_AUTOMOUNT;
inode->i_private = data;
dentry->d_fsdata = (void *)f;
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(d_inode(dentry->d_parent));
- fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL(debugfs_create_automount);
@@ -618,28 +518,14 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
{
struct dentry *dentry;
struct inode *inode;
- char *link = kstrdup(target, GFP_KERNEL);
- if (!link)
- return ERR_PTR(-ENOMEM);
- dentry = start_creating(name, parent);
- if (IS_ERR(dentry)) {
- kfree(link);
+ dentry = simplefs_create_symlink(&debugfs, &debug_fs_type,
+ name, parent, target, &inode);
+ if (IS_ERR(dentry))
return dentry;
- }
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create symlink '%s'\n",
- name);
- kfree(link);
- return failed_creating(dentry);
- }
- inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_op = &debugfs_symlink_inode_operations;
- inode->i_link = link;
- d_instantiate(dentry, inode);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL_GPL(debugfs_create_symlink);
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 7/8] debugfs: switch to simplefs inode creation API
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Paolo Bonzini, Emanuele Giuseppe Esposito, Jeremy Kerr,
Arnd Bergmann, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
The only difference, compared to the pre-existing code, is that symlink
creation now triggers fsnotify_create. This was a bug in the debugfs
code, since for example vfs_symlink does call fsnotify_create.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/debugfs/inode.c | 144 +++++----------------------------------------
1 file changed, 15 insertions(+), 129 deletions(-)
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 834b5872ca0d..7a2369373b85 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -294,68 +294,6 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
}
EXPORT_SYMBOL_GPL(debugfs_lookup);
-static struct dentry *start_creating(const char *name, struct dentry *parent)
-{
- struct dentry *dentry;
- int error;
-
- pr_debug("creating file '%s'\n", name);
-
- if (IS_ERR(parent))
- return parent;
-
- error = simple_pin_fs(&debugfs, &debug_fs_type);
- if (error) {
- pr_err("Unable to pin filesystem for file '%s'\n", name);
- return ERR_PTR(error);
- }
-
- /* If the parent is not specified, we create it in the root.
- * We need the root dentry to do this, which is in the super
- * block. A pointer to that is in the struct vfsmount that we
- * have around.
- */
- if (!parent)
- parent = debugfs.mount->mnt_root;
-
- inode_lock(d_inode(parent));
- if (unlikely(IS_DEADDIR(d_inode(parent))))
- dentry = ERR_PTR(-ENOENT);
- else
- dentry = lookup_one_len(name, parent, strlen(name));
- if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
- if (d_is_dir(dentry))
- pr_err("Directory '%s' with parent '%s' already present!\n",
- name, parent->d_name.name);
- else
- pr_err("File '%s' in directory '%s' already present!\n",
- name, parent->d_name.name);
- dput(dentry);
- dentry = ERR_PTR(-EEXIST);
- }
-
- if (IS_ERR(dentry)) {
- inode_unlock(d_inode(parent));
- simple_release_fs(&debugfs);
- }
-
- return dentry;
-}
-
-static struct dentry *failed_creating(struct dentry *dentry)
-{
- inode_unlock(d_inode(dentry->d_parent));
- dput(dentry);
- simple_release_fs(&debugfs);
- return ERR_PTR(-ENOMEM);
-}
-
-static struct dentry *end_creating(struct dentry *dentry)
-{
- inode_unlock(d_inode(dentry->d_parent));
- return dentry;
-}
-
static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *proxy_fops,
@@ -364,32 +302,17 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
struct dentry *dentry;
struct inode *inode;
- if (!(mode & S_IFMT))
- mode |= S_IFREG;
- BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
-
+ dentry = simplefs_create_file(&debugfs, &debug_fs_type,
+ name, mode, parent, data, &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create file '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
- inode->i_mode = mode;
- inode->i_private = data;
-
inode->i_op = &debugfs_file_inode_operations;
inode->i_fop = proxy_fops;
dentry->d_fsdata = (void *)((unsigned long)real_fops |
DEBUGFS_FSDATA_IS_REAL_FOPS_BIT);
- d_instantiate(dentry, inode);
- fsnotify_create(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
/**
@@ -522,29 +445,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_size);
*/
struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dir(&debugfs, &debug_fs_type,
+ name, 0755, parent, &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create directory '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = &debugfs_dir_inode_operations;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(d_inode(dentry->d_parent));
- fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL_GPL(debugfs_create_dir);
@@ -564,29 +474,19 @@ struct dentry *debugfs_create_automount(const char *name,
debugfs_automount_t f,
void *data)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dentry(&debugfs, &debug_fs_type, name, parent,
+ &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create automount '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
make_empty_dir_inode(inode);
inode->i_flags |= S_AUTOMOUNT;
inode->i_private = data;
dentry->d_fsdata = (void *)f;
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(d_inode(dentry->d_parent));
- fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL(debugfs_create_automount);
@@ -618,28 +518,14 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
{
struct dentry *dentry;
struct inode *inode;
- char *link = kstrdup(target, GFP_KERNEL);
- if (!link)
- return ERR_PTR(-ENOMEM);
- dentry = start_creating(name, parent);
- if (IS_ERR(dentry)) {
- kfree(link);
+ dentry = simplefs_create_symlink(&debugfs, &debug_fs_type,
+ name, parent, target, &inode);
+ if (IS_ERR(dentry))
return dentry;
- }
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create symlink '%s'\n",
- name);
- kfree(link);
- return failed_creating(dentry);
- }
- inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_op = &debugfs_symlink_inode_operations;
- inode->i_link = link;
- d_instantiate(dentry, inode);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL_GPL(debugfs_create_symlink);
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 7/8] debugfs: switch to simplefs inode creation API
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, linux-fsdevel, Manoj N. Kumar, Alexander Viro,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, Mike Marciniszyn, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
The only difference, compared to the pre-existing code, is that symlink
creation now triggers fsnotify_create. This was a bug in the debugfs
code, since for example vfs_symlink does call fsnotify_create.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/debugfs/inode.c | 144 +++++----------------------------------------
1 file changed, 15 insertions(+), 129 deletions(-)
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 834b5872ca0d..7a2369373b85 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -294,68 +294,6 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
}
EXPORT_SYMBOL_GPL(debugfs_lookup);
-static struct dentry *start_creating(const char *name, struct dentry *parent)
-{
- struct dentry *dentry;
- int error;
-
- pr_debug("creating file '%s'\n", name);
-
- if (IS_ERR(parent))
- return parent;
-
- error = simple_pin_fs(&debugfs, &debug_fs_type);
- if (error) {
- pr_err("Unable to pin filesystem for file '%s'\n", name);
- return ERR_PTR(error);
- }
-
- /* If the parent is not specified, we create it in the root.
- * We need the root dentry to do this, which is in the super
- * block. A pointer to that is in the struct vfsmount that we
- * have around.
- */
- if (!parent)
- parent = debugfs.mount->mnt_root;
-
- inode_lock(d_inode(parent));
- if (unlikely(IS_DEADDIR(d_inode(parent))))
- dentry = ERR_PTR(-ENOENT);
- else
- dentry = lookup_one_len(name, parent, strlen(name));
- if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
- if (d_is_dir(dentry))
- pr_err("Directory '%s' with parent '%s' already present!\n",
- name, parent->d_name.name);
- else
- pr_err("File '%s' in directory '%s' already present!\n",
- name, parent->d_name.name);
- dput(dentry);
- dentry = ERR_PTR(-EEXIST);
- }
-
- if (IS_ERR(dentry)) {
- inode_unlock(d_inode(parent));
- simple_release_fs(&debugfs);
- }
-
- return dentry;
-}
-
-static struct dentry *failed_creating(struct dentry *dentry)
-{
- inode_unlock(d_inode(dentry->d_parent));
- dput(dentry);
- simple_release_fs(&debugfs);
- return ERR_PTR(-ENOMEM);
-}
-
-static struct dentry *end_creating(struct dentry *dentry)
-{
- inode_unlock(d_inode(dentry->d_parent));
- return dentry;
-}
-
static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *proxy_fops,
@@ -364,32 +302,17 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
struct dentry *dentry;
struct inode *inode;
- if (!(mode & S_IFMT))
- mode |= S_IFREG;
- BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
-
+ dentry = simplefs_create_file(&debugfs, &debug_fs_type,
+ name, mode, parent, data, &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create file '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
- inode->i_mode = mode;
- inode->i_private = data;
-
inode->i_op = &debugfs_file_inode_operations;
inode->i_fop = proxy_fops;
dentry->d_fsdata = (void *)((unsigned long)real_fops |
DEBUGFS_FSDATA_IS_REAL_FOPS_BIT);
- d_instantiate(dentry, inode);
- fsnotify_create(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
/**
@@ -522,29 +445,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_size);
*/
struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dir(&debugfs, &debug_fs_type,
+ name, 0755, parent, &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create directory '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = &debugfs_dir_inode_operations;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(d_inode(dentry->d_parent));
- fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL_GPL(debugfs_create_dir);
@@ -564,29 +474,19 @@ struct dentry *debugfs_create_automount(const char *name,
debugfs_automount_t f,
void *data)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dentry(&debugfs, &debug_fs_type, name, parent,
+ &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create automount '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
make_empty_dir_inode(inode);
inode->i_flags |= S_AUTOMOUNT;
inode->i_private = data;
dentry->d_fsdata = (void *)f;
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(d_inode(dentry->d_parent));
- fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL(debugfs_create_automount);
@@ -618,28 +518,14 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
{
struct dentry *dentry;
struct inode *inode;
- char *link = kstrdup(target, GFP_KERNEL);
- if (!link)
- return ERR_PTR(-ENOMEM);
- dentry = start_creating(name, parent);
- if (IS_ERR(dentry)) {
- kfree(link);
+ dentry = simplefs_create_symlink(&debugfs, &debug_fs_type,
+ name, parent, target, &inode);
+ if (IS_ERR(dentry))
return dentry;
- }
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create symlink '%s'\n",
- name);
- kfree(link);
- return failed_creating(dentry);
- }
- inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_op = &debugfs_symlink_inode_operations;
- inode->i_link = link;
- d_instantiate(dentry, inode);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL_GPL(debugfs_create_symlink);
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 7/8] debugfs: switch to simplefs inode creation API
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
The only difference, compared to the pre-existing code, is that symlink
creation now triggers fsnotify_create. This was a bug in the debugfs
code, since for example vfs_symlink does call fsnotify_create.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/debugfs/inode.c | 144 +++++----------------------------------------
1 file changed, 15 insertions(+), 129 deletions(-)
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 834b5872ca0d..7a2369373b85 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -294,68 +294,6 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
}
EXPORT_SYMBOL_GPL(debugfs_lookup);
-static struct dentry *start_creating(const char *name, struct dentry *parent)
-{
- struct dentry *dentry;
- int error;
-
- pr_debug("creating file '%s'\n", name);
-
- if (IS_ERR(parent))
- return parent;
-
- error = simple_pin_fs(&debugfs, &debug_fs_type);
- if (error) {
- pr_err("Unable to pin filesystem for file '%s'\n", name);
- return ERR_PTR(error);
- }
-
- /* If the parent is not specified, we create it in the root.
- * We need the root dentry to do this, which is in the super
- * block. A pointer to that is in the struct vfsmount that we
- * have around.
- */
- if (!parent)
- parent = debugfs.mount->mnt_root;
-
- inode_lock(d_inode(parent));
- if (unlikely(IS_DEADDIR(d_inode(parent))))
- dentry = ERR_PTR(-ENOENT);
- else
- dentry = lookup_one_len(name, parent, strlen(name));
- if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
- if (d_is_dir(dentry))
- pr_err("Directory '%s' with parent '%s' already present!\n",
- name, parent->d_name.name);
- else
- pr_err("File '%s' in directory '%s' already present!\n",
- name, parent->d_name.name);
- dput(dentry);
- dentry = ERR_PTR(-EEXIST);
- }
-
- if (IS_ERR(dentry)) {
- inode_unlock(d_inode(parent));
- simple_release_fs(&debugfs);
- }
-
- return dentry;
-}
-
-static struct dentry *failed_creating(struct dentry *dentry)
-{
- inode_unlock(d_inode(dentry->d_parent));
- dput(dentry);
- simple_release_fs(&debugfs);
- return ERR_PTR(-ENOMEM);
-}
-
-static struct dentry *end_creating(struct dentry *dentry)
-{
- inode_unlock(d_inode(dentry->d_parent));
- return dentry;
-}
-
static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *proxy_fops,
@@ -364,32 +302,17 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
struct dentry *dentry;
struct inode *inode;
- if (!(mode & S_IFMT))
- mode |= S_IFREG;
- BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
-
+ dentry = simplefs_create_file(&debugfs, &debug_fs_type,
+ name, mode, parent, data, &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create file '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
- inode->i_mode = mode;
- inode->i_private = data;
-
inode->i_op = &debugfs_file_inode_operations;
inode->i_fop = proxy_fops;
dentry->d_fsdata = (void *)((unsigned long)real_fops |
DEBUGFS_FSDATA_IS_REAL_FOPS_BIT);
- d_instantiate(dentry, inode);
- fsnotify_create(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
/**
@@ -522,29 +445,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_size);
*/
struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dir(&debugfs, &debug_fs_type,
+ name, 0755, parent, &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create directory '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = &debugfs_dir_inode_operations;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(d_inode(dentry->d_parent));
- fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL_GPL(debugfs_create_dir);
@@ -564,29 +474,19 @@ struct dentry *debugfs_create_automount(const char *name,
debugfs_automount_t f,
void *data)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dentry(&debugfs, &debug_fs_type, name, parent,
+ &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create automount '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
make_empty_dir_inode(inode);
inode->i_flags |= S_AUTOMOUNT;
inode->i_private = data;
dentry->d_fsdata = (void *)f;
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(d_inode(dentry->d_parent));
- fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL(debugfs_create_automount);
@@ -618,28 +518,14 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
{
struct dentry *dentry;
struct inode *inode;
- char *link = kstrdup(target, GFP_KERNEL);
- if (!link)
- return ERR_PTR(-ENOMEM);
- dentry = start_creating(name, parent);
- if (IS_ERR(dentry)) {
- kfree(link);
+ dentry = simplefs_create_symlink(&debugfs, &debug_fs_type,
+ name, parent, target, &inode);
+ if (IS_ERR(dentry))
return dentry;
- }
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create symlink '%s'\n",
- name);
- kfree(link);
- return failed_creating(dentry);
- }
- inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_op = &debugfs_symlink_inode_operations;
- inode->i_link = link;
- d_instantiate(dentry, inode);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL_GPL(debugfs_create_symlink);
--
2.25.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 7/8] debugfs: switch to simplefs inode creation API
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh
The only difference, compared to the pre-existing code, is that symlink
creation now triggers fsnotify_create. This was a bug in the debugfs
code, since for example vfs_symlink does call fsnotify_create.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/debugfs/inode.c | 144 +++++----------------------------------------
1 file changed, 15 insertions(+), 129 deletions(-)
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 834b5872ca0d..7a2369373b85 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -294,68 +294,6 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
}
EXPORT_SYMBOL_GPL(debugfs_lookup);
-static struct dentry *start_creating(const char *name, struct dentry *parent)
-{
- struct dentry *dentry;
- int error;
-
- pr_debug("creating file '%s'\n", name);
-
- if (IS_ERR(parent))
- return parent;
-
- error = simple_pin_fs(&debugfs, &debug_fs_type);
- if (error) {
- pr_err("Unable to pin filesystem for file '%s'\n", name);
- return ERR_PTR(error);
- }
-
- /* If the parent is not specified, we create it in the root.
- * We need the root dentry to do this, which is in the super
- * block. A pointer to that is in the struct vfsmount that we
- * have around.
- */
- if (!parent)
- parent = debugfs.mount->mnt_root;
-
- inode_lock(d_inode(parent));
- if (unlikely(IS_DEADDIR(d_inode(parent))))
- dentry = ERR_PTR(-ENOENT);
- else
- dentry = lookup_one_len(name, parent, strlen(name));
- if (!IS_ERR(dentry) && d_really_is_positive(dentry)) {
- if (d_is_dir(dentry))
- pr_err("Directory '%s' with parent '%s' already present!\n",
- name, parent->d_name.name);
- else
- pr_err("File '%s' in directory '%s' already present!\n",
- name, parent->d_name.name);
- dput(dentry);
- dentry = ERR_PTR(-EEXIST);
- }
-
- if (IS_ERR(dentry)) {
- inode_unlock(d_inode(parent));
- simple_release_fs(&debugfs);
- }
-
- return dentry;
-}
-
-static struct dentry *failed_creating(struct dentry *dentry)
-{
- inode_unlock(d_inode(dentry->d_parent));
- dput(dentry);
- simple_release_fs(&debugfs);
- return ERR_PTR(-ENOMEM);
-}
-
-static struct dentry *end_creating(struct dentry *dentry)
-{
- inode_unlock(d_inode(dentry->d_parent));
- return dentry;
-}
-
static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *proxy_fops,
@@ -364,32 +302,17 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
struct dentry *dentry;
struct inode *inode;
- if (!(mode & S_IFMT))
- mode |= S_IFREG;
- BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
-
+ dentry = simplefs_create_file(&debugfs, &debug_fs_type,
+ name, mode, parent, data, &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create file '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
- inode->i_mode = mode;
- inode->i_private = data;
-
inode->i_op = &debugfs_file_inode_operations;
inode->i_fop = proxy_fops;
dentry->d_fsdata = (void *)((unsigned long)real_fops |
DEBUGFS_FSDATA_IS_REAL_FOPS_BIT);
- d_instantiate(dentry, inode);
- fsnotify_create(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
/**
@@ -522,29 +445,16 @@ EXPORT_SYMBOL_GPL(debugfs_create_file_size);
*/
struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dir(&debugfs, &debug_fs_type,
+ name, 0755, parent, &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create directory '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = &debugfs_dir_inode_operations;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(d_inode(dentry->d_parent));
- fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL_GPL(debugfs_create_dir);
@@ -564,29 +474,19 @@ struct dentry *debugfs_create_automount(const char *name,
debugfs_automount_t f,
void *data)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dentry(&debugfs, &debug_fs_type, name, parent,
+ &inode);
if (IS_ERR(dentry))
return dentry;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create automount '%s'\n",
- name);
- return failed_creating(dentry);
- }
-
make_empty_dir_inode(inode);
inode->i_flags |= S_AUTOMOUNT;
inode->i_private = data;
dentry->d_fsdata = (void *)f;
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(d_inode(dentry->d_parent));
- fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL(debugfs_create_automount);
@@ -618,28 +518,14 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
{
struct dentry *dentry;
struct inode *inode;
- char *link = kstrdup(target, GFP_KERNEL);
- if (!link)
- return ERR_PTR(-ENOMEM);
- dentry = start_creating(name, parent);
- if (IS_ERR(dentry)) {
- kfree(link);
+ dentry = simplefs_create_symlink(&debugfs, &debug_fs_type,
+ name, parent, target, &inode);
+ if (IS_ERR(dentry))
return dentry;
- }
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode)) {
- pr_err("out of free dentries, can not create symlink '%s'\n",
- name);
- kfree(link);
- return failed_creating(dentry);
- }
- inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_op = &debugfs_symlink_inode_operations;
- inode->i_link = link;
- d_instantiate(dentry, inode);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
EXPORT_SYMBOL_GPL(debugfs_create_symlink);
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 8/8] tracefs: switch to simplefs inode creation API
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
There is no semantic change intended; the code in the simplefs.c functions in
fact was derived from debugfs and tracefs code.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/tracefs/inode.c | 86 ++++------------------------------------------
1 file changed, 7 insertions(+), 79 deletions(-)
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index a30837a8e1d4..69e2215c797b 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -298,57 +298,6 @@ static struct file_system_type trace_fs_type = {
};
MODULE_ALIAS_FS("tracefs");
-static struct dentry *start_creating(const char *name, struct dentry *parent)
-{
- struct dentry *dentry;
- int error;
-
- pr_debug("tracefs: creating file '%s'\n",name);
-
- error = simple_pin_fs(&tracefs, &trace_fs_type);
- if (error)
- return ERR_PTR(error);
-
- /* If the parent is not specified, we create it in the root.
- * We need the root dentry to do this, which is in the super
- * block. A pointer to that is in the struct vfsmount that we
- * have around.
- */
- if (!parent)
- parent = tracefs.mount->mnt_root;
-
- inode_lock(parent->d_inode);
- if (unlikely(IS_DEADDIR(parent->d_inode)))
- dentry = ERR_PTR(-ENOENT);
- else
- dentry = lookup_one_len(name, parent, strlen(name));
- if (!IS_ERR(dentry) && dentry->d_inode) {
- dput(dentry);
- dentry = ERR_PTR(-EEXIST);
- }
-
- if (IS_ERR(dentry)) {
- inode_unlock(parent->d_inode);
- simple_release_fs(&tracefs);
- }
-
- return dentry;
-}
-
-static struct dentry *failed_creating(struct dentry *dentry)
-{
- inode_unlock(dentry->d_parent->d_inode);
- dput(dentry);
- simple_release_fs(&tracefs);
- return NULL;
-}
-
-static struct dentry *end_creating(struct dentry *dentry)
-{
- inode_unlock(dentry->d_parent->d_inode);
- return dentry;
-}
-
/**
* tracefs_create_file - create a file in the tracefs filesystem
* @name: a pointer to a string containing the name of the file to create.
@@ -385,49 +334,28 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (security_locked_down(LOCKDOWN_TRACEFS))
return NULL;
- if (!(mode & S_IFMT))
- mode |= S_IFREG;
- BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
-
+ dentry = simplefs_create_file(&tracefs, &trace_fs_type,
+ name, mode, parent, data, &inode);
if (IS_ERR(dentry))
return NULL;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode))
- return failed_creating(dentry);
-
- inode->i_mode = mode;
inode->i_fop = fops ? fops : &tracefs_file_operations;
- inode->i_private = data;
- d_instantiate(dentry, inode);
- fsnotify_create(dentry->d_parent->d_inode, dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
static struct dentry *__create_dir(const char *name, struct dentry *parent,
const struct inode_operations *ops)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dir(&tracefs, &trace_fs_type,
+ name, 0755, parent, &inode);
if (IS_ERR(dentry))
return NULL;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode))
- return failed_creating(dentry);
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = ops;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(dentry->d_parent->d_inode);
- fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
/**
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 8/8] tracefs: switch to simplefs inode creation API
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Paolo Bonzini, Emanuele Giuseppe Esposito, Jeremy Kerr,
Arnd Bergmann, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, Trond Myklebust, Anna Schumaker,
J. Bruce Fields, Chuck Lever, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
There is no semantic change intended; the code in the simplefs.c functions in
fact was derived from debugfs and tracefs code.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/tracefs/inode.c | 86 ++++------------------------------------------
1 file changed, 7 insertions(+), 79 deletions(-)
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index a30837a8e1d4..69e2215c797b 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -298,57 +298,6 @@ static struct file_system_type trace_fs_type = {
};
MODULE_ALIAS_FS("tracefs");
-static struct dentry *start_creating(const char *name, struct dentry *parent)
-{
- struct dentry *dentry;
- int error;
-
- pr_debug("tracefs: creating file '%s'\n",name);
-
- error = simple_pin_fs(&tracefs, &trace_fs_type);
- if (error)
- return ERR_PTR(error);
-
- /* If the parent is not specified, we create it in the root.
- * We need the root dentry to do this, which is in the super
- * block. A pointer to that is in the struct vfsmount that we
- * have around.
- */
- if (!parent)
- parent = tracefs.mount->mnt_root;
-
- inode_lock(parent->d_inode);
- if (unlikely(IS_DEADDIR(parent->d_inode)))
- dentry = ERR_PTR(-ENOENT);
- else
- dentry = lookup_one_len(name, parent, strlen(name));
- if (!IS_ERR(dentry) && dentry->d_inode) {
- dput(dentry);
- dentry = ERR_PTR(-EEXIST);
- }
-
- if (IS_ERR(dentry)) {
- inode_unlock(parent->d_inode);
- simple_release_fs(&tracefs);
- }
-
- return dentry;
-}
-
-static struct dentry *failed_creating(struct dentry *dentry)
-{
- inode_unlock(dentry->d_parent->d_inode);
- dput(dentry);
- simple_release_fs(&tracefs);
- return NULL;
-}
-
-static struct dentry *end_creating(struct dentry *dentry)
-{
- inode_unlock(dentry->d_parent->d_inode);
- return dentry;
-}
-
/**
* tracefs_create_file - create a file in the tracefs filesystem
* @name: a pointer to a string containing the name of the file to create.
@@ -385,49 +334,28 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (security_locked_down(LOCKDOWN_TRACEFS))
return NULL;
- if (!(mode & S_IFMT))
- mode |= S_IFREG;
- BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
-
+ dentry = simplefs_create_file(&tracefs, &trace_fs_type,
+ name, mode, parent, data, &inode);
if (IS_ERR(dentry))
return NULL;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode))
- return failed_creating(dentry);
-
- inode->i_mode = mode;
inode->i_fop = fops ? fops : &tracefs_file_operations;
- inode->i_private = data;
- d_instantiate(dentry, inode);
- fsnotify_create(dentry->d_parent->d_inode, dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
static struct dentry *__create_dir(const char *name, struct dentry *parent,
const struct inode_operations *ops)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dir(&tracefs, &trace_fs_type,
+ name, 0755, parent, &inode);
if (IS_ERR(dentry))
return NULL;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode))
- return failed_creating(dentry);
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = ops;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(dentry->d_parent->d_inode);
- fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
/**
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 8/8] tracefs: switch to simplefs inode creation API
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, linux-fsdevel, Manoj N. Kumar, Alexander Viro,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, Mike Marciniszyn, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
There is no semantic change intended; the code in the simplefs.c functions in
fact was derived from debugfs and tracefs code.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/tracefs/inode.c | 86 ++++------------------------------------------
1 file changed, 7 insertions(+), 79 deletions(-)
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index a30837a8e1d4..69e2215c797b 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -298,57 +298,6 @@ static struct file_system_type trace_fs_type = {
};
MODULE_ALIAS_FS("tracefs");
-static struct dentry *start_creating(const char *name, struct dentry *parent)
-{
- struct dentry *dentry;
- int error;
-
- pr_debug("tracefs: creating file '%s'\n",name);
-
- error = simple_pin_fs(&tracefs, &trace_fs_type);
- if (error)
- return ERR_PTR(error);
-
- /* If the parent is not specified, we create it in the root.
- * We need the root dentry to do this, which is in the super
- * block. A pointer to that is in the struct vfsmount that we
- * have around.
- */
- if (!parent)
- parent = tracefs.mount->mnt_root;
-
- inode_lock(parent->d_inode);
- if (unlikely(IS_DEADDIR(parent->d_inode)))
- dentry = ERR_PTR(-ENOENT);
- else
- dentry = lookup_one_len(name, parent, strlen(name));
- if (!IS_ERR(dentry) && dentry->d_inode) {
- dput(dentry);
- dentry = ERR_PTR(-EEXIST);
- }
-
- if (IS_ERR(dentry)) {
- inode_unlock(parent->d_inode);
- simple_release_fs(&tracefs);
- }
-
- return dentry;
-}
-
-static struct dentry *failed_creating(struct dentry *dentry)
-{
- inode_unlock(dentry->d_parent->d_inode);
- dput(dentry);
- simple_release_fs(&tracefs);
- return NULL;
-}
-
-static struct dentry *end_creating(struct dentry *dentry)
-{
- inode_unlock(dentry->d_parent->d_inode);
- return dentry;
-}
-
/**
* tracefs_create_file - create a file in the tracefs filesystem
* @name: a pointer to a string containing the name of the file to create.
@@ -385,49 +334,28 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (security_locked_down(LOCKDOWN_TRACEFS))
return NULL;
- if (!(mode & S_IFMT))
- mode |= S_IFREG;
- BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
-
+ dentry = simplefs_create_file(&tracefs, &trace_fs_type,
+ name, mode, parent, data, &inode);
if (IS_ERR(dentry))
return NULL;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode))
- return failed_creating(dentry);
-
- inode->i_mode = mode;
inode->i_fop = fops ? fops : &tracefs_file_operations;
- inode->i_private = data;
- d_instantiate(dentry, inode);
- fsnotify_create(dentry->d_parent->d_inode, dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
static struct dentry *__create_dir(const char *name, struct dentry *parent,
const struct inode_operations *ops)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dir(&tracefs, &trace_fs_type,
+ name, 0755, parent, &inode);
if (IS_ERR(dentry))
return NULL;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode))
- return failed_creating(dentry);
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = ops;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(dentry->d_parent->d_inode);
- fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
/**
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 8/8] tracefs: switch to simplefs inode creation API
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
linux-fsdevel, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
ocfs2-devel, Joel Becker
There is no semantic change intended; the code in the simplefs.c functions in
fact was derived from debugfs and tracefs code.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/tracefs/inode.c | 86 ++++------------------------------------------
1 file changed, 7 insertions(+), 79 deletions(-)
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index a30837a8e1d4..69e2215c797b 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -298,57 +298,6 @@ static struct file_system_type trace_fs_type = {
};
MODULE_ALIAS_FS("tracefs");
-static struct dentry *start_creating(const char *name, struct dentry *parent)
-{
- struct dentry *dentry;
- int error;
-
- pr_debug("tracefs: creating file '%s'\n",name);
-
- error = simple_pin_fs(&tracefs, &trace_fs_type);
- if (error)
- return ERR_PTR(error);
-
- /* If the parent is not specified, we create it in the root.
- * We need the root dentry to do this, which is in the super
- * block. A pointer to that is in the struct vfsmount that we
- * have around.
- */
- if (!parent)
- parent = tracefs.mount->mnt_root;
-
- inode_lock(parent->d_inode);
- if (unlikely(IS_DEADDIR(parent->d_inode)))
- dentry = ERR_PTR(-ENOENT);
- else
- dentry = lookup_one_len(name, parent, strlen(name));
- if (!IS_ERR(dentry) && dentry->d_inode) {
- dput(dentry);
- dentry = ERR_PTR(-EEXIST);
- }
-
- if (IS_ERR(dentry)) {
- inode_unlock(parent->d_inode);
- simple_release_fs(&tracefs);
- }
-
- return dentry;
-}
-
-static struct dentry *failed_creating(struct dentry *dentry)
-{
- inode_unlock(dentry->d_parent->d_inode);
- dput(dentry);
- simple_release_fs(&tracefs);
- return NULL;
-}
-
-static struct dentry *end_creating(struct dentry *dentry)
-{
- inode_unlock(dentry->d_parent->d_inode);
- return dentry;
-}
-
/**
* tracefs_create_file - create a file in the tracefs filesystem
* @name: a pointer to a string containing the name of the file to create.
@@ -385,49 +334,28 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (security_locked_down(LOCKDOWN_TRACEFS))
return NULL;
- if (!(mode & S_IFMT))
- mode |= S_IFREG;
- BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
-
+ dentry = simplefs_create_file(&tracefs, &trace_fs_type,
+ name, mode, parent, data, &inode);
if (IS_ERR(dentry))
return NULL;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode))
- return failed_creating(dentry);
-
- inode->i_mode = mode;
inode->i_fop = fops ? fops : &tracefs_file_operations;
- inode->i_private = data;
- d_instantiate(dentry, inode);
- fsnotify_create(dentry->d_parent->d_inode, dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
static struct dentry *__create_dir(const char *name, struct dentry *parent,
const struct inode_operations *ops)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dir(&tracefs, &trace_fs_type,
+ name, 0755, parent, &inode);
if (IS_ERR(dentry))
return NULL;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode))
- return failed_creating(dentry);
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = ops;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(dentry->d_parent->d_inode);
- fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
/**
--
2.25.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [PATCH 8/8] tracefs: switch to simplefs inode creation API
@ 2020-04-14 12:43 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-14 12:43 UTC (permalink / raw)
To: linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan,
Emanuele Giuseppe Esposito, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh
There is no semantic change intended; the code in the simplefs.c functions in
fact was derived from debugfs and tracefs code.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
fs/tracefs/inode.c | 86 ++++------------------------------------------
1 file changed, 7 insertions(+), 79 deletions(-)
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index a30837a8e1d4..69e2215c797b 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -298,57 +298,6 @@ static struct file_system_type trace_fs_type = {
};
MODULE_ALIAS_FS("tracefs");
-static struct dentry *start_creating(const char *name, struct dentry *parent)
-{
- struct dentry *dentry;
- int error;
-
- pr_debug("tracefs: creating file '%s'\n",name);
-
- error = simple_pin_fs(&tracefs, &trace_fs_type);
- if (error)
- return ERR_PTR(error);
-
- /* If the parent is not specified, we create it in the root.
- * We need the root dentry to do this, which is in the super
- * block. A pointer to that is in the struct vfsmount that we
- * have around.
- */
- if (!parent)
- parent = tracefs.mount->mnt_root;
-
- inode_lock(parent->d_inode);
- if (unlikely(IS_DEADDIR(parent->d_inode)))
- dentry = ERR_PTR(-ENOENT);
- else
- dentry = lookup_one_len(name, parent, strlen(name));
- if (!IS_ERR(dentry) && dentry->d_inode) {
- dput(dentry);
- dentry = ERR_PTR(-EEXIST);
- }
-
- if (IS_ERR(dentry)) {
- inode_unlock(parent->d_inode);
- simple_release_fs(&tracefs);
- }
-
- return dentry;
-}
-
-static struct dentry *failed_creating(struct dentry *dentry)
-{
- inode_unlock(dentry->d_parent->d_inode);
- dput(dentry);
- simple_release_fs(&tracefs);
- return NULL;
-}
-
-static struct dentry *end_creating(struct dentry *dentry)
-{
- inode_unlock(dentry->d_parent->d_inode);
- return dentry;
-}
-
/**
* tracefs_create_file - create a file in the tracefs filesystem
* @name: a pointer to a string containing the name of the file to create.
@@ -385,49 +334,28 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
if (security_locked_down(LOCKDOWN_TRACEFS))
return NULL;
- if (!(mode & S_IFMT))
- mode |= S_IFREG;
- BUG_ON(!S_ISREG(mode));
- dentry = start_creating(name, parent);
-
+ dentry = simplefs_create_file(&tracefs, &trace_fs_type,
+ name, mode, parent, data, &inode);
if (IS_ERR(dentry))
return NULL;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode))
- return failed_creating(dentry);
-
- inode->i_mode = mode;
inode->i_fop = fops ? fops : &tracefs_file_operations;
- inode->i_private = data;
- d_instantiate(dentry, inode);
- fsnotify_create(dentry->d_parent->d_inode, dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
static struct dentry *__create_dir(const char *name, struct dentry *parent,
const struct inode_operations *ops)
{
- struct dentry *dentry = start_creating(name, parent);
+ struct dentry *dentry;
struct inode *inode;
+ dentry = simplefs_create_dir(&tracefs, &trace_fs_type,
+ name, 0755, parent, &inode);
if (IS_ERR(dentry))
return NULL;
- inode = simple_new_inode(dentry->d_sb);
- if (unlikely(!inode))
- return failed_creating(dentry);
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
inode->i_op = ops;
- inode->i_fop = &simple_dir_operations;
-
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
- inc_nlink(inode);
- d_instantiate(dentry, inode);
- inc_nlink(dentry->d_parent->d_inode);
- fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
- return end_creating(dentry);
+ return simplefs_finish_dentry(dentry, inode);
}
/**
--
2.25.2
^ permalink raw reply related [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:54 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:54 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:56PM +0200, Emanuele Giuseppe Esposito wrote:
> We will augment this family of functions with inode management. To avoid
> littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
> with a Kconfig symbol to enable them.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
You have a lot of people on cc:, this is going to be hard for everyone
to review...
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d1398cef3b18..fc38a6f0fc11 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
>
> config READABLE_ASM
> bool "Generate readable assembler code"
> - depends on DEBUG_KERNEL
> - help
> - Disable some compiler optimizations that tend to generate human unreadable
> - assembler output. This may make the kernel slightly slower, but it helps
> - to keep kernel developers who have to stare a lot at assembler listings
> - sane.
> + depends on DEBUG_KERNEL
> + help
> + Disable some compiler optimizations that tend to generate human unreadable
> + assembler output. This may make the kernel slightly slower, but it helps
> + to keep kernel developers who have to stare a lot at assembler listings
> + sane.
> +
Why did you loose the indentation here and add trailing whitespace?
> +config DEBUG_FS
> + bool "Debug Filesystem"
> + select SIMPLEFS
>
We already have a DEBUG_FS config option in this file, why another one?
And what happened to the help text?
I think you need to rework your patch series to do smaller things on
each step, which would make it reviewable much easier, and prevent
mistakes like this one.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-14 12:54 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:54 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
On Tue, Apr 14, 2020 at 02:42:56PM +0200, Emanuele Giuseppe Esposito wrote:
> We will augment this family of functions with inode management. To avoid
> littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
> with a Kconfig symbol to enable them.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
You have a lot of people on cc:, this is going to be hard for everyone
to review...
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d1398cef3b18..fc38a6f0fc11 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
>
> config READABLE_ASM
> bool "Generate readable assembler code"
> - depends on DEBUG_KERNEL
> - help
> - Disable some compiler optimizations that tend to generate human unreadable
> - assembler output. This may make the kernel slightly slower, but it helps
> - to keep kernel developers who have to stare a lot at assembler listings
> - sane.
> + depends on DEBUG_KERNEL
> + help
> + Disable some compiler optimizations that tend to generate human unreadable
> + assembler output. This may make the kernel slightly slower, but it helps
> + to keep kernel developers who have to stare a lot at assembler listings
> + sane.
> +
Why did you loose the indentation here and add trailing whitespace?
> +config DEBUG_FS
> + bool "Debug Filesystem"
> + select SIMPLEFS
>
We already have a DEBUG_FS config option in this file, why another one?
And what happened to the help text?
I think you need to rework your patch series to do smaller things on
each step, which would make it reviewable much easier, and prevent
mistakes like this one.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-14 12:54 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:54 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Daniel Vetter,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:56PM +0200, Emanuele Giuseppe Esposito wrote:
> We will augment this family of functions with inode management. To avoid
> littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
> with a Kconfig symbol to enable them.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
You have a lot of people on cc:, this is going to be hard for everyone
to review...
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d1398cef3b18..fc38a6f0fc11 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
>
> config READABLE_ASM
> bool "Generate readable assembler code"
> - depends on DEBUG_KERNEL
> - help
> - Disable some compiler optimizations that tend to generate human unreadable
> - assembler output. This may make the kernel slightly slower, but it helps
> - to keep kernel developers who have to stare a lot at assembler listings
> - sane.
> + depends on DEBUG_KERNEL
> + help
> + Disable some compiler optimizations that tend to generate human unreadable
> + assembler output. This may make the kernel slightly slower, but it helps
> + to keep kernel developers who have to stare a lot at assembler listings
> + sane.
> +
Why did you loose the indentation here and add trailing whitespace?
> +config DEBUG_FS
> + bool "Debug Filesystem"
> + select SIMPLEFS
>
We already have a DEBUG_FS config option in this file, why another one?
And what happened to the help text?
I think you need to rework your patch series to do smaller things on
each step, which would make it reviewable much easier, and prevent
mistakes like this one.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-14 12:54 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:54 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:56PM +0200, Emanuele Giuseppe Esposito wrote:
> We will augment this family of functions with inode management. To avoid
> littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
> with a Kconfig symbol to enable them.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
You have a lot of people on cc:, this is going to be hard for everyone
to review...
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d1398cef3b18..fc38a6f0fc11 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
>
> config READABLE_ASM
> bool "Generate readable assembler code"
> - depends on DEBUG_KERNEL
> - help
> - Disable some compiler optimizations that tend to generate human unreadable
> - assembler output. This may make the kernel slightly slower, but it helps
> - to keep kernel developers who have to stare a lot at assembler listings
> - sane.
> + depends on DEBUG_KERNEL
> + help
> + Disable some compiler optimizations that tend to generate human unreadable
> + assembler output. This may make the kernel slightly slower, but it helps
> + to keep kernel developers who have to stare a lot at assembler listings
> + sane.
> +
Why did you loose the indentation here and add trailing whitespace?
> +config DEBUG_FS
> + bool "Debug Filesystem"
> + select SIMPLEFS
>
We already have a DEBUG_FS config option in this file, why another one?
And what happened to the help text?
I think you need to rework your patch series to do smaller things on
each step, which would make it reviewable much easier, and prevent
mistakes like this one.
thanks,
greg k-h
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-14 12:54 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:54 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Benjamin Herrenschmidt, Heiko Carstens, Alexei Starovoitov,
dri-devel, J. Bruce Fields, Joseph Qi, Hugh Dickins,
Paul Mackerras, John Johansen, netdev, ocfs2-devel,
Christoph Hellwig, Andrew Donnellan, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman
On Tue, Apr 14, 2020 at 02:42:56PM +0200, Emanuele Giuseppe Esposito wrote:
> We will augment this family of functions with inode management. To avoid
> littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
> with a Kconfig symbol to enable them.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
You have a lot of people on cc:, this is going to be hard for everyone
to review...
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d1398cef3b18..fc38a6f0fc11 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
>
> config READABLE_ASM
> bool "Generate readable assembler code"
> - depends on DEBUG_KERNEL
> - help
> - Disable some compiler optimizations that tend to generate human unreadable
> - assembler output. This may make the kernel slightly slower, but it helps
> - to keep kernel developers who have to stare a lot at assembler listings
> - sane.
> + depends on DEBUG_KERNEL
> + help
> + Disable some compiler optimizations that tend to generate human unreadable
> + assembler output. This may make the kernel slightly slower, but it helps
> + to keep kernel developers who have to stare a lot at assembler listings
> + sane.
> +
Why did you loose the indentation here and add trailing whitespace?
> +config DEBUG_FS
> + bool "Debug Filesystem"
> + select SIMPLEFS
>
We already have a DEBUG_FS config option in this file, why another one?
And what happened to the help text?
I think you need to rework your patch series to do smaller things on
each step, which would make it reviewable much easier, and prevent
mistakes like this one.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:55 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:55 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:59PM +0200, Emanuele Giuseppe Esposito wrote:
> Start adding file creation wrappers, the simplest returns an anonymous
> inode.
This changelog text does not make much sense on its own. Please say why
you are doing something, not just what you are doing.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
@ 2020-04-14 12:55 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:55 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, Trond Myklebust, Anna Schumaker,
J. Bruce Fields, Chuck Lever, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
On Tue, Apr 14, 2020 at 02:42:59PM +0200, Emanuele Giuseppe Esposito wrote:
> Start adding file creation wrappers, the simplest returns an anonymous
> inode.
This changelog text does not make much sense on its own. Please say why
you are doing something, not just what you are doing.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
@ 2020-04-14 12:55 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:55 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Daniel Vetter,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:59PM +0200, Emanuele Giuseppe Esposito wrote:
> Start adding file creation wrappers, the simplest returns an anonymous
> inode.
This changelog text does not make much sense on its own. Please say why
you are doing something, not just what you are doing.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
@ 2020-04-14 12:55 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:55 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:59PM +0200, Emanuele Giuseppe Esposito wrote:
> Start adding file creation wrappers, the simplest returns an anonymous
> inode.
This changelog text does not make much sense on its own. Please say why
you are doing something, not just what you are doing.
thanks,
greg k-h
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 5/8] simplefs: add alloc_anon_inode wrapper
@ 2020-04-14 12:55 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:55 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Benjamin Herrenschmidt, Heiko Carstens, Alexei Starovoitov,
dri-devel, J. Bruce Fields, Joseph Qi, Hugh Dickins,
Paul Mackerras, John Johansen, netdev, ocfs2-devel,
Christoph Hellwig, Andrew Donnellan, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman
On Tue, Apr 14, 2020 at 02:42:59PM +0200, Emanuele Giuseppe Esposito wrote:
> Start adding file creation wrappers, the simplest returns an anonymous
> inode.
This changelog text does not make much sense on its own. Please say why
you are doing something, not just what you are doing.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 6/8] simplefs: add file creation functions
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 12:56 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:56 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
> A bunch of code is duplicated between debugfs and tracefs, unify it to the
> simplefs library.
>
> The code is very similar, except that dentry and inode creation are unified
> into a single function (unlike start_creating in debugfs and tracefs, which
> only takes care of dentries). This adds an output parameter to the creation
> functions, but pushes all error recovery into fs/simplefs.c.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
> include/linux/simplefs.h | 19 +++++
> 2 files changed, 169 insertions(+)
What's wrong with libfs, isn't that supposed to be for these types of
"common" filesystem interactions?
Why create a whole "new" fs for this?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-14 12:56 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:56 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
> A bunch of code is duplicated between debugfs and tracefs, unify it to the
> simplefs library.
>
> The code is very similar, except that dentry and inode creation are unified
> into a single function (unlike start_creating in debugfs and tracefs, which
> only takes care of dentries). This adds an output parameter to the creation
> functions, but pushes all error recovery into fs/simplefs.c.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
> include/linux/simplefs.h | 19 +++++
> 2 files changed, 169 insertions(+)
What's wrong with libfs, isn't that supposed to be for these types of
"common" filesystem interactions?
Why create a whole "new" fs for this?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-14 12:56 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:56 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Daniel Vetter,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
> A bunch of code is duplicated between debugfs and tracefs, unify it to the
> simplefs library.
>
> The code is very similar, except that dentry and inode creation are unified
> into a single function (unlike start_creating in debugfs and tracefs, which
> only takes care of dentries). This adds an output parameter to the creation
> functions, but pushes all error recovery into fs/simplefs.c.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
> include/linux/simplefs.h | 19 +++++
> 2 files changed, 169 insertions(+)
What's wrong with libfs, isn't that supposed to be for these types of
"common" filesystem interactions?
Why create a whole "new" fs for this?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-14 12:56 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:56 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
> A bunch of code is duplicated between debugfs and tracefs, unify it to the
> simplefs library.
>
> The code is very similar, except that dentry and inode creation are unified
> into a single function (unlike start_creating in debugfs and tracefs, which
> only takes care of dentries). This adds an output parameter to the creation
> functions, but pushes all error recovery into fs/simplefs.c.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
> include/linux/simplefs.h | 19 +++++
> 2 files changed, 169 insertions(+)
What's wrong with libfs, isn't that supposed to be for these types of
"common" filesystem interactions?
Why create a whole "new" fs for this?
thanks,
greg k-h
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-14 12:56 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 12:56 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Benjamin Herrenschmidt, Heiko Carstens, Alexei Starovoitov,
dri-devel, J. Bruce Fields, Joseph Qi, Hugh Dickins,
Paul Mackerras, John Johansen, netdev, ocfs2-devel,
Christoph Hellwig, Andrew Donnellan, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman
On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
> A bunch of code is duplicated between debugfs and tracefs, unify it to the
> simplefs library.
>
> The code is very similar, except that dentry and inode creation are unified
> into a single function (unlike start_creating in debugfs and tracefs, which
> only takes care of dentries). This adds an output parameter to the creation
> functions, but pushes all error recovery into fs/simplefs.c.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
> include/linux/simplefs.h | 19 +++++
> 2 files changed, 169 insertions(+)
What's wrong with libfs, isn't that supposed to be for these types of
"common" filesystem interactions?
Why create a whole "new" fs for this?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 4/8] fs: introduce simple_new_inode
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 13:01 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 13:01 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote:
> It is a common special case for new_inode to initialize the
> time to the current time and the inode to get_next_ino().
> Introduce a core function that does it and use it throughout
> Linux.
Shouldn't this just be called new_inode_current_time()?
How is anyone going to remember what simple_new_inode() does to the
inode structure?
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
> }
> EXPORT_SYMBOL(simple_write_end);
>
> +struct inode *simple_new_inode(struct super_block *sb)
> +{
> + struct inode *inode = new_inode(sb);
> + if (inode) {
> + inode->i_ino = get_next_ino();
> + inode->i_atime = inode->i_mtime =
> + inode->i_ctime = current_time(inode);
> + }
> + return inode;
> +}
> +EXPORT_SYMBOL(simple_new_inode);
No kernel doc explaining that get_next_ino() is called already?
Please document new global functions like this so we have a chance to
know how to use them.
Also, it is almost always easier to introduce a common function, get it
merged, and _THEN_ send out cleanup functions to all of the different
subsystems to convert over to it. Yes, it takes longer, but it makes it
possible to do this in a way that can be reviewed properly, unlike this
patch series :(
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-14 13:01 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 13:01 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote:
> It is a common special case for new_inode to initialize the
> time to the current time and the inode to get_next_ino().
> Introduce a core function that does it and use it throughout
> Linux.
Shouldn't this just be called new_inode_current_time()?
How is anyone going to remember what simple_new_inode() does to the
inode structure?
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
> }
> EXPORT_SYMBOL(simple_write_end);
>
> +struct inode *simple_new_inode(struct super_block *sb)
> +{
> + struct inode *inode = new_inode(sb);
> + if (inode) {
> + inode->i_ino = get_next_ino();
> + inode->i_atime = inode->i_mtime =
> + inode->i_ctime = current_time(inode);
> + }
> + return inode;
> +}
> +EXPORT_SYMBOL(simple_new_inode);
No kernel doc explaining that get_next_ino() is called already?
Please document new global functions like this so we have a chance to
know how to use them.
Also, it is almost always easier to introduce a common function, get it
merged, and _THEN_ send out cleanup functions to all of the different
subsystems to convert over to it. Yes, it takes longer, but it makes it
possible to do this in a way that can be reviewed properly, unlike this
patch series :(
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-14 13:01 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 13:01 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Daniel Vetter,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote:
> It is a common special case for new_inode to initialize the
> time to the current time and the inode to get_next_ino().
> Introduce a core function that does it and use it throughout
> Linux.
Shouldn't this just be called new_inode_current_time()?
How is anyone going to remember what simple_new_inode() does to the
inode structure?
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
> }
> EXPORT_SYMBOL(simple_write_end);
>
> +struct inode *simple_new_inode(struct super_block *sb)
> +{
> + struct inode *inode = new_inode(sb);
> + if (inode) {
> + inode->i_ino = get_next_ino();
> + inode->i_atime = inode->i_mtime =
> + inode->i_ctime = current_time(inode);
> + }
> + return inode;
> +}
> +EXPORT_SYMBOL(simple_new_inode);
No kernel doc explaining that get_next_ino() is called already?
Please document new global functions like this so we have a chance to
know how to use them.
Also, it is almost always easier to introduce a common function, get it
merged, and _THEN_ send out cleanup functions to all of the different
subsystems to convert over to it. Yes, it takes longer, but it makes it
possible to do this in a way that can be reviewed properly, unlike this
patch series :(
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-14 13:01 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 13:01 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote:
> It is a common special case for new_inode to initialize the
> time to the current time and the inode to get_next_ino().
> Introduce a core function that does it and use it throughout
> Linux.
Shouldn't this just be called new_inode_current_time()?
How is anyone going to remember what simple_new_inode() does to the
inode structure?
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
> }
> EXPORT_SYMBOL(simple_write_end);
>
> +struct inode *simple_new_inode(struct super_block *sb)
> +{
> + struct inode *inode = new_inode(sb);
> + if (inode) {
> + inode->i_ino = get_next_ino();
> + inode->i_atime = inode->i_mtime =
> + inode->i_ctime = current_time(inode);
> + }
> + return inode;
> +}
> +EXPORT_SYMBOL(simple_new_inode);
No kernel doc explaining that get_next_ino() is called already?
Please document new global functions like this so we have a chance to
know how to use them.
Also, it is almost always easier to introduce a common function, get it
merged, and _THEN_ send out cleanup functions to all of the different
subsystems to convert over to it. Yes, it takes longer, but it makes it
possible to do this in a way that can be reviewed properly, unlike this
patch series :(
thanks,
greg k-h
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-14 13:01 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 13:01 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Benjamin Herrenschmidt, Heiko Carstens, Alexei Starovoitov,
dri-devel, J. Bruce Fields, Joseph Qi, Hugh Dickins,
Paul Mackerras, John Johansen, netdev, ocfs2-devel,
Christoph Hellwig, Andrew Donnellan, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman
On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote:
> It is a common special case for new_inode to initialize the
> time to the current time and the inode to get_next_ino().
> Introduce a core function that does it and use it throughout
> Linux.
Shouldn't this just be called new_inode_current_time()?
How is anyone going to remember what simple_new_inode() does to the
inode structure?
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
> }
> EXPORT_SYMBOL(simple_write_end);
>
> +struct inode *simple_new_inode(struct super_block *sb)
> +{
> + struct inode *inode = new_inode(sb);
> + if (inode) {
> + inode->i_ino = get_next_ino();
> + inode->i_atime = inode->i_mtime =
> + inode->i_ctime = current_time(inode);
> + }
> + return inode;
> +}
> +EXPORT_SYMBOL(simple_new_inode);
No kernel doc explaining that get_next_ino() is called already?
Please document new global functions like this so we have a chance to
know how to use them.
Also, it is almost always easier to introduce a common function, get it
merged, and _THEN_ send out cleanup functions to all of the different
subsystems to convert over to it. Yes, it takes longer, but it makes it
possible to do this in a way that can be reviewed properly, unlike this
patch series :(
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-14 13:03 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 13:03 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:57PM +0200, Emanuele Giuseppe Esposito wrote:
> @@ -676,9 +674,9 @@ static void __debugfs_file_removed(struct dentry *dentry)
>
> static void remove_one(struct dentry *victim)
> {
> - if (d_is_reg(victim))
> + if (d_is_reg(victim))
> __debugfs_file_removed(victim);
> - simple_release_fs(&debugfs_mount, &debugfs_mount_count);
> + simple_release_fs(&debugfs);
> }
>
> /**
Always run checkpatch.pl on your patches so you do not get grumpy
maintainers telling you to run checkpatch.pl on your patches...
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
@ 2020-04-14 13:03 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 13:03 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
On Tue, Apr 14, 2020 at 02:42:57PM +0200, Emanuele Giuseppe Esposito wrote:
> @@ -676,9 +674,9 @@ static void __debugfs_file_removed(struct dentry *dentry)
>
> static void remove_one(struct dentry *victim)
> {
> - if (d_is_reg(victim))
> + if (d_is_reg(victim))
> __debugfs_file_removed(victim);
> - simple_release_fs(&debugfs_mount, &debugfs_mount_count);
> + simple_release_fs(&debugfs);
> }
>
> /**
Always run checkpatch.pl on your patches so you do not get grumpy
maintainers telling you to run checkpatch.pl on your patches...
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
@ 2020-04-14 13:03 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 13:03 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Daniel Vetter,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:57PM +0200, Emanuele Giuseppe Esposito wrote:
> @@ -676,9 +674,9 @@ static void __debugfs_file_removed(struct dentry *dentry)
>
> static void remove_one(struct dentry *victim)
> {
> - if (d_is_reg(victim))
> + if (d_is_reg(victim))
> __debugfs_file_removed(victim);
> - simple_release_fs(&debugfs_mount, &debugfs_mount_count);
> + simple_release_fs(&debugfs);
> }
>
> /**
Always run checkpatch.pl on your patches so you do not get grumpy
maintainers telling you to run checkpatch.pl on your patches...
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
@ 2020-04-14 13:03 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 13:03 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Tue, Apr 14, 2020 at 02:42:57PM +0200, Emanuele Giuseppe Esposito wrote:
> @@ -676,9 +674,9 @@ static void __debugfs_file_removed(struct dentry *dentry)
>
> static void remove_one(struct dentry *victim)
> {
> - if (d_is_reg(victim))
> + if (d_is_reg(victim))
> __debugfs_file_removed(victim);
> - simple_release_fs(&debugfs_mount, &debugfs_mount_count);
> + simple_release_fs(&debugfs);
> }
>
> /**
Always run checkpatch.pl on your patches so you do not get grumpy
maintainers telling you to run checkpatch.pl on your patches...
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
@ 2020-04-14 13:03 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-14 13:03 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Benjamin Herrenschmidt, Heiko Carstens, Alexei Starovoitov,
dri-devel, J. Bruce Fields, Joseph Qi, Hugh Dickins,
Paul Mackerras, John Johansen, netdev, ocfs2-devel,
Christoph Hellwig, Andrew Donnellan, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman
On Tue, Apr 14, 2020 at 02:42:57PM +0200, Emanuele Giuseppe Esposito wrote:
> @@ -676,9 +674,9 @@ static void __debugfs_file_removed(struct dentry *dentry)
>
> static void remove_one(struct dentry *victim)
> {
> - if (d_is_reg(victim))
> + if (d_is_reg(victim))
> __debugfs_file_removed(victim);
> - simple_release_fs(&debugfs_mount, &debugfs_mount_count);
> + simple_release_fs(&debugfs);
> }
>
> /**
Always run checkpatch.pl on your patches so you do not get grumpy
maintainers telling you to run checkpatch.pl on your patches...
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
@ 2020-04-14 23:24 ` kbuild test robot
-1 siblings, 0 replies; 130+ messages in thread
From: kbuild test robot @ 2020-04-14 23:24 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, linux-nfs
Cc: kbuild-all, Paolo Bonzini, Emanuele Giuseppe Esposito,
Jeremy Kerr, Arnd Bergmann, Michael Ellerman,
Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
Vasily Gorbik
Hi Emanuele,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on driver-core/driver-core-testing linus/master v5.7-rc1 next-20200414]
[cannot apply to security/next-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Emanuele-Giuseppe-Esposito/Simplefs-group-and-simplify-linux-fs-code/20200415-030834
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 885a64715fd81e6af6d94a038556e0b2e6deb19c
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
smatch warnings:
fs/debugfs/inode.c:689 remove_one() warn: inconsistent indenting
vim +689 fs/debugfs/inode.c
684
685 static void remove_one(struct dentry *victim)
686 {
687 if (d_is_reg(victim))
688 __debugfs_file_removed(victim);
> 689 simple_release_fs(&debugfs);
690 }
691
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct
@ 2020-04-14 23:24 ` kbuild test robot
0 siblings, 0 replies; 130+ messages in thread
From: kbuild test robot @ 2020-04-14 23:24 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]
Hi Emanuele,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on driver-core/driver-core-testing linus/master v5.7-rc1 next-20200414]
[cannot apply to security/next-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Emanuele-Giuseppe-Esposito/Simplefs-group-and-simplify-linux-fs-code/20200415-030834
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 885a64715fd81e6af6d94a038556e0b2e6deb19c
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
smatch warnings:
fs/debugfs/inode.c:689 remove_one() warn: inconsistent indenting
vim +689 fs/debugfs/inode.c
684
685 static void remove_one(struct dentry *victim)
686 {
687 if (d_is_reg(victim))
688 __debugfs_file_removed(victim);
> 689 simple_release_fs(&debugfs);
690 }
691
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
(?)
@ 2020-04-15 0:57 ` kbuild test robot
-1 siblings, 0 replies; 130+ messages in thread
From: kbuild test robot @ 2020-04-15 0:57 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, linux-nfs
Cc: kbuild-all, Song Liu, linux-usb, bpf, Rafael J. Wysocki,
David Airlie, Heiko Carstens, Alexei Starovoitov, dri-devel,
J. Bruce Fields
[-- Attachment #1: Type: text/plain, Size: 2348 bytes --]
Hi Emanuele,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on driver-core/driver-core-testing linus/master v5.7-rc1 next-20200414]
[cannot apply to security/next-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Emanuele-Giuseppe-Esposito/Simplefs-group-and-simplify-linux-fs-code/20200415-030834
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 885a64715fd81e6af6d94a038556e0b2e6deb19c
config: arm-mvebu_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `remove_one':
>> inode.c:(.text+0x1c): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `start_creating.part.0':
inode.c:(.text+0x454): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `__create_dir':
>> inode.c:(.text+0x55c): undefined reference to `simple_pin_fs'
>> arm-linux-gnueabi-ld: inode.c:(.text+0x640): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `tracefs_create_file':
inode.c:(.text+0x690): undefined reference to `simple_pin_fs'
arm-linux-gnueabi-ld: inode.c:(.text+0x75c): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `tracefs_remove':
inode.c:(.text+0x79c): undefined reference to `simple_pin_fs'
arm-linux-gnueabi-ld: inode.c:(.text+0x7c0): undefined reference to `simple_release_fs'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26295 bytes --]
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-15 0:57 ` kbuild test robot
0 siblings, 0 replies; 130+ messages in thread
From: kbuild test robot @ 2020-04-15 0:57 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, linux-nfs
Cc: Song Liu, kbuild-all, Rafael J. Wysocki, David Airlie, linux-usb,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
bpf
[-- Attachment #1: Type: text/plain, Size: 2348 bytes --]
Hi Emanuele,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on driver-core/driver-core-testing linus/master v5.7-rc1 next-20200414]
[cannot apply to security/next-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Emanuele-Giuseppe-Esposito/Simplefs-group-and-simplify-linux-fs-code/20200415-030834
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 885a64715fd81e6af6d94a038556e0b2e6deb19c
config: arm-mvebu_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `remove_one':
>> inode.c:(.text+0x1c): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `start_creating.part.0':
inode.c:(.text+0x454): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `__create_dir':
>> inode.c:(.text+0x55c): undefined reference to `simple_pin_fs'
>> arm-linux-gnueabi-ld: inode.c:(.text+0x640): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `tracefs_create_file':
inode.c:(.text+0x690): undefined reference to `simple_pin_fs'
arm-linux-gnueabi-ld: inode.c:(.text+0x75c): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `tracefs_remove':
inode.c:(.text+0x79c): undefined reference to `simple_pin_fs'
arm-linux-gnueabi-ld: inode.c:(.text+0x7c0): undefined reference to `simple_release_fs'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26295 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-15 0:57 ` kbuild test robot
0 siblings, 0 replies; 130+ messages in thread
From: kbuild test robot @ 2020-04-15 0:57 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2393 bytes --]
Hi Emanuele,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on driver-core/driver-core-testing linus/master v5.7-rc1 next-20200414]
[cannot apply to security/next-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Emanuele-Giuseppe-Esposito/Simplefs-group-and-simplify-linux-fs-code/20200415-030834
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 885a64715fd81e6af6d94a038556e0b2e6deb19c
config: arm-mvebu_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `remove_one':
>> inode.c:(.text+0x1c): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `start_creating.part.0':
inode.c:(.text+0x454): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `__create_dir':
>> inode.c:(.text+0x55c): undefined reference to `simple_pin_fs'
>> arm-linux-gnueabi-ld: inode.c:(.text+0x640): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `tracefs_create_file':
inode.c:(.text+0x690): undefined reference to `simple_pin_fs'
arm-linux-gnueabi-ld: inode.c:(.text+0x75c): undefined reference to `simple_release_fs'
arm-linux-gnueabi-ld: fs/tracefs/inode.o: in function `tracefs_remove':
inode.c:(.text+0x79c): undefined reference to `simple_pin_fs'
arm-linux-gnueabi-ld: inode.c:(.text+0x7c0): undefined reference to `simple_release_fs'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26295 bytes --]
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
@ 2020-04-15 12:52 ` kbuild test robot
-1 siblings, 0 replies; 130+ messages in thread
From: kbuild test robot @ 2020-04-15 12:52 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, linux-nfs
Cc: kbuild-all, Paolo Bonzini, Emanuele Giuseppe Esposito,
Jeremy Kerr, Arnd Bergmann, Michael Ellerman,
Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
Vasily Gorbik
[-- Attachment #1: Type: text/plain, Size: 5789 bytes --]
Hi Emanuele,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on driver-core/driver-core-testing linus/master v5.7-rc1 next-20200415]
[cannot apply to security/next-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Emanuele-Giuseppe-Esposito/Simplefs-group-and-simplify-linux-fs-code/20200415-030834
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 885a64715fd81e6af6d94a038556e0b2e6deb19c
config: x86_64-rhel-7.6 (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Note: the linux-review/Emanuele-Giuseppe-Esposito/Simplefs-group-and-simplify-linux-fs-code/20200415-030834 HEAD 3016bd2448d788b615dc4b927f320d2463dd67da builds fine.
It only hurts bisectibility.
All error/warnings (new ones prefixed by >>):
security/apparmor/apparmorfs.c: In function 'aa_mk_null_file':
>> security/apparmor/apparmorfs.c:2540:3: error: 'error' undeclared (first use in this function); did you mean 'errorf'?
error = PTR_ERR(dentry);
^~~~~
errorf
security/apparmor/apparmorfs.c:2540:3: note: each undeclared identifier is reported only once for each function it appears in
>> security/apparmor/apparmorfs.c:2566:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
vim +2540 security/apparmor/apparmorfs.c
a71ada305801e9 John Johansen 2017-01-16 2525
a71ada305801e9 John Johansen 2017-01-16 2526 static int aa_mk_null_file(struct dentry *parent)
a71ada305801e9 John Johansen 2017-01-16 2527 {
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2528 struct file_system_type *type = parent->d_sb->s_type;
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2529 struct vfsmount *mount;
a71ada305801e9 John Johansen 2017-01-16 2530 struct dentry *dentry;
a71ada305801e9 John Johansen 2017-01-16 2531 struct inode *inode;
a71ada305801e9 John Johansen 2017-01-16 2532
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2533 mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2534 if (IS_ERR(mount))
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2535 return PTR_ERR(mount);
a71ada305801e9 John Johansen 2017-01-16 2536
a71ada305801e9 John Johansen 2017-01-16 2537 inode_lock(d_inode(parent));
a71ada305801e9 John Johansen 2017-01-16 2538 dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
a71ada305801e9 John Johansen 2017-01-16 2539 if (IS_ERR(dentry)) {
a71ada305801e9 John Johansen 2017-01-16 @2540 error = PTR_ERR(dentry);
a71ada305801e9 John Johansen 2017-01-16 2541 goto out;
a71ada305801e9 John Johansen 2017-01-16 2542 }
a71ada305801e9 John Johansen 2017-01-16 2543 inode = new_inode(parent->d_inode->i_sb);
a71ada305801e9 John Johansen 2017-01-16 2544 if (!inode) {
a71ada305801e9 John Johansen 2017-01-16 2545 error = -ENOMEM;
a71ada305801e9 John Johansen 2017-01-16 2546 goto out1;
a71ada305801e9 John Johansen 2017-01-16 2547 }
a71ada305801e9 John Johansen 2017-01-16 2548
a71ada305801e9 John Johansen 2017-01-16 2549 inode->i_ino = get_next_ino();
a71ada305801e9 John Johansen 2017-01-16 2550 inode->i_mode = S_IFCHR | S_IRUGO | S_IWUGO;
24d0d03c2edcd2 Deepa Dinamani 2017-05-08 2551 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
a71ada305801e9 John Johansen 2017-01-16 2552 init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO,
a71ada305801e9 John Johansen 2017-01-16 2553 MKDEV(MEM_MAJOR, 3));
a71ada305801e9 John Johansen 2017-01-16 2554 d_instantiate(dentry, inode);
a71ada305801e9 John Johansen 2017-01-16 2555 aa_null.dentry = dget(dentry);
a71ada305801e9 John Johansen 2017-01-16 2556 aa_null.mnt = mntget(mount);
a71ada305801e9 John Johansen 2017-01-16 2557
a71ada305801e9 John Johansen 2017-01-16 2558 error = 0;
a71ada305801e9 John Johansen 2017-01-16 2559
a71ada305801e9 John Johansen 2017-01-16 2560 out1:
a71ada305801e9 John Johansen 2017-01-16 2561 dput(dentry);
a71ada305801e9 John Johansen 2017-01-16 2562 out:
a71ada305801e9 John Johansen 2017-01-16 2563 inode_unlock(d_inode(parent));
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2564 mntput(mount);
a71ada305801e9 John Johansen 2017-01-16 2565 return error;
a71ada305801e9 John Johansen 2017-01-16 @2566 }
a71ada305801e9 John Johansen 2017-01-16 2567
:::::: The code at line 2540 was first introduced by commit
:::::: a71ada305801e940ff69c2c58489778760e5148b apparmor: add special .null file used to "close" fds at exec
:::::: TO: John Johansen <john.johansen@canonical.com>
:::::: CC: John Johansen <john.johansen@canonical.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49217 bytes --]
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-15 12:52 ` kbuild test robot
0 siblings, 0 replies; 130+ messages in thread
From: kbuild test robot @ 2020-04-15 12:52 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5883 bytes --]
Hi Emanuele,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on driver-core/driver-core-testing linus/master v5.7-rc1 next-20200415]
[cannot apply to security/next-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Emanuele-Giuseppe-Esposito/Simplefs-group-and-simplify-linux-fs-code/20200415-030834
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 885a64715fd81e6af6d94a038556e0b2e6deb19c
config: x86_64-rhel-7.6 (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Note: the linux-review/Emanuele-Giuseppe-Esposito/Simplefs-group-and-simplify-linux-fs-code/20200415-030834 HEAD 3016bd2448d788b615dc4b927f320d2463dd67da builds fine.
It only hurts bisectibility.
All error/warnings (new ones prefixed by >>):
security/apparmor/apparmorfs.c: In function 'aa_mk_null_file':
>> security/apparmor/apparmorfs.c:2540:3: error: 'error' undeclared (first use in this function); did you mean 'errorf'?
error = PTR_ERR(dentry);
^~~~~
errorf
security/apparmor/apparmorfs.c:2540:3: note: each undeclared identifier is reported only once for each function it appears in
>> security/apparmor/apparmorfs.c:2566:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
vim +2540 security/apparmor/apparmorfs.c
a71ada305801e9 John Johansen 2017-01-16 2525
a71ada305801e9 John Johansen 2017-01-16 2526 static int aa_mk_null_file(struct dentry *parent)
a71ada305801e9 John Johansen 2017-01-16 2527 {
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2528 struct file_system_type *type = parent->d_sb->s_type;
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2529 struct vfsmount *mount;
a71ada305801e9 John Johansen 2017-01-16 2530 struct dentry *dentry;
a71ada305801e9 John Johansen 2017-01-16 2531 struct inode *inode;
a71ada305801e9 John Johansen 2017-01-16 2532
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2533 mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2534 if (IS_ERR(mount))
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2535 return PTR_ERR(mount);
a71ada305801e9 John Johansen 2017-01-16 2536
a71ada305801e9 John Johansen 2017-01-16 2537 inode_lock(d_inode(parent));
a71ada305801e9 John Johansen 2017-01-16 2538 dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
a71ada305801e9 John Johansen 2017-01-16 2539 if (IS_ERR(dentry)) {
a71ada305801e9 John Johansen 2017-01-16 @2540 error = PTR_ERR(dentry);
a71ada305801e9 John Johansen 2017-01-16 2541 goto out;
a71ada305801e9 John Johansen 2017-01-16 2542 }
a71ada305801e9 John Johansen 2017-01-16 2543 inode = new_inode(parent->d_inode->i_sb);
a71ada305801e9 John Johansen 2017-01-16 2544 if (!inode) {
a71ada305801e9 John Johansen 2017-01-16 2545 error = -ENOMEM;
a71ada305801e9 John Johansen 2017-01-16 2546 goto out1;
a71ada305801e9 John Johansen 2017-01-16 2547 }
a71ada305801e9 John Johansen 2017-01-16 2548
a71ada305801e9 John Johansen 2017-01-16 2549 inode->i_ino = get_next_ino();
a71ada305801e9 John Johansen 2017-01-16 2550 inode->i_mode = S_IFCHR | S_IRUGO | S_IWUGO;
24d0d03c2edcd2 Deepa Dinamani 2017-05-08 2551 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
a71ada305801e9 John Johansen 2017-01-16 2552 init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO,
a71ada305801e9 John Johansen 2017-01-16 2553 MKDEV(MEM_MAJOR, 3));
a71ada305801e9 John Johansen 2017-01-16 2554 d_instantiate(dentry, inode);
a71ada305801e9 John Johansen 2017-01-16 2555 aa_null.dentry = dget(dentry);
a71ada305801e9 John Johansen 2017-01-16 2556 aa_null.mnt = mntget(mount);
a71ada305801e9 John Johansen 2017-01-16 2557
a71ada305801e9 John Johansen 2017-01-16 2558 error = 0;
a71ada305801e9 John Johansen 2017-01-16 2559
a71ada305801e9 John Johansen 2017-01-16 2560 out1:
a71ada305801e9 John Johansen 2017-01-16 2561 dput(dentry);
a71ada305801e9 John Johansen 2017-01-16 2562 out:
a71ada305801e9 John Johansen 2017-01-16 2563 inode_unlock(d_inode(parent));
4b30b45c1ddc88 Emanuele Giuseppe Esposito 2020-04-14 2564 mntput(mount);
a71ada305801e9 John Johansen 2017-01-16 2565 return error;
a71ada305801e9 John Johansen 2017-01-16 @2566 }
a71ada305801e9 John Johansen 2017-01-16 2567
:::::: The code at line 2540 was first introduced by commit
:::::: a71ada305801e940ff69c2c58489778760e5148b apparmor: add special .null file used to "close" fds at exec
:::::: TO: John Johansen <john.johansen@canonical.com>
:::::: CC: John Johansen <john.johansen@canonical.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 49217 bytes --]
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-16 6:44 ` Luis Chamberlain
-1 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:44 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, Goldwyn Rodrigues
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
netdev, Robert Richter, Thomas Zimmermann, Vasily Gorbik,
Tony Luck, Kees Cook, James E.J. Bottomley, autofs,
Mike Marciniszyn, linux-fsdevel, Manoj N. Kumar, Uma Krishnan,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, linux-nfs, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-kernel, Anna Schumaker,
linux-security-module, Chuck Lever, Jeremy Kerr, Colin Cross,
Frederic Barrat, Paolo Bonzini, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, Joel Becker, Alexander Viro
On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote:
> aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
> variables as arguments, for what would amount to a simple
> vfs_kern_mount/mntput pair if everything was inlined. Just use
> the normal filesystem API since the reference counting is not needed
> here.
*Why* is refcounting not needed here?
Luis
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> security/apparmor/apparmorfs.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index 280741fc0f5f..828bb1eb77ea 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -2525,14 +2525,14 @@ struct path aa_null;
>
> static int aa_mk_null_file(struct dentry *parent)
> {
> - struct vfsmount *mount = NULL;
> + struct file_system_type *type = parent->d_sb->s_type;
> + struct vfsmount *mount;
> struct dentry *dentry;
> struct inode *inode;
> - int count = 0;
> - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
>
> - if (error)
> - return error;
> + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
> + if (IS_ERR(mount))
> + return PTR_ERR(mount);
>
> inode_lock(d_inode(parent));
> dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
> @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
> dput(dentry);
> out:
> inode_unlock(d_inode(parent));
> - simple_release_fs(&mount, &count);
> + mntput(mount);
> return error;
> }
>
> --
> 2.25.2
>
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-16 6:44 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:44 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, Goldwyn Rodrigues
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Greg Kroah-Hartman, Robert Richter,
Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
Alexander Viro, Ian Kent, Joel Becker, Christoph Hellwig,
Rafael J. Wysocki, Matthew Garrett, Ard Biesheuvel,
Miklos Szeredi, Mike Kravetz, Mark Fasheh, Joseph Qi,
Alexey Dobriyan, Kees Cook, Iurii Zaikin, Anton Vorontsov,
Colin Cross, Tony Luck, Alexei Starovoitov, Daniel Borkmann,
Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
John Fastabend, KP Singh, Hugh Dickins, Andrew Morton,
J. Bruce Fields, Chuck Lever, Trond Myklebust, Anna Schumaker,
David S. Miller, Jakub Kicinski, James Morris, Serge E. Hallyn,
John Johansen, linuxppc-dev, linux-kernel, linux-s390, dri-devel,
linux-rdma, oprofile-list, linux-scsi, linux-usb, linux-fsdevel,
autofs, linux-efi, linux-mm, ocfs2-devel, netdev, bpf,
linux-security-module
On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote:
> aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
> variables as arguments, for what would amount to a simple
> vfs_kern_mount/mntput pair if everything was inlined. Just use
> the normal filesystem API since the reference counting is not needed
> here.
*Why* is refcounting not needed here?
Luis
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> security/apparmor/apparmorfs.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index 280741fc0f5f..828bb1eb77ea 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -2525,14 +2525,14 @@ struct path aa_null;
>
> static int aa_mk_null_file(struct dentry *parent)
> {
> - struct vfsmount *mount = NULL;
> + struct file_system_type *type = parent->d_sb->s_type;
> + struct vfsmount *mount;
> struct dentry *dentry;
> struct inode *inode;
> - int count = 0;
> - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
>
> - if (error)
> - return error;
> + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
> + if (IS_ERR(mount))
> + return PTR_ERR(mount);
>
> inode_lock(d_inode(parent));
> dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
> @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
> dput(dentry);
> out:
> inode_unlock(d_inode(parent));
> - simple_release_fs(&mount, &count);
> + mntput(mount);
> return error;
> }
>
> --
> 2.25.2
>
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-16 6:44 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:44 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, Goldwyn Rodrigues
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
Greg Kroah-Hartman, Dennis Dalessandro, Miklos Szeredi,
linux-kernel, Anna Schumaker, linux-security-module, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, Joel Becker, Alexander Viro
On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote:
> aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
> variables as arguments, for what would amount to a simple
> vfs_kern_mount/mntput pair if everything was inlined. Just use
> the normal filesystem API since the reference counting is not needed
> here.
*Why* is refcounting not needed here?
Luis
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> security/apparmor/apparmorfs.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index 280741fc0f5f..828bb1eb77ea 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -2525,14 +2525,14 @@ struct path aa_null;
>
> static int aa_mk_null_file(struct dentry *parent)
> {
> - struct vfsmount *mount = NULL;
> + struct file_system_type *type = parent->d_sb->s_type;
> + struct vfsmount *mount;
> struct dentry *dentry;
> struct inode *inode;
> - int count = 0;
> - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
>
> - if (error)
> - return error;
> + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
> + if (IS_ERR(mount))
> + return PTR_ERR(mount);
>
> inode_lock(d_inode(parent));
> dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
> @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
> dput(dentry);
> out:
> inode_unlock(d_inode(parent));
> - simple_release_fs(&mount, &count);
> + mntput(mount);
> return error;
> }
>
> --
> 2.25.2
>
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-16 6:44 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:44 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, Goldwyn Rodrigues
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
netdev, Robert Richter, Thomas Zimmermann, Vasily Gorbik,
Tony Luck, Kees Cook, James E.J. Bottomley, autofs,
Mike Marciniszyn, linux-fsdevel, Manoj N. Kumar, Uma Krishnan,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, linux-nfs, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-kernel, Anna Schumaker,
linux-security-module, Chuck Lever, Jeremy Kerr, Colin Cross,
Frederic Barrat, Paolo Bonzini, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, Joel Becker, Alexander Viro
On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote:
> aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
> variables as arguments, for what would amount to a simple
> vfs_kern_mount/mntput pair if everything was inlined. Just use
> the normal filesystem API since the reference counting is not needed
> here.
*Why* is refcounting not needed here?
Luis
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> security/apparmor/apparmorfs.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index 280741fc0f5f..828bb1eb77ea 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -2525,14 +2525,14 @@ struct path aa_null;
>
> static int aa_mk_null_file(struct dentry *parent)
> {
> - struct vfsmount *mount = NULL;
> + struct file_system_type *type = parent->d_sb->s_type;
> + struct vfsmount *mount;
> struct dentry *dentry;
> struct inode *inode;
> - int count = 0;
> - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
>
> - if (error)
> - return error;
> + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
> + if (IS_ERR(mount))
> + return PTR_ERR(mount);
>
> inode_lock(d_inode(parent));
> dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
> @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
> dput(dentry);
> out:
> inode_unlock(d_inode(parent));
> - simple_release_fs(&mount, &count);
> + mntput(mount);
> return error;
> }
>
> --
> 2.25.2
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-16 6:44 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:44 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, Goldwyn Rodrigues
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov
On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote:
> aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
> variables as arguments, for what would amount to a simple
> vfs_kern_mount/mntput pair if everything was inlined. Just use
> the normal filesystem API since the reference counting is not needed
> here.
*Why* is refcounting not needed here?
Luis
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> security/apparmor/apparmorfs.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index 280741fc0f5f..828bb1eb77ea 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -2525,14 +2525,14 @@ struct path aa_null;
>
> static int aa_mk_null_file(struct dentry *parent)
> {
> - struct vfsmount *mount = NULL;
> + struct file_system_type *type = parent->d_sb->s_type;
> + struct vfsmount *mount;
> struct dentry *dentry;
> struct inode *inode;
> - int count = 0;
> - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
>
> - if (error)
> - return error;
> + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
> + if (IS_ERR(mount))
> + return PTR_ERR(mount);
>
> inode_lock(d_inode(parent));
> dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
> @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
> dput(dentry);
> out:
> inode_unlock(d_inode(parent));
> - simple_release_fs(&mount, &count);
> + mntput(mount);
> return error;
> }
>
> --
> 2.25.2
>
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-16 6:52 ` Luis Chamberlain
-1 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:52 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
netdev, Robert Richter, Thomas Zimmermann, Vasily Gorbik,
Tony Luck, Kees Cook, James E.J. Bottomley, autofs,
Mike Marciniszyn, linux-fsdevel, Manoj N. Kumar, Uma Krishnan,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, linux-nfs, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-kernel, Anna Schumaker,
linux-security-module, Chuck Lever, Jeremy Kerr, Colin Cross,
Frederic Barrat, Paolo Bonzini, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, Joel Becker, Alexander Viro
On Tue, Apr 14, 2020 at 02:42:56PM +0200, Emanuele Giuseppe Esposito wrote:
> We will augment this family of functions with inode management. To avoid
> littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
> with a Kconfig symbol to enable them.
If there are no functional changes, indicating that on the commit log
will make the review much easier.
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d1398cef3b18..fc38a6f0fc11 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
>
> config READABLE_ASM
> bool "Generate readable assembler code"
> - depends on DEBUG_KERNEL
> - help
> - Disable some compiler optimizations that tend to generate human unreadable
> - assembler output. This may make the kernel slightly slower, but it helps
> - to keep kernel developers who have to stare a lot at assembler listings
> - sane.
> + depends on DEBUG_KERNEL
> + help
> + Disable some compiler optimizations that tend to generate human unreadable
> + assembler output. This may make the kernel slightly slower, but it helps
> + to keep kernel developers who have to stare a lot at assembler listings
> + sane.
> +
This minor change above should just be a separate patch. Its just noise
otherwise.
> +config DEBUG_FS
> + bool "Debug Filesystem"
> + select SIMPLEFS
I'm at a loss reviewing this, my lib/Kconfig.debug already has a config
DEBUG_FS. But above I see it is being added for the very first time.
I'm sure there is some odd conditional which is obscuring this, can
this be explained in the commit log?
Luis
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-16 6:52 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:52 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Greg Kroah-Hartman, Robert Richter,
Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
Alexander Viro, Ian Kent, Joel Becker, Christoph Hellwig,
Rafael J. Wysocki, Matthew Garrett, Ard Biesheuvel,
Miklos Szeredi, Mike Kravetz, Mark Fasheh, Joseph Qi,
Alexey Dobriyan, Kees Cook, Iurii Zaikin, Anton Vorontsov,
Colin Cross, Tony Luck, Alexei Starovoitov, Daniel Borkmann,
Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
John Fastabend, KP Singh, Hugh Dickins, Andrew Morton,
J. Bruce Fields, Chuck Lever, Trond Myklebust, Anna Schumaker,
David S. Miller, Jakub Kicinski, James Morris, Serge E. Hallyn,
John Johansen, linuxppc-dev, linux-kernel, linux-s390, dri-devel,
linux-rdma, oprofile-list, linux-scsi, linux-usb, linux-fsdevel,
autofs, linux-efi, linux-mm, ocfs2-devel, netdev, bpf,
linux-security-module
On Tue, Apr 14, 2020 at 02:42:56PM +0200, Emanuele Giuseppe Esposito wrote:
> We will augment this family of functions with inode management. To avoid
> littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
> with a Kconfig symbol to enable them.
If there are no functional changes, indicating that on the commit log
will make the review much easier.
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d1398cef3b18..fc38a6f0fc11 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
>
> config READABLE_ASM
> bool "Generate readable assembler code"
> - depends on DEBUG_KERNEL
> - help
> - Disable some compiler optimizations that tend to generate human unreadable
> - assembler output. This may make the kernel slightly slower, but it helps
> - to keep kernel developers who have to stare a lot at assembler listings
> - sane.
> + depends on DEBUG_KERNEL
> + help
> + Disable some compiler optimizations that tend to generate human unreadable
> + assembler output. This may make the kernel slightly slower, but it helps
> + to keep kernel developers who have to stare a lot at assembler listings
> + sane.
> +
This minor change above should just be a separate patch. Its just noise
otherwise.
> +config DEBUG_FS
> + bool "Debug Filesystem"
> + select SIMPLEFS
I'm at a loss reviewing this, my lib/Kconfig.debug already has a config
DEBUG_FS. But above I see it is being added for the very first time.
I'm sure there is some odd conditional which is obscuring this, can
this be explained in the commit log?
Luis
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-16 6:52 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:52 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
Greg Kroah-Hartman, Dennis Dalessandro, Miklos Szeredi,
linux-kernel, Anna Schumaker, linux-security-module, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, Joel Becker, Alexander Viro
On Tue, Apr 14, 2020 at 02:42:56PM +0200, Emanuele Giuseppe Esposito wrote:
> We will augment this family of functions with inode management. To avoid
> littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
> with a Kconfig symbol to enable them.
If there are no functional changes, indicating that on the commit log
will make the review much easier.
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d1398cef3b18..fc38a6f0fc11 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
>
> config READABLE_ASM
> bool "Generate readable assembler code"
> - depends on DEBUG_KERNEL
> - help
> - Disable some compiler optimizations that tend to generate human unreadable
> - assembler output. This may make the kernel slightly slower, but it helps
> - to keep kernel developers who have to stare a lot at assembler listings
> - sane.
> + depends on DEBUG_KERNEL
> + help
> + Disable some compiler optimizations that tend to generate human unreadable
> + assembler output. This may make the kernel slightly slower, but it helps
> + to keep kernel developers who have to stare a lot at assembler listings
> + sane.
> +
This minor change above should just be a separate patch. Its just noise
otherwise.
> +config DEBUG_FS
> + bool "Debug Filesystem"
> + select SIMPLEFS
I'm at a loss reviewing this, my lib/Kconfig.debug already has a config
DEBUG_FS. But above I see it is being added for the very first time.
I'm sure there is some odd conditional which is obscuring this, can
this be explained in the commit log?
Luis
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-16 6:52 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:52 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
netdev, Robert Richter, Thomas Zimmermann, Vasily Gorbik,
Tony Luck, Kees Cook, James E.J. Bottomley, autofs,
Mike Marciniszyn, linux-fsdevel, Manoj N. Kumar, Uma Krishnan,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, linux-nfs, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-kernel, Anna Schumaker,
linux-security-module, Chuck Lever, Jeremy Kerr, Colin Cross,
Frederic Barrat, Paolo Bonzini, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, Joel Becker, Alexander Viro
On Tue, Apr 14, 2020 at 02:42:56PM +0200, Emanuele Giuseppe Esposito wrote:
> We will augment this family of functions with inode management. To avoid
> littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
> with a Kconfig symbol to enable them.
If there are no functional changes, indicating that on the commit log
will make the review much easier.
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d1398cef3b18..fc38a6f0fc11 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
>
> config READABLE_ASM
> bool "Generate readable assembler code"
> - depends on DEBUG_KERNEL
> - help
> - Disable some compiler optimizations that tend to generate human unreadable
> - assembler output. This may make the kernel slightly slower, but it helps
> - to keep kernel developers who have to stare a lot at assembler listings
> - sane.
> + depends on DEBUG_KERNEL
> + help
> + Disable some compiler optimizations that tend to generate human unreadable
> + assembler output. This may make the kernel slightly slower, but it helps
> + to keep kernel developers who have to stare a lot at assembler listings
> + sane.
> +
This minor change above should just be a separate patch. Its just noise
otherwise.
> +config DEBUG_FS
> + bool "Debug Filesystem"
> + select SIMPLEFS
I'm at a loss reviewing this, my lib/Kconfig.debug already has a config
DEBUG_FS. But above I see it is being added for the very first time.
I'm sure there is some odd conditional which is obscuring this, can
this be explained in the commit log?
Luis
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-16 6:52 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:52 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov
On Tue, Apr 14, 2020 at 02:42:56PM +0200, Emanuele Giuseppe Esposito wrote:
> We will augment this family of functions with inode management. To avoid
> littering include/linux/fs.h and fs/libfs.c, move them to a separate header,
> with a Kconfig symbol to enable them.
If there are no functional changes, indicating that on the commit log
will make the review much easier.
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d1398cef3b18..fc38a6f0fc11 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -288,12 +288,16 @@ config STRIP_ASM_SYMS
>
> config READABLE_ASM
> bool "Generate readable assembler code"
> - depends on DEBUG_KERNEL
> - help
> - Disable some compiler optimizations that tend to generate human unreadable
> - assembler output. This may make the kernel slightly slower, but it helps
> - to keep kernel developers who have to stare a lot at assembler listings
> - sane.
> + depends on DEBUG_KERNEL
> + help
> + Disable some compiler optimizations that tend to generate human unreadable
> + assembler output. This may make the kernel slightly slower, but it helps
> + to keep kernel developers who have to stare a lot at assembler listings
> + sane.
> +
This minor change above should just be a separate patch. Its just noise
otherwise.
> +config DEBUG_FS
> + bool "Debug Filesystem"
> + select SIMPLEFS
I'm at a loss reviewing this, my lib/Kconfig.debug already has a config
DEBUG_FS. But above I see it is being added for the very first time.
I'm sure there is some odd conditional which is obscuring this, can
this be explained in the commit log?
Luis
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 0/8] Simplefs: group and simplify linux fs code
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-16 6:59 ` Luis Chamberlain
-1 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:59 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
netdev, Robert Richter, Thomas Zimmermann, Vasily Gorbik,
Tony Luck, Kees Cook, James E.J. Bottomley, autofs,
Mike Marciniszyn, linux-fsdevel, Manoj N. Kumar, Uma Krishnan,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, linux-nfs, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-kernel, Anna Schumaker,
linux-security-module, Chuck Lever, Jeremy Kerr, Colin Cross,
Frederic Barrat, Paolo Bonzini, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, Joel Becker, Alexander Viro
On Tue, Apr 14, 2020 at 02:42:54PM +0200, Emanuele Giuseppe Esposito wrote:
> This series of patches introduce wrappers for functions,
> arguments simplification in functions calls and most importantly
> groups duplicated code in a single header, simplefs, to avoid redundancy
> in the linux fs, especially debugfs and tracefs.
The general goal seems worthy, but here I don't see explained why hasn't
this gone through libfs, and what the intention was long term. For
instance, you added some other generalizations which you have found. It
was not clear that this was the goal here, to expand on these paths.
What if common code on fs is found which are not part of debugfs and
tracefs, how does one decide if to move to libfs or simplefs?
Luis
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-16 6:59 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:59 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Greg Kroah-Hartman, Robert Richter,
Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
Alexander Viro, Ian Kent, Joel Becker, Christoph Hellwig,
Rafael J. Wysocki, Matthew Garrett, Ard Biesheuvel,
Miklos Szeredi, Mike Kravetz, Mark Fasheh, Joseph Qi,
Alexey Dobriyan, Kees Cook, Iurii Zaikin, Anton Vorontsov,
Colin Cross, Tony Luck, Alexei Starovoitov, Daniel Borkmann,
Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
John Fastabend, KP Singh, Hugh Dickins, Andrew Morton,
Trond Myklebust, Anna Schumaker, J. Bruce Fields, Chuck Lever,
David S. Miller, Jakub Kicinski, James Morris, Serge E. Hallyn,
John Johansen, linuxppc-dev, linux-kernel, linux-s390, dri-devel,
linux-rdma, oprofile-list, linux-scsi, linux-usb, linux-fsdevel,
autofs, linux-efi, linux-mm, ocfs2-devel, netdev, bpf,
linux-security-module
On Tue, Apr 14, 2020 at 02:42:54PM +0200, Emanuele Giuseppe Esposito wrote:
> This series of patches introduce wrappers for functions,
> arguments simplification in functions calls and most importantly
> groups duplicated code in a single header, simplefs, to avoid redundancy
> in the linux fs, especially debugfs and tracefs.
The general goal seems worthy, but here I don't see explained why hasn't
this gone through libfs, and what the intention was long term. For
instance, you added some other generalizations which you have found. It
was not clear that this was the goal here, to expand on these paths.
What if common code on fs is found which are not part of debugfs and
tracefs, how does one decide if to move to libfs or simplefs?
Luis
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-16 6:59 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:59 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
Greg Kroah-Hartman, Dennis Dalessandro, Miklos Szeredi,
linux-kernel, Anna Schumaker, linux-security-module, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, Frederic Barrat,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, Joel Becker, Alexander Viro
On Tue, Apr 14, 2020 at 02:42:54PM +0200, Emanuele Giuseppe Esposito wrote:
> This series of patches introduce wrappers for functions,
> arguments simplification in functions calls and most importantly
> groups duplicated code in a single header, simplefs, to avoid redundancy
> in the linux fs, especially debugfs and tracefs.
The general goal seems worthy, but here I don't see explained why hasn't
this gone through libfs, and what the intention was long term. For
instance, you added some other generalizations which you have found. It
was not clear that this was the goal here, to expand on these paths.
What if common code on fs is found which are not part of debugfs and
tracefs, how does one decide if to move to libfs or simplefs?
Luis
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-16 6:59 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:59 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
netdev, Robert Richter, Thomas Zimmermann, Vasily Gorbik,
Tony Luck, Kees Cook, James E.J. Bottomley, autofs,
Mike Marciniszyn, linux-fsdevel, Manoj N. Kumar, Uma Krishnan,
Jakub Kicinski, KP Singh, Trond Myklebust, Matthew R. Ochs,
David S. Miller, Felipe Balbi, linux-nfs, Iurii Zaikin,
linux-scsi, Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-kernel, Anna Schumaker,
linux-security-module, Chuck Lever, Jeremy Kerr, Colin Cross,
Frederic Barrat, Paolo Bonzini, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, Joel Becker, Alexander Viro
On Tue, Apr 14, 2020 at 02:42:54PM +0200, Emanuele Giuseppe Esposito wrote:
> This series of patches introduce wrappers for functions,
> arguments simplification in functions calls and most importantly
> groups duplicated code in a single header, simplefs, to avoid redundancy
> in the linux fs, especially debugfs and tracefs.
The general goal seems worthy, but here I don't see explained why hasn't
this gone through libfs, and what the intention was long term. For
instance, you added some other generalizations which you have found. It
was not clear that this was the goal here, to expand on these paths.
What if common code on fs is found which are not part of debugfs and
tracefs, how does one decide if to move to libfs or simplefs?
Luis
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-16 6:59 ` Luis Chamberlain
0 siblings, 0 replies; 130+ messages in thread
From: Luis Chamberlain @ 2020-04-16 6:59 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov
On Tue, Apr 14, 2020 at 02:42:54PM +0200, Emanuele Giuseppe Esposito wrote:
> This series of patches introduce wrappers for functions,
> arguments simplification in functions calls and most importantly
> groups duplicated code in a single header, simplefs, to avoid redundancy
> in the linux fs, especially debugfs and tracefs.
The general goal seems worthy, but here I don't see explained why hasn't
this gone through libfs, and what the intention was long term. For
instance, you added some other generalizations which you have found. It
was not clear that this was the goal here, to expand on these paths.
What if common code on fs is found which are not part of debugfs and
tracefs, how does one decide if to move to libfs or simplefs?
Luis
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 6/8] simplefs: add file creation functions
2020-04-14 12:56 ` Greg Kroah-Hartman
` (2 preceding siblings ...)
(?)
@ 2020-04-20 13:57 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 13:57 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
>> A bunch of code is duplicated between debugfs and tracefs, unify it to the
>> simplefs library.
>>
>> The code is very similar, except that dentry and inode creation are unified
>> into a single function (unlike start_creating in debugfs and tracefs, which
>> only takes care of dentries). This adds an output parameter to the creation
>> functions, but pushes all error recovery into fs/simplefs.c.
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> ---
>> fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
>> include/linux/simplefs.h | 19 +++++
>> 2 files changed, 169 insertions(+)
>
> What's wrong with libfs, isn't that supposed to be for these types of
> "common" filesystem interactions?
>
> Why create a whole "new" fs for this?
I assume you meant a new file. These new functions are used only by a
few filesystems, and I didn't want to include them in vmlinux
unconditionally, so I introduced simplefs.c and CONFIG_SIMPLEFS instead
of extending libfs.c. In this way only fs that need this code like
debugfs and tracefs will load it.
Thank you,
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 13:57 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 13:57 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
>> A bunch of code is duplicated between debugfs and tracefs, unify it to the
>> simplefs library.
>>
>> The code is very similar, except that dentry and inode creation are unified
>> into a single function (unlike start_creating in debugfs and tracefs, which
>> only takes care of dentries). This adds an output parameter to the creation
>> functions, but pushes all error recovery into fs/simplefs.c.
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> ---
>> fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
>> include/linux/simplefs.h | 19 +++++
>> 2 files changed, 169 insertions(+)
>
> What's wrong with libfs, isn't that supposed to be for these types of
> "common" filesystem interactions?
>
> Why create a whole "new" fs for this?
I assume you meant a new file. These new functions are used only by a
few filesystems, and I didn't want to include them in vmlinux
unconditionally, so I introduced simplefs.c and CONFIG_SIMPLEFS instead
of extending libfs.c. In this way only fs that need this code like
debugfs and tracefs will load it.
Thank you,
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 13:57 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 13:57 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Daniel Vetter,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
>> A bunch of code is duplicated between debugfs and tracefs, unify it to the
>> simplefs library.
>>
>> The code is very similar, except that dentry and inode creation are unified
>> into a single function (unlike start_creating in debugfs and tracefs, which
>> only takes care of dentries). This adds an output parameter to the creation
>> functions, but pushes all error recovery into fs/simplefs.c.
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> ---
>> fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
>> include/linux/simplefs.h | 19 +++++
>> 2 files changed, 169 insertions(+)
>
> What's wrong with libfs, isn't that supposed to be for these types of
> "common" filesystem interactions?
>
> Why create a whole "new" fs for this?
I assume you meant a new file. These new functions are used only by a
few filesystems, and I didn't want to include them in vmlinux
unconditionally, so I introduced simplefs.c and CONFIG_SIMPLEFS instead
of extending libfs.c. In this way only fs that need this code like
debugfs and tracefs will load it.
Thank you,
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 13:57 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 13:57 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
>> A bunch of code is duplicated between debugfs and tracefs, unify it to the
>> simplefs library.
>>
>> The code is very similar, except that dentry and inode creation are unified
>> into a single function (unlike start_creating in debugfs and tracefs, which
>> only takes care of dentries). This adds an output parameter to the creation
>> functions, but pushes all error recovery into fs/simplefs.c.
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> ---
>> fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
>> include/linux/simplefs.h | 19 +++++
>> 2 files changed, 169 insertions(+)
>
> What's wrong with libfs, isn't that supposed to be for these types of
> "common" filesystem interactions?
>
> Why create a whole "new" fs for this?
I assume you meant a new file. These new functions are used only by a
few filesystems, and I didn't want to include them in vmlinux
unconditionally, so I introduced simplefs.c and CONFIG_SIMPLEFS instead
of extending libfs.c. In this way only fs that need this code like
debugfs and tracefs will load it.
Thank you,
Emanuele
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 13:57 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 13:57 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Benjamin Herrenschmidt, Heiko Carstens, Alexei Starovoitov,
dri-devel, J. Bruce Fields, Joseph Qi, Hugh Dickins,
Paul Mackerras, John Johansen, netdev, ocfs2-devel,
Christoph Hellwig, Andrew Donnellan, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman
On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
>> A bunch of code is duplicated between debugfs and tracefs, unify it to the
>> simplefs library.
>>
>> The code is very similar, except that dentry and inode creation are unified
>> into a single function (unlike start_creating in debugfs and tracefs, which
>> only takes care of dentries). This adds an output parameter to the creation
>> functions, but pushes all error recovery into fs/simplefs.c.
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> ---
>> fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
>> include/linux/simplefs.h | 19 +++++
>> 2 files changed, 169 insertions(+)
>
> What's wrong with libfs, isn't that supposed to be for these types of
> "common" filesystem interactions?
>
> Why create a whole "new" fs for this?
I assume you meant a new file. These new functions are used only by a
few filesystems, and I didn't want to include them in vmlinux
unconditionally, so I introduced simplefs.c and CONFIG_SIMPLEFS instead
of extending libfs.c. In this way only fs that need this code like
debugfs and tracefs will load it.
Thank you,
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 4/8] fs: introduce simple_new_inode
2020-04-14 13:01 ` Greg Kroah-Hartman
` (2 preceding siblings ...)
(?)
@ 2020-04-20 13:58 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 13:58 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On 4/14/20 3:01 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote:
>> It is a common special case for new_inode to initialize the
>> time to the current time and the inode to get_next_ino().
>> Introduce a core function that does it and use it throughout
>> Linux.
>
> Shouldn't this just be called new_inode_current_time()?
>
> How is anyone going to remember what simple_new_inode() does to the
> inode structure?
I noticed that most functions in libfs.c are called "simple_*" when they
do the right thing for the majority of simple use cases (e.g.,
simple_symlink_inode_operations or simple_dir_operations). I can
certainly rename the function.
Thank you for all the feedback, I will incorporate it and send a new
patch series soon.
Emanuele
>
>> --- a/fs/libfs.c
>> +++ b/fs/libfs.c
>> @@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
>> }
>> EXPORT_SYMBOL(simple_write_end);
>>
>> +struct inode *simple_new_inode(struct super_block *sb)
>> +{
>> + struct inode *inode = new_inode(sb);
>> + if (inode) {
>> + inode->i_ino = get_next_ino();
>> + inode->i_atime = inode->i_mtime =
>> + inode->i_ctime = current_time(inode);
>> + }
>> + return inode;
>> +}
>> +EXPORT_SYMBOL(simple_new_inode);
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-20 13:58 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 13:58 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
On 4/14/20 3:01 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote:
>> It is a common special case for new_inode to initialize the
>> time to the current time and the inode to get_next_ino().
>> Introduce a core function that does it and use it throughout
>> Linux.
>
> Shouldn't this just be called new_inode_current_time()?
>
> How is anyone going to remember what simple_new_inode() does to the
> inode structure?
I noticed that most functions in libfs.c are called "simple_*" when they
do the right thing for the majority of simple use cases (e.g.,
simple_symlink_inode_operations or simple_dir_operations). I can
certainly rename the function.
Thank you for all the feedback, I will incorporate it and send a new
patch series soon.
Emanuele
>
>> --- a/fs/libfs.c
>> +++ b/fs/libfs.c
>> @@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
>> }
>> EXPORT_SYMBOL(simple_write_end);
>>
>> +struct inode *simple_new_inode(struct super_block *sb)
>> +{
>> + struct inode *inode = new_inode(sb);
>> + if (inode) {
>> + inode->i_ino = get_next_ino();
>> + inode->i_atime = inode->i_mtime =
>> + inode->i_ctime = current_time(inode);
>> + }
>> + return inode;
>> +}
>> +EXPORT_SYMBOL(simple_new_inode);
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-20 13:58 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 13:58 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Daniel Vetter,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On 4/14/20 3:01 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote:
>> It is a common special case for new_inode to initialize the
>> time to the current time and the inode to get_next_ino().
>> Introduce a core function that does it and use it throughout
>> Linux.
>
> Shouldn't this just be called new_inode_current_time()?
>
> How is anyone going to remember what simple_new_inode() does to the
> inode structure?
I noticed that most functions in libfs.c are called "simple_*" when they
do the right thing for the majority of simple use cases (e.g.,
simple_symlink_inode_operations or simple_dir_operations). I can
certainly rename the function.
Thank you for all the feedback, I will incorporate it and send a new
patch series soon.
Emanuele
>
>> --- a/fs/libfs.c
>> +++ b/fs/libfs.c
>> @@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
>> }
>> EXPORT_SYMBOL(simple_write_end);
>>
>> +struct inode *simple_new_inode(struct super_block *sb)
>> +{
>> + struct inode *inode = new_inode(sb);
>> + if (inode) {
>> + inode->i_ino = get_next_ino();
>> + inode->i_atime = inode->i_mtime =
>> + inode->i_ctime = current_time(inode);
>> + }
>> + return inode;
>> +}
>> +EXPORT_SYMBOL(simple_new_inode);
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-20 13:58 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 13:58 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On 4/14/20 3:01 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote:
>> It is a common special case for new_inode to initialize the
>> time to the current time and the inode to get_next_ino().
>> Introduce a core function that does it and use it throughout
>> Linux.
>
> Shouldn't this just be called new_inode_current_time()?
>
> How is anyone going to remember what simple_new_inode() does to the
> inode structure?
I noticed that most functions in libfs.c are called "simple_*" when they
do the right thing for the majority of simple use cases (e.g.,
simple_symlink_inode_operations or simple_dir_operations). I can
certainly rename the function.
Thank you for all the feedback, I will incorporate it and send a new
patch series soon.
Emanuele
>
>> --- a/fs/libfs.c
>> +++ b/fs/libfs.c
>> @@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
>> }
>> EXPORT_SYMBOL(simple_write_end);
>>
>> +struct inode *simple_new_inode(struct super_block *sb)
>> +{
>> + struct inode *inode = new_inode(sb);
>> + if (inode) {
>> + inode->i_ino = get_next_ino();
>> + inode->i_atime = inode->i_mtime =
>> + inode->i_ctime = current_time(inode);
>> + }
>> + return inode;
>> +}
>> +EXPORT_SYMBOL(simple_new_inode);
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 4/8] fs: introduce simple_new_inode
@ 2020-04-20 13:58 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 13:58 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Benjamin Herrenschmidt, Heiko Carstens, Alexei Starovoitov,
dri-devel, J. Bruce Fields, Joseph Qi, Hugh Dickins,
Paul Mackerras, John Johansen, netdev, ocfs2-devel,
Christoph Hellwig, Andrew Donnellan, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman
On 4/14/20 3:01 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote:
>> It is a common special case for new_inode to initialize the
>> time to the current time and the inode to get_next_ino().
>> Introduce a core function that does it and use it throughout
>> Linux.
>
> Shouldn't this just be called new_inode_current_time()?
>
> How is anyone going to remember what simple_new_inode() does to the
> inode structure?
I noticed that most functions in libfs.c are called "simple_*" when they
do the right thing for the majority of simple use cases (e.g.,
simple_symlink_inode_operations or simple_dir_operations). I can
certainly rename the function.
Thank you for all the feedback, I will incorporate it and send a new
patch series soon.
Emanuele
>
>> --- a/fs/libfs.c
>> +++ b/fs/libfs.c
>> @@ -595,6 +595,18 @@ int simple_write_end(struct file *file, struct address_space *mapping,
>> }
>> EXPORT_SYMBOL(simple_write_end);
>>
>> +struct inode *simple_new_inode(struct super_block *sb)
>> +{
>> + struct inode *inode = new_inode(sb);
>> + if (inode) {
>> + inode->i_ino = get_next_ino();
>> + inode->i_atime = inode->i_mtime =
>> + inode->i_ctime = current_time(inode);
>> + }
>> + return inode;
>> +}
>> +EXPORT_SYMBOL(simple_new_inode);
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
2020-04-16 6:44 ` Luis Chamberlain
(?)
(?)
@ 2020-04-20 14:00 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 14:00 UTC (permalink / raw)
To: Luis Chamberlain, Goldwyn Rodrigues
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Greg Kroah-Hartman, Robert Richter,
Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
Alexander Viro, Ian Kent, Joel Becker, Christoph Hellwig,
Rafael J. Wysocki, Matthew Garrett, Ard Biesheuvel,
Miklos Szeredi, Mike Kravetz, Mark Fasheh, Joseph Qi,
Alexey Dobriyan, Kees Cook, Iurii Zaikin, Anton Vorontsov,
Colin Cross, Tony Luck, Alexei Starovoitov, Daniel Borkmann,
Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
John Fastabend, KP Singh, Hugh Dickins, Andrew Morton,
J. Bruce Fields, Chuck Lever, Trond Myklebust, Anna Schumaker,
David S. Miller, Jakub Kicinski, James Morris, Serge E. Hallyn,
John Johansen, linuxppc-dev, linux-kernel, linux-s390, dri-devel,
linux-rdma, linux-scsi, linux-usb, linux-fsdevel, autofs,
linux-efi, linux-mm, netdev, bpf, linux-security-module
On 4/16/20 8:44 AM, Luis Chamberlain wrote:
> On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote:
>> aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
>> variables as arguments, for what would amount to a simple
>> vfs_kern_mount/mntput pair if everything was inlined. Just use
>> the normal filesystem API since the reference counting is not needed
>> here.
>
> *Why* is refcounting not needed here?
The refcount is a local variable and is always 0 on entry and exit, so
it is not necessary to have refcounting across function invocations,
such as what simple_pin_fs and simple_release_fs provide.
Thank you,
Emanuele
>
> Luis
>
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> ---
>> security/apparmor/apparmorfs.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
>> index 280741fc0f5f..828bb1eb77ea 100644
>> --- a/security/apparmor/apparmorfs.c
>> +++ b/security/apparmor/apparmorfs.c
>> @@ -2525,14 +2525,14 @@ struct path aa_null;
>>
>> static int aa_mk_null_file(struct dentry *parent)
>> {
>> - struct vfsmount *mount = NULL;
>> + struct file_system_type *type = parent->d_sb->s_type;
>> + struct vfsmount *mount;
>> struct dentry *dentry;
>> struct inode *inode;
>> - int count = 0;
>> - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
>>
>> - if (error)
>> - return error;
>> + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
>> + if (IS_ERR(mount))
>> + return PTR_ERR(mount);
>>
>> inode_lock(d_inode(parent));
>> dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
>> @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
>> dput(dentry);
>> out:
>> inode_unlock(d_inode(parent));
>> - simple_release_fs(&mount, &count);
>> + mntput(mount);
>> return error;
>> }
>>
>> --
>> 2.25.2
>>
>
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-20 14:00 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 14:00 UTC (permalink / raw)
To: Luis Chamberlain, Goldwyn Rodrigues
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
Yonghong Song, Ian Kent, Andrii Nakryiko, Alexey Dobriyan,
Serge E. Hallyn, Robert Richter, Thomas Zimmermann,
Vasily Gorbik, Tony Luck, Kees Cook, James E.J. Bottomley,
autofs, Maarten Lankhorst, Mike Marciniszyn, Maxime Ripard,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-kernel, Anna Schumaker,
linux-security-module, Chuck Lever, Jeremy Kerr, Daniel Vetter,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On 4/16/20 8:44 AM, Luis Chamberlain wrote:
> On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote:
>> aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
>> variables as arguments, for what would amount to a simple
>> vfs_kern_mount/mntput pair if everything was inlined. Just use
>> the normal filesystem API since the reference counting is not needed
>> here.
>
> *Why* is refcounting not needed here?
The refcount is a local variable and is always 0 on entry and exit, so
it is not necessary to have refcounting across function invocations,
such as what simple_pin_fs and simple_release_fs provide.
Thank you,
Emanuele
>
> Luis
>
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> ---
>> security/apparmor/apparmorfs.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
>> index 280741fc0f5f..828bb1eb77ea 100644
>> --- a/security/apparmor/apparmorfs.c
>> +++ b/security/apparmor/apparmorfs.c
>> @@ -2525,14 +2525,14 @@ struct path aa_null;
>>
>> static int aa_mk_null_file(struct dentry *parent)
>> {
>> - struct vfsmount *mount = NULL;
>> + struct file_system_type *type = parent->d_sb->s_type;
>> + struct vfsmount *mount;
>> struct dentry *dentry;
>> struct inode *inode;
>> - int count = 0;
>> - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
>>
>> - if (error)
>> - return error;
>> + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
>> + if (IS_ERR(mount))
>> + return PTR_ERR(mount);
>>
>> inode_lock(d_inode(parent));
>> dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
>> @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
>> dput(dentry);
>> out:
>> inode_unlock(d_inode(parent));
>> - simple_release_fs(&mount, &count);
>> + mntput(mount);
>> return error;
>> }
>>
>> --
>> 2.25.2
>>
>
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-20 14:00 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 14:00 UTC (permalink / raw)
To: Luis Chamberlain, Goldwyn Rodrigues
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, netdev, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Mike Marciniszyn, linux-fsdevel,
Manoj N. Kumar, Uma Krishnan, Jakub Kicinski, KP Singh,
Trond Myklebust, Matthew R. Ochs, David S. Miller, Felipe Balbi,
linux-nfs, Iurii Zaikin, linux-scsi, Martin K. Petersen,
linux-mm, Greg Kroah-Hartman, Dennis Dalessandro, Miklos Szeredi,
linux-kernel, Anna Schumaker, linux-security-module, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
Joel Becker, Alexander Viro
On 4/16/20 8:44 AM, Luis Chamberlain wrote:
> On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote:
>> aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
>> variables as arguments, for what would amount to a simple
>> vfs_kern_mount/mntput pair if everything was inlined. Just use
>> the normal filesystem API since the reference counting is not needed
>> here.
>
> *Why* is refcounting not needed here?
The refcount is a local variable and is always 0 on entry and exit, so
it is not necessary to have refcounting across function invocations,
such as what simple_pin_fs and simple_release_fs provide.
Thank you,
Emanuele
>
> Luis
>
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> ---
>> security/apparmor/apparmorfs.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
>> index 280741fc0f5f..828bb1eb77ea 100644
>> --- a/security/apparmor/apparmorfs.c
>> +++ b/security/apparmor/apparmorfs.c
>> @@ -2525,14 +2525,14 @@ struct path aa_null;
>>
>> static int aa_mk_null_file(struct dentry *parent)
>> {
>> - struct vfsmount *mount = NULL;
>> + struct file_system_type *type = parent->d_sb->s_type;
>> + struct vfsmount *mount;
>> struct dentry *dentry;
>> struct inode *inode;
>> - int count = 0;
>> - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
>>
>> - if (error)
>> - return error;
>> + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
>> + if (IS_ERR(mount))
>> + return PTR_ERR(mount);
>>
>> inode_lock(d_inode(parent));
>> dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
>> @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
>> dput(dentry);
>> out:
>> inode_unlock(d_inode(parent));
>> - simple_release_fs(&mount, &count);
>> + mntput(mount);
>> return error;
>> }
>>
>> --
>> 2.25.2
>>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
@ 2020-04-20 14:00 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 14:00 UTC (permalink / raw)
To: Luis Chamberlain, Goldwyn Rodrigues
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John
On 4/16/20 8:44 AM, Luis Chamberlain wrote:
> On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote:
>> aa_mk_null_file is using simple_pin_fs/simple_release_fs with local
>> variables as arguments, for what would amount to a simple
>> vfs_kern_mount/mntput pair if everything was inlined. Just use
>> the normal filesystem API since the reference counting is not needed
>> here.
>
> *Why* is refcounting not needed here?
The refcount is a local variable and is always 0 on entry and exit, so
it is not necessary to have refcounting across function invocations,
such as what simple_pin_fs and simple_release_fs provide.
Thank you,
Emanuele
>
> Luis
>
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> ---
>> security/apparmor/apparmorfs.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
>> index 280741fc0f5f..828bb1eb77ea 100644
>> --- a/security/apparmor/apparmorfs.c
>> +++ b/security/apparmor/apparmorfs.c
>> @@ -2525,14 +2525,14 @@ struct path aa_null;
>>
>> static int aa_mk_null_file(struct dentry *parent)
>> {
>> - struct vfsmount *mount = NULL;
>> + struct file_system_type *type = parent->d_sb->s_type;
>> + struct vfsmount *mount;
>> struct dentry *dentry;
>> struct inode *inode;
>> - int count = 0;
>> - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count);
>>
>> - if (error)
>> - return error;
>> + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL);
>> + if (IS_ERR(mount))
>> + return PTR_ERR(mount);
>>
>> inode_lock(d_inode(parent));
>> dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME));
>> @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent)
>> dput(dentry);
>> out:
>> inode_unlock(d_inode(parent));
>> - simple_release_fs(&mount, &count);
>> + mntput(mount);
>> return error;
>> }
>>
>> --
>> 2.25.2
>>
>
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 0/8] Simplefs: group and simplify linux fs code
2020-04-16 6:59 ` Luis Chamberlain
(?)
(?)
@ 2020-04-20 14:01 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 14:01 UTC (permalink / raw)
To: Luis Chamberlain
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Greg Kroah-Hartman, Robert Richter,
Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
Alexander Viro, Ian Kent, Joel Becker, Christoph Hellwig,
Rafael J. Wysocki, Matthew Garrett, Ard Biesheuvel,
Miklos Szeredi, Mike Kravetz, Mark Fasheh, Joseph Qi,
Alexey Dobriyan, Kees Cook, Iurii Zaikin, Anton Vorontsov,
Colin Cross, Tony Luck, Alexei Starovoitov, Daniel Borkmann,
Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
John Fastabend, KP Singh, Hugh Dickins, Andrew Morton,
Trond Myklebust, Anna Schumaker, J. Bruce Fields, Chuck Lever,
David S. Miller, Jakub Kicinski, James Morris, Serge E. Hallyn,
John Johansen, linuxppc-dev, linux-kernel, linux-s390, dri-devel,
linux-rdma, linux-scsi, linux-usb, linux-fsdevel, autofs,
linux-efi, linux-mm, netdev, bpf, linux-security-module
On 4/16/20 8:59 AM, Luis Chamberlain wrote:
> On Tue, Apr 14, 2020 at 02:42:54PM +0200, Emanuele Giuseppe Esposito wrote:
>> This series of patches introduce wrappers for functions,
>> arguments simplification in functions calls and most importantly
>> groups duplicated code in a single header, simplefs, to avoid redundancy
>> in the linux fs, especially debugfs and tracefs.
>
> The general goal seems worthy, but here I don't see explained why hasn't
> this gone through libfs, and what the intention was long term. For
> instance, you added some other generalizations which you have found. It
> was not clear that this was the goal here, to expand on these paths.
>
> What if common code on fs is found which are not part of debugfs and
> tracefs, how does one decide if to move to libfs or simplefs?
The idea of simplefs (that I will also explain better in the cover
letter and commit messages) is that not only it groups common code, but
also introduces a new struct simple_fs that simplifies parameter
passing. This means all fs that use these functions and the struct
should include linux/simplefs.h, while all common functions that take a
simple_fs struct will be added in simplefs.c
Thank you for all the feedback, I will incorporate it and send a new
patch series soon.
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-20 14:01 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 14:01 UTC (permalink / raw)
To: Luis Chamberlain
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
Yonghong Song, Ian Kent, Andrii Nakryiko, Alexey Dobriyan,
Serge E. Hallyn, Robert Richter, Thomas Zimmermann,
Vasily Gorbik, Tony Luck, Kees Cook, James E.J. Bottomley,
autofs, Maarten Lankhorst, Mike Marciniszyn, Maxime Ripard,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-kernel, Anna Schumaker,
linux-security-module, Chuck Lever, Jeremy Kerr, Daniel Vetter,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On 4/16/20 8:59 AM, Luis Chamberlain wrote:
> On Tue, Apr 14, 2020 at 02:42:54PM +0200, Emanuele Giuseppe Esposito wrote:
>> This series of patches introduce wrappers for functions,
>> arguments simplification in functions calls and most importantly
>> groups duplicated code in a single header, simplefs, to avoid redundancy
>> in the linux fs, especially debugfs and tracefs.
>
> The general goal seems worthy, but here I don't see explained why hasn't
> this gone through libfs, and what the intention was long term. For
> instance, you added some other generalizations which you have found. It
> was not clear that this was the goal here, to expand on these paths.
>
> What if common code on fs is found which are not part of debugfs and
> tracefs, how does one decide if to move to libfs or simplefs?
The idea of simplefs (that I will also explain better in the cover
letter and commit messages) is that not only it groups common code, but
also introduces a new struct simple_fs that simplifies parameter
passing. This means all fs that use these functions and the struct
should include linux/simplefs.h, while all common functions that take a
simple_fs struct will be added in simplefs.c
Thank you for all the feedback, I will incorporate it and send a new
patch series soon.
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-20 14:01 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 14:01 UTC (permalink / raw)
To: Luis Chamberlain
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, netdev, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Mike Marciniszyn, linux-fsdevel,
Manoj N. Kumar, Uma Krishnan, Jakub Kicinski, KP Singh,
Trond Myklebust, Matthew R. Ochs, David S. Miller, Felipe Balbi,
linux-nfs, Iurii Zaikin, linux-scsi, Martin K. Petersen,
linux-mm, Greg Kroah-Hartman, Dennis Dalessandro, Miklos Szeredi,
linux-kernel, Anna Schumaker, linux-security-module, Chuck Lever,
Jeremy Kerr, Colin Cross, Frederic Barrat, Paolo Bonzini,
Andrew Morton, Mike Kravetz, linuxppc-dev, Martin KaFai Lau,
Joel Becker, Alexander Viro
On 4/16/20 8:59 AM, Luis Chamberlain wrote:
> On Tue, Apr 14, 2020 at 02:42:54PM +0200, Emanuele Giuseppe Esposito wrote:
>> This series of patches introduce wrappers for functions,
>> arguments simplification in functions calls and most importantly
>> groups duplicated code in a single header, simplefs, to avoid redundancy
>> in the linux fs, especially debugfs and tracefs.
>
> The general goal seems worthy, but here I don't see explained why hasn't
> this gone through libfs, and what the intention was long term. For
> instance, you added some other generalizations which you have found. It
> was not clear that this was the goal here, to expand on these paths.
>
> What if common code on fs is found which are not part of debugfs and
> tracefs, how does one decide if to move to libfs or simplefs?
The idea of simplefs (that I will also explain better in the cover
letter and commit messages) is that not only it groups common code, but
also introduces a new struct simple_fs that simplifies parameter
passing. This means all fs that use these functions and the struct
should include linux/simplefs.h, while all common functions that take a
simple_fs struct will be added in simplefs.c
Thank you for all the feedback, I will incorporate it and send a new
patch series soon.
Emanuele
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 0/8] Simplefs: group and simplify linux fs code
@ 2020-04-20 14:01 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-20 14:01 UTC (permalink / raw)
To: Luis Chamberlain
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John
On 4/16/20 8:59 AM, Luis Chamberlain wrote:
> On Tue, Apr 14, 2020 at 02:42:54PM +0200, Emanuele Giuseppe Esposito wrote:
>> This series of patches introduce wrappers for functions,
>> arguments simplification in functions calls and most importantly
>> groups duplicated code in a single header, simplefs, to avoid redundancy
>> in the linux fs, especially debugfs and tracefs.
>
> The general goal seems worthy, but here I don't see explained why hasn't
> this gone through libfs, and what the intention was long term. For
> instance, you added some other generalizations which you have found. It
> was not clear that this was the goal here, to expand on these paths.
>
> What if common code on fs is found which are not part of debugfs and
> tracefs, how does one decide if to move to libfs or simplefs?
The idea of simplefs (that I will also explain better in the cover
letter and commit messages) is that not only it groups common code, but
also introduces a new struct simple_fs that simplifies parameter
passing. This means all fs that use these functions and the struct
should include linux/simplefs.h, while all common functions that take a
simple_fs struct will be added in simplefs.c
Thank you for all the feedback, I will incorporate it and send a new
patch series soon.
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 6/8] simplefs: add file creation functions
2020-04-20 13:57 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-20 14:28 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-20 14:28 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Mon, Apr 20, 2020 at 03:57:48PM +0200, Emanuele Giuseppe Esposito wrote:
>
>
> On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote:
> > On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
> > > A bunch of code is duplicated between debugfs and tracefs, unify it to the
> > > simplefs library.
> > >
> > > The code is very similar, except that dentry and inode creation are unified
> > > into a single function (unlike start_creating in debugfs and tracefs, which
> > > only takes care of dentries). This adds an output parameter to the creation
> > > functions, but pushes all error recovery into fs/simplefs.c.
> > >
> > > Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> > > ---
> > > fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
> > > include/linux/simplefs.h | 19 +++++
> > > 2 files changed, 169 insertions(+)
> >
> > What's wrong with libfs, isn't that supposed to be for these types of
> > "common" filesystem interactions?
> >
> > Why create a whole "new" fs for this?
>
> I assume you meant a new file. These new functions are used only by a few
> filesystems, and I didn't want to include them in vmlinux unconditionally,
> so I introduced simplefs.c and CONFIG_SIMPLEFS instead of extending libfs.c.
> In this way only fs that need this code like debugfs and tracefs will load
> it.
Nothing "loads it", why not just make these libfs functions instead? As
the difference between the two is not obvious at all, please don't make
things confusing.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 14:28 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-20 14:28 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: linux-nfs, Paolo Bonzini, Jeremy Kerr, Arnd Bergmann,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Dennis Dalessandro,
Mike Marciniszyn, Doug Ledford, Jason Gunthorpe, Frederic Barrat,
Andrew Donnellan, Robert Richter, Manoj N. Kumar,
Matthew R. Ochs, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, Alexander Viro, Ian Kent,
Joel Becker, Christoph Hellwig, Rafael J. Wysocki,
Matthew Garrett, Ard Biesheuvel, Miklos Szeredi, Mike Kravetz,
Mark Fasheh, Joseph Qi, Alexey Dobriyan, Luis Chamberlain,
Kees Cook, Iurii Zaikin, Anton Vorontsov, Colin Cross, Tony Luck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Hugh Dickins, Andrew Morton, J. Bruce Fields, Chuck Lever,
Trond Myklebust, Anna Schumaker, David S. Miller, Jakub Kicinski,
James Morris, Serge E. Hallyn, John Johansen, linuxppc-dev,
linux-kernel, linux-s390, dri-devel, linux-rdma, oprofile-list,
linux-scsi, linux-usb, linux-fsdevel, autofs, linux-efi,
linux-mm, ocfs2-devel, netdev, bpf, linux-security-module
On Mon, Apr 20, 2020 at 03:57:48PM +0200, Emanuele Giuseppe Esposito wrote:
>
>
> On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote:
> > On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
> > > A bunch of code is duplicated between debugfs and tracefs, unify it to the
> > > simplefs library.
> > >
> > > The code is very similar, except that dentry and inode creation are unified
> > > into a single function (unlike start_creating in debugfs and tracefs, which
> > > only takes care of dentries). This adds an output parameter to the creation
> > > functions, but pushes all error recovery into fs/simplefs.c.
> > >
> > > Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> > > ---
> > > fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
> > > include/linux/simplefs.h | 19 +++++
> > > 2 files changed, 169 insertions(+)
> >
> > What's wrong with libfs, isn't that supposed to be for these types of
> > "common" filesystem interactions?
> >
> > Why create a whole "new" fs for this?
>
> I assume you meant a new file. These new functions are used only by a few
> filesystems, and I didn't want to include them in vmlinux unconditionally,
> so I introduced simplefs.c and CONFIG_SIMPLEFS instead of extending libfs.c.
> In this way only fs that need this code like debugfs and tracefs will load
> it.
Nothing "loads it", why not just make these libfs functions instead? As
the difference between the two is not obvious at all, please don't make
things confusing.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 14:28 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-20 14:28 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Daniel Vetter,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Mon, Apr 20, 2020 at 03:57:48PM +0200, Emanuele Giuseppe Esposito wrote:
>
>
> On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote:
> > On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
> > > A bunch of code is duplicated between debugfs and tracefs, unify it to the
> > > simplefs library.
> > >
> > > The code is very similar, except that dentry and inode creation are unified
> > > into a single function (unlike start_creating in debugfs and tracefs, which
> > > only takes care of dentries). This adds an output parameter to the creation
> > > functions, but pushes all error recovery into fs/simplefs.c.
> > >
> > > Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> > > ---
> > > fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
> > > include/linux/simplefs.h | 19 +++++
> > > 2 files changed, 169 insertions(+)
> >
> > What's wrong with libfs, isn't that supposed to be for these types of
> > "common" filesystem interactions?
> >
> > Why create a whole "new" fs for this?
>
> I assume you meant a new file. These new functions are used only by a few
> filesystems, and I didn't want to include them in vmlinux unconditionally,
> so I introduced simplefs.c and CONFIG_SIMPLEFS instead of extending libfs.c.
> In this way only fs that need this code like debugfs and tracefs will load
> it.
Nothing "loads it", why not just make these libfs functions instead? As
the difference between the two is not obvious at all, please don't make
things confusing.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 14:28 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-20 14:28 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Mike Marciniszyn,
linux-fsdevel, Manoj N. Kumar, Uma Krishnan, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, linux-nfs, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, linux-s390, Dennis Dalessandro,
Miklos Szeredi, linux-security-module, linux-kernel,
Anna Schumaker, Luis Chamberlain, Chuck Lever, Jeremy Kerr,
Colin Cross, Frederic Barrat, Paolo Bonzini, Andrew Morton,
Mike Kravetz, linuxppc-dev, Martin KaFai Lau, Joel Becker,
Alexander Viro
On Mon, Apr 20, 2020 at 03:57:48PM +0200, Emanuele Giuseppe Esposito wrote:
>
>
> On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote:
> > On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
> > > A bunch of code is duplicated between debugfs and tracefs, unify it to the
> > > simplefs library.
> > >
> > > The code is very similar, except that dentry and inode creation are unified
> > > into a single function (unlike start_creating in debugfs and tracefs, which
> > > only takes care of dentries). This adds an output parameter to the creation
> > > functions, but pushes all error recovery into fs/simplefs.c.
> > >
> > > Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> > > ---
> > > fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
> > > include/linux/simplefs.h | 19 +++++
> > > 2 files changed, 169 insertions(+)
> >
> > What's wrong with libfs, isn't that supposed to be for these types of
> > "common" filesystem interactions?
> >
> > Why create a whole "new" fs for this?
>
> I assume you meant a new file. These new functions are used only by a few
> filesystems, and I didn't want to include them in vmlinux unconditionally,
> so I introduced simplefs.c and CONFIG_SIMPLEFS instead of extending libfs.c.
> In this way only fs that need this code like debugfs and tracefs will load
> it.
Nothing "loads it", why not just make these libfs functions instead? As
the difference between the two is not obvious at all, please don't make
things confusing.
thanks,
greg k-h
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 14:28 ` Greg Kroah-Hartman
0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-20 14:28 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Benjamin Herrenschmidt, Heiko Carstens, Alexei Starovoitov,
dri-devel, J. Bruce Fields, Joseph Qi, Hugh Dickins,
Paul Mackerras, John Johansen, netdev, ocfs2-devel,
Christoph Hellwig, Andrew Donnellan, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman
On Mon, Apr 20, 2020 at 03:57:48PM +0200, Emanuele Giuseppe Esposito wrote:
>
>
> On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote:
> > On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote:
> > > A bunch of code is duplicated between debugfs and tracefs, unify it to the
> > > simplefs library.
> > >
> > > The code is very similar, except that dentry and inode creation are unified
> > > into a single function (unlike start_creating in debugfs and tracefs, which
> > > only takes care of dentries). This adds an output parameter to the creation
> > > functions, but pushes all error recovery into fs/simplefs.c.
> > >
> > > Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> > > ---
> > > fs/simplefs.c | 150 +++++++++++++++++++++++++++++++++++++++
> > > include/linux/simplefs.h | 19 +++++
> > > 2 files changed, 169 insertions(+)
> >
> > What's wrong with libfs, isn't that supposed to be for these types of
> > "common" filesystem interactions?
> >
> > Why create a whole "new" fs for this?
>
> I assume you meant a new file. These new functions are used only by a few
> filesystems, and I didn't want to include them in vmlinux unconditionally,
> so I introduced simplefs.c and CONFIG_SIMPLEFS instead of extending libfs.c.
> In this way only fs that need this code like debugfs and tracefs will load
> it.
Nothing "loads it", why not just make these libfs functions instead? As
the difference between the two is not obvious at all, please don't make
things confusing.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 6/8] simplefs: add file creation functions
2020-04-20 14:28 ` Greg Kroah-Hartman
` (2 preceding siblings ...)
(?)
@ 2020-04-20 14:33 ` Paolo Bonzini
-1 siblings, 0 replies; 130+ messages in thread
From: Paolo Bonzini @ 2020-04-20 14:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Mike Marciniszyn, linux-fsdevel,
Manoj N. Kumar, Uma Krishnan, Jakub Kicinski, KP Singh,
Trond Myklebust, Matthew R. Ochs, David S. Miller, Felipe Balbi,
linux-nfs, Iurii Zaikin, linux-scsi, Martin K. Petersen,
linux-mm, linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Thomas Zimmermann,
Colin Cross, Frederic Barrat, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, Joel Becker, Alexander Viro
On 20/04/20 16:28, Greg Kroah-Hartman wrote:
>> I assume you meant a new file. These new functions are used only by a few
>> filesystems, and I didn't want to include them in vmlinux unconditionally,
>> so I introduced simplefs.c and CONFIG_SIMPLEFS instead of extending libfs.c.
>> In this way only fs that need this code like debugfs and tracefs will load
>> it.
> Nothing "loads it", why not just make these libfs functions instead? As
> the difference between the two is not obvious at all, please don't make
> things confusing.
I think Emanuele meant "will link it" not "will load it".
Emanuele, you can just move everything to libfs.c and get rid of
CONFIG_SIMPLEFS too. "Do less" is not an offer you want to turn down!
Thanks,
Paolo
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 14:33 ` Paolo Bonzini
0 siblings, 0 replies; 130+ messages in thread
From: Paolo Bonzini @ 2020-04-20 14:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Emanuele Giuseppe Esposito
Cc: linux-nfs, Jeremy Kerr, Arnd Bergmann, Michael Ellerman,
Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
Vasily Gorbik, Christian Borntraeger, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Frederic Barrat, Andrew Donnellan,
Robert Richter, Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
Alexander Viro, Ian Kent, Joel Becker, Christoph Hellwig,
Rafael J. Wysocki, Matthew Garrett, Ard Biesheuvel,
Miklos Szeredi, Mike Kravetz, Mark Fasheh, Joseph Qi,
Alexey Dobriyan, Luis Chamberlain, Kees Cook, Iurii Zaikin,
Anton Vorontsov, Colin Cross, Tony Luck, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
Andrii Nakryiko, John Fastabend, KP Singh, Hugh Dickins,
Andrew Morton, J. Bruce Fields, Chuck Lever, Trond Myklebust,
Anna Schumaker, David S. Miller, Jakub Kicinski, James Morris,
Serge E. Hallyn, John Johansen, linuxppc-dev, linux-kernel,
linux-s390, dri-devel, linux-rdma, oprofile-list, linux-scsi,
linux-usb, linux-fsdevel, autofs, linux-efi, linux-mm,
ocfs2-devel, netdev, bpf, linux-security-module
On 20/04/20 16:28, Greg Kroah-Hartman wrote:
>> I assume you meant a new file. These new functions are used only by a few
>> filesystems, and I didn't want to include them in vmlinux unconditionally,
>> so I introduced simplefs.c and CONFIG_SIMPLEFS instead of extending libfs.c.
>> In this way only fs that need this code like debugfs and tracefs will load
>> it.
> Nothing "loads it", why not just make these libfs functions instead? As
> the difference between the two is not obvious at all, please don't make
> things confusing.
I think Emanuele meant "will link it" not "will load it".
Emanuele, you can just move everything to libfs.c and get rid of
CONFIG_SIMPLEFS too. "Do less" is not an offer you want to turn down!
Thanks,
Paolo
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 14:33 ` Paolo Bonzini
0 siblings, 0 replies; 130+ messages in thread
From: Paolo Bonzini @ 2020-04-20 14:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Daniel Vetter, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Maarten Lankhorst,
Mike Marciniszyn, Maxime Ripard, linux-fsdevel, Manoj N. Kumar,
Uma Krishnan, Jakub Kicinski, KP Singh, Trond Myklebust,
Matthew R. Ochs, David S. Miller, Felipe Balbi, linux-nfs,
Iurii Zaikin, linux-scsi, Martin K. Petersen, linux-mm,
linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Thomas Zimmermann,
Colin Cross, Frederic Barrat, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, Joel Becker, Alexander Viro
On 20/04/20 16:28, Greg Kroah-Hartman wrote:
>> I assume you meant a new file. These new functions are used only by a few
>> filesystems, and I didn't want to include them in vmlinux unconditionally,
>> so I introduced simplefs.c and CONFIG_SIMPLEFS instead of extending libfs.c.
>> In this way only fs that need this code like debugfs and tracefs will load
>> it.
> Nothing "loads it", why not just make these libfs functions instead? As
> the difference between the two is not obvious at all, please don't make
> things confusing.
I think Emanuele meant "will link it" not "will load it".
Emanuele, you can just move everything to libfs.c and get rid of
CONFIG_SIMPLEFS too. "Do less" is not an offer you want to turn down!
Thanks,
Paolo
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 14:33 ` Paolo Bonzini
0 siblings, 0 replies; 130+ messages in thread
From: Paolo Bonzini @ 2020-04-20 14:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
ocfs2-devel, Christoph Hellwig, Andrew Donnellan,
Matthew Garrett, linux-efi, Arnd Bergmann, Daniel Borkmann,
Christian Borntraeger, linux-rdma, Michael Ellerman, Mark Fasheh,
Anton Vorontsov, John Fastabend, James Morris, Ard Biesheuvel,
Jason Gunthorpe, Doug Ledford, oprofile-list, Yonghong Song,
Ian Kent, Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn,
Robert Richter, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Mike Marciniszyn, linux-fsdevel,
Manoj N. Kumar, Uma Krishnan, Jakub Kicinski, KP Singh,
Trond Myklebust, Matthew R. Ochs, David S. Miller, Felipe Balbi,
linux-nfs, Iurii Zaikin, linux-scsi, Martin K. Petersen,
linux-mm, linux-s390, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Thomas Zimmermann,
Colin Cross, Frederic Barrat, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, Joel Becker, Alexander Viro
On 20/04/20 16:28, Greg Kroah-Hartman wrote:
>> I assume you meant a new file. These new functions are used only by a few
>> filesystems, and I didn't want to include them in vmlinux unconditionally,
>> so I introduced simplefs.c and CONFIG_SIMPLEFS instead of extending libfs.c.
>> In this way only fs that need this code like debugfs and tracefs will load
>> it.
> Nothing "loads it", why not just make these libfs functions instead? As
> the difference between the two is not obvious at all, please don't make
> things confusing.
I think Emanuele meant "will link it" not "will load it".
Emanuele, you can just move everything to libfs.c and get rid of
CONFIG_SIMPLEFS too. "Do less" is not an offer you want to turn down!
Thanks,
Paolo
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 6/8] simplefs: add file creation functions
@ 2020-04-20 14:33 ` Paolo Bonzini
0 siblings, 0 replies; 130+ messages in thread
From: Paolo Bonzini @ 2020-04-20 14:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Emanuele Giuseppe Esposito
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Benjamin Herrenschmidt, Heiko Carstens, Alexei Starovoitov,
dri-devel, J. Bruce Fields, Joseph Qi, Hugh Dickins,
Paul Mackerras, John Johansen, netdev, ocfs2-devel,
Christoph Hellwig, Andrew Donnellan, Matthew Garrett, linux-efi,
Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman
On 20/04/20 16:28, Greg Kroah-Hartman wrote:
>> I assume you meant a new file. These new functions are used only by a few
>> filesystems, and I didn't want to include them in vmlinux unconditionally,
>> so I introduced simplefs.c and CONFIG_SIMPLEFS instead of extending libfs.c.
>> In this way only fs that need this code like debugfs and tracefs will load
>> it.
> Nothing "loads it", why not just make these libfs functions instead? As
> the difference between the two is not obvious at all, please don't make
> things confusing.
I think Emanuele meant "will link it" not "will load it".
Emanuele, you can just move everything to libfs.c and get rid of
CONFIG_SIMPLEFS too. "Do less" is not an offer you want to turn down!
Thanks,
Paolo
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
` (2 preceding siblings ...)
(?)
@ 2020-04-21 11:19 ` Frederic Barrat
-1 siblings, 0 replies; 130+ messages in thread
From: Frederic Barrat @ 2020-04-21 11:19 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
Manoj N. Kumar, Alexander Viro, Jakub Kicinski, KP Singh,
Trond Myklebust, Matthew R. Ochs, David S. Miller, Felipe Balbi,
Mike Marciniszyn, Iurii Zaikin, linux-scsi, Martin K. Petersen,
linux-mm, Greg Kroah-Hartman, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Colin Cross,
linux-fsdevel, Paolo Bonzini, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, ocfs2-devel, Joel Becker
> diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
> index 39eec9031487..a62795079d9c 100644
> --- a/drivers/misc/cxl/Kconfig
> +++ b/drivers/misc/cxl/Kconfig
> @@ -19,6 +19,7 @@ config CXL
> select CXL_BASE
> select CXL_AFU_DRIVER_OPS
> select CXL_LIB
> + select SIMPLEFS
> default m
> help
> Select this option to enable driver support for IBM Coherent
> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
> index b493de962153..0b8f8de7475a 100644
> --- a/drivers/misc/cxl/api.c
> +++ b/drivers/misc/cxl/api.c
> @@ -9,6 +9,7 @@
> #include <misc/cxl.h>
> #include <linux/module.h>
> #include <linux/mount.h>
> +#include <linux/simplefs.h>
> #include <linux/pseudo_fs.h>
> #include <linux/sched/mm.h>
> #include <linux/mmu_context.h>
> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
> index 2d2266c1439e..ddd9245fff3d 100644
> --- a/drivers/misc/ocxl/Kconfig
> +++ b/drivers/misc/ocxl/Kconfig
> @@ -12,6 +12,7 @@ config OCXL
> depends on PPC_POWERNV && PCI && EEH
> select OCXL_BASE
> select HOTPLUG_PCI_POWERNV
> + select SIMPLEFS
It's not clear to me the Kconfig updated is needed for the ocxl driver.
I think it's only needed for the cxl driver.
Fred
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-21 11:19 ` Frederic Barrat
0 siblings, 0 replies; 130+ messages in thread
From: Frederic Barrat @ 2020-04-21 11:19 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, linux-nfs
Cc: Paolo Bonzini, Jeremy Kerr, Arnd Bergmann, Michael Ellerman,
Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
Vasily Gorbik, Christian Borntraeger, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Andrew Donnellan, Greg Kroah-Hartman,
Robert Richter, Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
Alexander Viro, Ian Kent, Joel Becker, Christoph Hellwig,
Rafael J. Wysocki, Matthew Garrett, Ard Biesheuvel,
Miklos Szeredi, Mike Kravetz, Mark Fasheh, Joseph Qi,
Alexey Dobriyan, Luis Chamberlain, Kees Cook, Iurii Zaikin,
Anton Vorontsov, Colin Cross, Tony Luck, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
Andrii Nakryiko, John Fastabend, KP Singh, Hugh Dickins,
Andrew Morton, J. Bruce Fields, Chuck Lever, Trond Myklebust,
Anna Schumaker, David S. Miller, Jakub Kicinski, James Morris,
Serge E. Hallyn, John Johansen, linuxppc-dev, linux-kernel,
linux-s390, dri-devel, linux-rdma, oprofile-list, linux-scsi,
linux-usb, linux-fsdevel, autofs, linux-efi, linux-mm,
ocfs2-devel, netdev, bpf, linux-security-module
> diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
> index 39eec9031487..a62795079d9c 100644
> --- a/drivers/misc/cxl/Kconfig
> +++ b/drivers/misc/cxl/Kconfig
> @@ -19,6 +19,7 @@ config CXL
> select CXL_BASE
> select CXL_AFU_DRIVER_OPS
> select CXL_LIB
> + select SIMPLEFS
> default m
> help
> Select this option to enable driver support for IBM Coherent
> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
> index b493de962153..0b8f8de7475a 100644
> --- a/drivers/misc/cxl/api.c
> +++ b/drivers/misc/cxl/api.c
> @@ -9,6 +9,7 @@
> #include <misc/cxl.h>
> #include <linux/module.h>
> #include <linux/mount.h>
> +#include <linux/simplefs.h>
> #include <linux/pseudo_fs.h>
> #include <linux/sched/mm.h>
> #include <linux/mmu_context.h>
> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
> index 2d2266c1439e..ddd9245fff3d 100644
> --- a/drivers/misc/ocxl/Kconfig
> +++ b/drivers/misc/ocxl/Kconfig
> @@ -12,6 +12,7 @@ config OCXL
> depends on PPC_POWERNV && PCI && EEH
> select OCXL_BASE
> select HOTPLUG_PCI_POWERNV
> + select SIMPLEFS
It's not clear to me the Kconfig updated is needed for the ocxl driver.
I think it's only needed for the cxl driver.
Fred
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-21 11:19 ` Frederic Barrat
0 siblings, 0 replies; 130+ messages in thread
From: Frederic Barrat @ 2020-04-21 11:19 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, linux-fsdevel,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
> diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
> index 39eec9031487..a62795079d9c 100644
> --- a/drivers/misc/cxl/Kconfig
> +++ b/drivers/misc/cxl/Kconfig
> @@ -19,6 +19,7 @@ config CXL
> select CXL_BASE
> select CXL_AFU_DRIVER_OPS
> select CXL_LIB
> + select SIMPLEFS
> default m
> help
> Select this option to enable driver support for IBM Coherent
> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
> index b493de962153..0b8f8de7475a 100644
> --- a/drivers/misc/cxl/api.c
> +++ b/drivers/misc/cxl/api.c
> @@ -9,6 +9,7 @@
> #include <misc/cxl.h>
> #include <linux/module.h>
> #include <linux/mount.h>
> +#include <linux/simplefs.h>
> #include <linux/pseudo_fs.h>
> #include <linux/sched/mm.h>
> #include <linux/mmu_context.h>
> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
> index 2d2266c1439e..ddd9245fff3d 100644
> --- a/drivers/misc/ocxl/Kconfig
> +++ b/drivers/misc/ocxl/Kconfig
> @@ -12,6 +12,7 @@ config OCXL
> depends on PPC_POWERNV && PCI && EEH
> select OCXL_BASE
> select HOTPLUG_PCI_POWERNV
> + select SIMPLEFS
It's not clear to me the Kconfig updated is needed for the ocxl driver.
I think it's only needed for the cxl driver.
Fred
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-21 11:19 ` Frederic Barrat
0 siblings, 0 replies; 130+ messages in thread
From: Frederic Barrat @ 2020-04-21 11:19 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
Manoj N. Kumar, Alexander Viro, Jakub Kicinski, KP Singh,
Trond Myklebust, Matthew R. Ochs, David S. Miller, Felipe Balbi,
Mike Marciniszyn, Iurii Zaikin, linux-scsi, Martin K. Petersen,
linux-mm, Greg Kroah-Hartman, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Colin Cross,
linux-fsdevel, Paolo Bonzini, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, ocfs2-devel, Joel Becker
> diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
> index 39eec9031487..a62795079d9c 100644
> --- a/drivers/misc/cxl/Kconfig
> +++ b/drivers/misc/cxl/Kconfig
> @@ -19,6 +19,7 @@ config CXL
> select CXL_BASE
> select CXL_AFU_DRIVER_OPS
> select CXL_LIB
> + select SIMPLEFS
> default m
> help
> Select this option to enable driver support for IBM Coherent
> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
> index b493de962153..0b8f8de7475a 100644
> --- a/drivers/misc/cxl/api.c
> +++ b/drivers/misc/cxl/api.c
> @@ -9,6 +9,7 @@
> #include <misc/cxl.h>
> #include <linux/module.h>
> #include <linux/mount.h>
> +#include <linux/simplefs.h>
> #include <linux/pseudo_fs.h>
> #include <linux/sched/mm.h>
> #include <linux/mmu_context.h>
> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
> index 2d2266c1439e..ddd9245fff3d 100644
> --- a/drivers/misc/ocxl/Kconfig
> +++ b/drivers/misc/ocxl/Kconfig
> @@ -12,6 +12,7 @@ config OCXL
> depends on PPC_POWERNV && PCI && EEH
> select OCXL_BASE
> select HOTPLUG_PCI_POWERNV
> + select SIMPLEFS
It's not clear to me the Kconfig updated is needed for the ocxl driver.
I think it's only needed for the cxl driver.
Fred
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-21 11:19 ` Frederic Barrat
0 siblings, 0 replies; 130+ messages in thread
From: Frederic Barrat @ 2020-04-21 11:19 UTC (permalink / raw)
To: Emanuele Giuseppe Esposito, linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John
> diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
> index 39eec9031487..a62795079d9c 100644
> --- a/drivers/misc/cxl/Kconfig
> +++ b/drivers/misc/cxl/Kconfig
> @@ -19,6 +19,7 @@ config CXL
> select CXL_BASE
> select CXL_AFU_DRIVER_OPS
> select CXL_LIB
> + select SIMPLEFS
> default m
> help
> Select this option to enable driver support for IBM Coherent
> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
> index b493de962153..0b8f8de7475a 100644
> --- a/drivers/misc/cxl/api.c
> +++ b/drivers/misc/cxl/api.c
> @@ -9,6 +9,7 @@
> #include <misc/cxl.h>
> #include <linux/module.h>
> #include <linux/mount.h>
> +#include <linux/simplefs.h>
> #include <linux/pseudo_fs.h>
> #include <linux/sched/mm.h>
> #include <linux/mmu_context.h>
> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
> index 2d2266c1439e..ddd9245fff3d 100644
> --- a/drivers/misc/ocxl/Kconfig
> +++ b/drivers/misc/ocxl/Kconfig
> @@ -12,6 +12,7 @@ config OCXL
> depends on PPC_POWERNV && PCI && EEH
> select OCXL_BASE
> select HOTPLUG_PCI_POWERNV
> + select SIMPLEFS
It's not clear to me the Kconfig updated is needed for the ocxl driver.
I think it's only needed for the cxl driver.
Fred
^ permalink raw reply [flat|nested] 130+ messages in thread
* [Ocfs2-devel] [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
2020-04-21 11:19 ` Frederic Barrat
` (2 preceding siblings ...)
(?)
@ 2020-04-21 11:26 ` Emanuele Giuseppe Esposito
-1 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-21 11:26 UTC (permalink / raw)
To: Frederic Barrat, linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
Manoj N. Kumar, Alexander Viro, Jakub Kicinski, KP Singh,
Trond Myklebust, Matthew R. Ochs, David S. Miller, Felipe Balbi,
Mike Marciniszyn, Iurii Zaikin, linux-scsi, Martin K. Petersen,
linux-mm, Greg Kroah-Hartman, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Colin Cross,
linux-fsdevel, Paolo Bonzini, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, ocfs2-devel, Joel Becker
On 4/21/20 1:19 PM, Frederic Barrat wrote:
>
>
>> diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
>> index 39eec9031487..a62795079d9c 100644
>> --- a/drivers/misc/cxl/Kconfig
>> +++ b/drivers/misc/cxl/Kconfig
>> @@ -19,6 +19,7 @@ config CXL
>> ????? select CXL_BASE
>> ????? select CXL_AFU_DRIVER_OPS
>> ????? select CXL_LIB
>> +??? select SIMPLEFS
>> ????? default m
>> ????? help
>> ??????? Select this option to enable driver support for IBM Coherent
>> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
>> index b493de962153..0b8f8de7475a 100644
>> --- a/drivers/misc/cxl/api.c
>> +++ b/drivers/misc/cxl/api.c
>> @@ -9,6 +9,7 @@
>> ? #include <misc/cxl.h>
>> ? #include <linux/module.h>
>> ? #include <linux/mount.h>
>> +#include <linux/simplefs.h>
>> ? #include <linux/pseudo_fs.h>
>> ? #include <linux/sched/mm.h>
>> ? #include <linux/mmu_context.h>
>> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
>> index 2d2266c1439e..ddd9245fff3d 100644
>> --- a/drivers/misc/ocxl/Kconfig
>> +++ b/drivers/misc/ocxl/Kconfig
>> @@ -12,6 +12,7 @@ config OCXL
>> ????? depends on PPC_POWERNV && PCI && EEH
>> ????? select OCXL_BASE
>> ????? select HOTPLUG_PCI_POWERNV
>> +??? select SIMPLEFS
>
>
> It's not clear to me the Kconfig updated is needed for the ocxl driver.
> I think it's only needed for the cxl driver.
I am going to get rid of the separate simplefs.c file and related
Kconfig entry and put everything in fs/libfs.c, so this file (together
with many others touched in this patch) won't be modified in v2.
Thanks,
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-21 11:26 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-21 11:26 UTC (permalink / raw)
To: Frederic Barrat, linux-nfs
Cc: Paolo Bonzini, Jeremy Kerr, Arnd Bergmann, Michael Ellerman,
Benjamin Herrenschmidt, Paul Mackerras, Heiko Carstens,
Vasily Gorbik, Christian Borntraeger, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, Andrew Donnellan, Greg Kroah-Hartman,
Robert Richter, Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
Alexander Viro, Ian Kent, Joel Becker, Christoph Hellwig,
Rafael J. Wysocki, Matthew Garrett, Ard Biesheuvel,
Miklos Szeredi, Mike Kravetz, Mark Fasheh, Joseph Qi,
Alexey Dobriyan, Luis Chamberlain, Kees Cook, Iurii Zaikin,
Anton Vorontsov, Colin Cross, Tony Luck, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
Andrii Nakryiko, John Fastabend, KP Singh, Hugh Dickins,
Andrew Morton, J. Bruce Fields, Chuck Lever, Trond Myklebust,
Anna Schumaker, David S. Miller, Jakub Kicinski, James Morris,
Serge E. Hallyn, John Johansen, linuxppc-dev, linux-kernel,
linux-s390, dri-devel, linux-rdma, oprofile-list, linux-scsi,
linux-usb, linux-fsdevel, autofs, linux-efi, linux-mm,
ocfs2-devel, netdev, bpf, linux-security-module
On 4/21/20 1:19 PM, Frederic Barrat wrote:
>
>
>> diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
>> index 39eec9031487..a62795079d9c 100644
>> --- a/drivers/misc/cxl/Kconfig
>> +++ b/drivers/misc/cxl/Kconfig
>> @@ -19,6 +19,7 @@ config CXL
>> select CXL_BASE
>> select CXL_AFU_DRIVER_OPS
>> select CXL_LIB
>> + select SIMPLEFS
>> default m
>> help
>> Select this option to enable driver support for IBM Coherent
>> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
>> index b493de962153..0b8f8de7475a 100644
>> --- a/drivers/misc/cxl/api.c
>> +++ b/drivers/misc/cxl/api.c
>> @@ -9,6 +9,7 @@
>> #include <misc/cxl.h>
>> #include <linux/module.h>
>> #include <linux/mount.h>
>> +#include <linux/simplefs.h>
>> #include <linux/pseudo_fs.h>
>> #include <linux/sched/mm.h>
>> #include <linux/mmu_context.h>
>> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
>> index 2d2266c1439e..ddd9245fff3d 100644
>> --- a/drivers/misc/ocxl/Kconfig
>> +++ b/drivers/misc/ocxl/Kconfig
>> @@ -12,6 +12,7 @@ config OCXL
>> depends on PPC_POWERNV && PCI && EEH
>> select OCXL_BASE
>> select HOTPLUG_PCI_POWERNV
>> + select SIMPLEFS
>
>
> It's not clear to me the Kconfig updated is needed for the ocxl driver.
> I think it's only needed for the cxl driver.
I am going to get rid of the separate simplefs.c file and related
Kconfig entry and put everything in fs/libfs.c, so this file (together
with many others touched in this patch) won't be modified in v2.
Thanks,
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-21 11:26 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-21 11:26 UTC (permalink / raw)
To: Frederic Barrat, linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John Fastabend,
James Morris, Ard Biesheuvel, Jason Gunthorpe, Doug Ledford,
oprofile-list, Yonghong Song, Ian Kent, Andrii Nakryiko,
Alexey Dobriyan, Serge E. Hallyn, Robert Richter,
Thomas Zimmermann, Vasily Gorbik, Tony Luck, Kees Cook,
James E.J. Bottomley, autofs, Maarten Lankhorst, Uma Krishnan,
Maxime Ripard, Manoj N. Kumar, Alexander Viro, Jakub Kicinski,
KP Singh, Trond Myklebust, Matthew R. Ochs, David S. Miller,
Felipe Balbi, Mike Marciniszyn, Iurii Zaikin, linux-scsi,
Martin K. Petersen, linux-mm, Greg Kroah-Hartman,
Dennis Dalessandro, Miklos Szeredi, linux-security-module,
linux-kernel, Anna Schumaker, Luis Chamberlain, Chuck Lever,
Jeremy Kerr, Daniel Vetter, Colin Cross, linux-fsdevel,
Paolo Bonzini, Andrew Morton, Mike Kravetz, linuxppc-dev,
Martin KaFai Lau, ocfs2-devel, Joel Becker
On 4/21/20 1:19 PM, Frederic Barrat wrote:
>
>
>> diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
>> index 39eec9031487..a62795079d9c 100644
>> --- a/drivers/misc/cxl/Kconfig
>> +++ b/drivers/misc/cxl/Kconfig
>> @@ -19,6 +19,7 @@ config CXL
>> select CXL_BASE
>> select CXL_AFU_DRIVER_OPS
>> select CXL_LIB
>> + select SIMPLEFS
>> default m
>> help
>> Select this option to enable driver support for IBM Coherent
>> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
>> index b493de962153..0b8f8de7475a 100644
>> --- a/drivers/misc/cxl/api.c
>> +++ b/drivers/misc/cxl/api.c
>> @@ -9,6 +9,7 @@
>> #include <misc/cxl.h>
>> #include <linux/module.h>
>> #include <linux/mount.h>
>> +#include <linux/simplefs.h>
>> #include <linux/pseudo_fs.h>
>> #include <linux/sched/mm.h>
>> #include <linux/mmu_context.h>
>> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
>> index 2d2266c1439e..ddd9245fff3d 100644
>> --- a/drivers/misc/ocxl/Kconfig
>> +++ b/drivers/misc/ocxl/Kconfig
>> @@ -12,6 +12,7 @@ config OCXL
>> depends on PPC_POWERNV && PCI && EEH
>> select OCXL_BASE
>> select HOTPLUG_PCI_POWERNV
>> + select SIMPLEFS
>
>
> It's not clear to me the Kconfig updated is needed for the ocxl driver.
> I think it's only needed for the cxl driver.
I am going to get rid of the separate simplefs.c file and related
Kconfig entry and put everything in fs/libfs.c, so this file (together
with many others touched in this patch) won't be modified in v2.
Thanks,
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-21 11:26 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-21 11:26 UTC (permalink / raw)
To: Frederic Barrat, linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Michael Ellerman, Mark Fasheh, Anton Vorontsov,
John Fastabend, James Morris, Ard Biesheuvel, Jason Gunthorpe,
Doug Ledford, oprofile-list, Yonghong Song, Ian Kent,
Andrii Nakryiko, Alexey Dobriyan, Serge E. Hallyn, netdev,
Robert Richter, Thomas Zimmermann, Vasily Gorbik, Tony Luck,
Kees Cook, James E.J. Bottomley, autofs, Uma Krishnan,
Manoj N. Kumar, Alexander Viro, Jakub Kicinski, KP Singh,
Trond Myklebust, Matthew R. Ochs, David S. Miller, Felipe Balbi,
Mike Marciniszyn, Iurii Zaikin, linux-scsi, Martin K. Petersen,
linux-mm, Greg Kroah-Hartman, Dennis Dalessandro, Miklos Szeredi,
linux-security-module, linux-kernel, Anna Schumaker,
Luis Chamberlain, Chuck Lever, Jeremy Kerr, Colin Cross,
linux-fsdevel, Paolo Bonzini, Andrew Morton, Mike Kravetz,
linuxppc-dev, Martin KaFai Lau, ocfs2-devel, Joel Becker
On 4/21/20 1:19 PM, Frederic Barrat wrote:
>
>
>> diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
>> index 39eec9031487..a62795079d9c 100644
>> --- a/drivers/misc/cxl/Kconfig
>> +++ b/drivers/misc/cxl/Kconfig
>> @@ -19,6 +19,7 @@ config CXL
>> select CXL_BASE
>> select CXL_AFU_DRIVER_OPS
>> select CXL_LIB
>> + select SIMPLEFS
>> default m
>> help
>> Select this option to enable driver support for IBM Coherent
>> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
>> index b493de962153..0b8f8de7475a 100644
>> --- a/drivers/misc/cxl/api.c
>> +++ b/drivers/misc/cxl/api.c
>> @@ -9,6 +9,7 @@
>> #include <misc/cxl.h>
>> #include <linux/module.h>
>> #include <linux/mount.h>
>> +#include <linux/simplefs.h>
>> #include <linux/pseudo_fs.h>
>> #include <linux/sched/mm.h>
>> #include <linux/mmu_context.h>
>> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
>> index 2d2266c1439e..ddd9245fff3d 100644
>> --- a/drivers/misc/ocxl/Kconfig
>> +++ b/drivers/misc/ocxl/Kconfig
>> @@ -12,6 +12,7 @@ config OCXL
>> depends on PPC_POWERNV && PCI && EEH
>> select OCXL_BASE
>> select HOTPLUG_PCI_POWERNV
>> + select SIMPLEFS
>
>
> It's not clear to me the Kconfig updated is needed for the ocxl driver.
> I think it's only needed for the cxl driver.
I am going to get rid of the separate simplefs.c file and related
Kconfig entry and put everything in fs/libfs.c, so this file (together
with many others touched in this patch) won't be modified in v2.
Thanks,
Emanuele
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 130+ messages in thread
* Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files
@ 2020-04-21 11:26 ` Emanuele Giuseppe Esposito
0 siblings, 0 replies; 130+ messages in thread
From: Emanuele Giuseppe Esposito @ 2020-04-21 11:26 UTC (permalink / raw)
To: Frederic Barrat, linux-nfs
Cc: Song Liu, linux-usb, bpf, Rafael J. Wysocki, David Airlie,
Heiko Carstens, Alexei Starovoitov, dri-devel, J. Bruce Fields,
Joseph Qi, Hugh Dickins, Paul Mackerras, John Johansen, netdev,
linux-s390, Christoph Hellwig, Andrew Donnellan, Matthew Garrett,
linux-efi, Arnd Bergmann, Daniel Borkmann, Christian Borntraeger,
linux-rdma, Mark Fasheh, Anton Vorontsov, John
On 4/21/20 1:19 PM, Frederic Barrat wrote:
>
>
>> diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
>> index 39eec9031487..a62795079d9c 100644
>> --- a/drivers/misc/cxl/Kconfig
>> +++ b/drivers/misc/cxl/Kconfig
>> @@ -19,6 +19,7 @@ config CXL
>> select CXL_BASE
>> select CXL_AFU_DRIVER_OPS
>> select CXL_LIB
>> + select SIMPLEFS
>> default m
>> help
>> Select this option to enable driver support for IBM Coherent
>> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
>> index b493de962153..0b8f8de7475a 100644
>> --- a/drivers/misc/cxl/api.c
>> +++ b/drivers/misc/cxl/api.c
>> @@ -9,6 +9,7 @@
>> #include <misc/cxl.h>
>> #include <linux/module.h>
>> #include <linux/mount.h>
>> +#include <linux/simplefs.h>
>> #include <linux/pseudo_fs.h>
>> #include <linux/sched/mm.h>
>> #include <linux/mmu_context.h>
>> diff --git a/drivers/misc/ocxl/Kconfig b/drivers/misc/ocxl/Kconfig
>> index 2d2266c1439e..ddd9245fff3d 100644
>> --- a/drivers/misc/ocxl/Kconfig
>> +++ b/drivers/misc/ocxl/Kconfig
>> @@ -12,6 +12,7 @@ config OCXL
>> depends on PPC_POWERNV && PCI && EEH
>> select OCXL_BASE
>> select HOTPLUG_PCI_POWERNV
>> + select SIMPLEFS
>
>
> It's not clear to me the Kconfig updated is needed for the ocxl driver.
> I think it's only needed for the cxl driver.
I am going to get rid of the separate simplefs.c file and related
Kconfig entry and put everything in fs/libfs.c, so this file (together
with many others touched in this patch) won't be modified in v2.
Thanks,
Emanuele
^ permalink raw reply [flat|nested] 130+ messages in thread
end of thread, other threads:[~2020-04-22 6:55 UTC | newest]
Thread overview: 130+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 12:42 [Ocfs2-devel] [PATCH 0/8] Simplefs: group and simplify linux fs code Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` [Ocfs2-devel] [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-15 12:52 ` kbuild test robot
2020-04-15 12:52 ` kbuild test robot
2020-04-16 6:44 ` [Ocfs2-devel] " Luis Chamberlain
2020-04-16 6:44 ` Luis Chamberlain
2020-04-16 6:44 ` Luis Chamberlain
2020-04-16 6:44 ` Luis Chamberlain
2020-04-16 6:44 ` Luis Chamberlain
2020-04-20 14:00 ` Emanuele Giuseppe Esposito
2020-04-20 14:00 ` Emanuele Giuseppe Esposito
2020-04-20 14:00 ` Emanuele Giuseppe Esposito
2020-04-20 14:00 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` [Ocfs2-devel] [PATCH 2/8] fs: extract simple_pin/release_fs to separate files Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:54 ` [Ocfs2-devel] " Greg Kroah-Hartman
2020-04-14 12:54 ` Greg Kroah-Hartman
2020-04-14 12:54 ` Greg Kroah-Hartman
2020-04-14 12:54 ` Greg Kroah-Hartman
2020-04-14 12:54 ` Greg Kroah-Hartman
2020-04-15 0:57 ` kbuild test robot
2020-04-15 0:57 ` kbuild test robot
2020-04-15 0:57 ` kbuild test robot
2020-04-16 6:52 ` [Ocfs2-devel] " Luis Chamberlain
2020-04-16 6:52 ` Luis Chamberlain
2020-04-16 6:52 ` Luis Chamberlain
2020-04-16 6:52 ` Luis Chamberlain
2020-04-16 6:52 ` Luis Chamberlain
2020-04-21 11:19 ` [Ocfs2-devel] " Frederic Barrat
2020-04-21 11:19 ` Frederic Barrat
2020-04-21 11:19 ` Frederic Barrat
2020-04-21 11:19 ` Frederic Barrat
2020-04-21 11:19 ` Frederic Barrat
2020-04-21 11:26 ` [Ocfs2-devel] " Emanuele Giuseppe Esposito
2020-04-21 11:26 ` Emanuele Giuseppe Esposito
2020-04-21 11:26 ` Emanuele Giuseppe Esposito
2020-04-21 11:26 ` Emanuele Giuseppe Esposito
2020-04-21 11:26 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` [Ocfs2-devel] [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 13:03 ` [Ocfs2-devel] " Greg Kroah-Hartman
2020-04-14 13:03 ` Greg Kroah-Hartman
2020-04-14 13:03 ` Greg Kroah-Hartman
2020-04-14 13:03 ` Greg Kroah-Hartman
2020-04-14 13:03 ` Greg Kroah-Hartman
2020-04-14 23:24 ` kbuild test robot
2020-04-14 23:24 ` kbuild test robot
2020-04-14 12:42 ` [Ocfs2-devel] [PATCH 4/8] fs: introduce simple_new_inode Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 13:01 ` [Ocfs2-devel] " Greg Kroah-Hartman
2020-04-14 13:01 ` Greg Kroah-Hartman
2020-04-14 13:01 ` Greg Kroah-Hartman
2020-04-14 13:01 ` Greg Kroah-Hartman
2020-04-14 13:01 ` Greg Kroah-Hartman
2020-04-20 13:58 ` [Ocfs2-devel] " Emanuele Giuseppe Esposito
2020-04-20 13:58 ` Emanuele Giuseppe Esposito
2020-04-20 13:58 ` Emanuele Giuseppe Esposito
2020-04-20 13:58 ` Emanuele Giuseppe Esposito
2020-04-20 13:58 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` [Ocfs2-devel] [PATCH 5/8] simplefs: add alloc_anon_inode wrapper Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito
2020-04-14 12:55 ` [Ocfs2-devel] " Greg Kroah-Hartman
2020-04-14 12:55 ` Greg Kroah-Hartman
2020-04-14 12:55 ` Greg Kroah-Hartman
2020-04-14 12:55 ` Greg Kroah-Hartman
2020-04-14 12:55 ` Greg Kroah-Hartman
2020-04-14 12:43 ` [Ocfs2-devel] [PATCH 6/8] simplefs: add file creation functions Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:56 ` [Ocfs2-devel] " Greg Kroah-Hartman
2020-04-14 12:56 ` Greg Kroah-Hartman
2020-04-14 12:56 ` Greg Kroah-Hartman
2020-04-14 12:56 ` Greg Kroah-Hartman
2020-04-14 12:56 ` Greg Kroah-Hartman
2020-04-20 13:57 ` [Ocfs2-devel] " Emanuele Giuseppe Esposito
2020-04-20 13:57 ` Emanuele Giuseppe Esposito
2020-04-20 13:57 ` Emanuele Giuseppe Esposito
2020-04-20 13:57 ` Emanuele Giuseppe Esposito
2020-04-20 13:57 ` Emanuele Giuseppe Esposito
2020-04-20 14:28 ` [Ocfs2-devel] " Greg Kroah-Hartman
2020-04-20 14:28 ` Greg Kroah-Hartman
2020-04-20 14:28 ` Greg Kroah-Hartman
2020-04-20 14:28 ` Greg Kroah-Hartman
2020-04-20 14:28 ` Greg Kroah-Hartman
2020-04-20 14:33 ` [Ocfs2-devel] " Paolo Bonzini
2020-04-20 14:33 ` Paolo Bonzini
2020-04-20 14:33 ` Paolo Bonzini
2020-04-20 14:33 ` Paolo Bonzini
2020-04-20 14:33 ` Paolo Bonzini
2020-04-14 12:43 ` [Ocfs2-devel] [PATCH 7/8] debugfs: switch to simplefs inode creation API Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:43 ` [Ocfs2-devel] [PATCH 8/8] tracefs: " Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-14 12:43 ` Emanuele Giuseppe Esposito
2020-04-16 6:59 ` [Ocfs2-devel] [PATCH 0/8] Simplefs: group and simplify linux fs code Luis Chamberlain
2020-04-16 6:59 ` Luis Chamberlain
2020-04-16 6:59 ` Luis Chamberlain
2020-04-16 6:59 ` Luis Chamberlain
2020-04-16 6:59 ` Luis Chamberlain
2020-04-20 14:01 ` Emanuele Giuseppe Esposito
2020-04-20 14:01 ` Emanuele Giuseppe Esposito
2020-04-20 14:01 ` Emanuele Giuseppe Esposito
2020-04-20 14:01 ` Emanuele Giuseppe Esposito
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.