Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/vfs

Pull VFS patches (part 1) from Al Viro:
 "The major change in this pile is ->readdir() replacement with
  ->iterate(), dealing with ->f_pos races in ->readdir() instances for
  good.

  There's a lot more, but I'd prefer to split the pull request into
  several stages and this is the first obvious cutoff point."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (67 commits)
  [readdir] constify ->actor
  [readdir] ->readdir() is gone
  [readdir] convert ecryptfs
  [readdir] convert coda
  [readdir] convert ocfs2
  [readdir] convert fatfs
  [readdir] convert xfs
  [readdir] convert btrfs
  [readdir] convert hostfs
  [readdir] convert afs
  [readdir] convert ncpfs
  [readdir] convert hfsplus
  [readdir] convert hfs
  [readdir] convert befs
  [readdir] convert cifs
  [readdir] convert freevxfs
  [readdir] convert fuse
  [readdir] convert hpfs
  reiserfs: switch reiserfs_readdir_dentry to inode
  reiserfs: is_privroot_deh() needs only directory inode, actually
  ...
  • Loading branch information
torvalds committed Jul 2, 2013
2 parents 7747bd4 + ac6614b commit 63580e5
Show file tree
Hide file tree
Showing 144 changed files with 1,937 additions and 2,824 deletions.
2 changes: 1 addition & 1 deletion Documentation/filesystems/Locking
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ prototypes:
ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
int (*readdir) (struct file *, void *, filldir_t);
int (*iterate) (struct file *, struct dir_context *);
unsigned int (*poll) (struct file *, struct poll_table_struct *);
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
Expand Down
6 changes: 6 additions & 0 deletions Documentation/filesystems/porting
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,9 @@ object doesn't exist. It's remote/distributed ones that might care...
[mandatory]
FS_REVAL_DOT is gone; if you used to have it, add ->d_weak_revalidate()
in your dentry operations instead.
--
[mandatory]
vfs_readdir() is gone; switch to iterate_dir() instead
--
[mandatory]
->readdir() is gone now; switch to ->iterate()
4 changes: 2 additions & 2 deletions Documentation/filesystems/vfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ struct file_operations {
ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
int (*readdir) (struct file *, void *, filldir_t);
int (*iterate) (struct file *, struct dir_context *);
unsigned int (*poll) (struct file *, struct poll_table_struct *);
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
Expand Down Expand Up @@ -815,7 +815,7 @@ otherwise noted.

aio_write: called by io_submit(2) and other asynchronous I/O operations

readdir: called when the VFS needs to read the directory contents
iterate: called when the VFS needs to read the directory contents

poll: called by the VFS when a process wants to check if there is
activity on this file and (optionally) go to sleep until there
Expand Down
3 changes: 0 additions & 3 deletions arch/alpha/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@ extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
#define kern_addr_valid(addr) (1)
#endif

#define io_remap_pfn_range(vma, start, pfn, size, prot) \
remap_pfn_range(vma, start, pfn, size, prot)

#define pte_ERROR(e) \
printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
#define pmd_ERROR(e) \
Expand Down
15 changes: 8 additions & 7 deletions arch/alpha/kernel/osf_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct osf_dirent {
};

struct osf_dirent_callback {
struct dir_context ctx;
struct osf_dirent __user *dirent;
long __user *basep;
unsigned int count;
Expand Down Expand Up @@ -146,17 +147,17 @@ SYSCALL_DEFINE4(osf_getdirentries, unsigned int, fd,
{
int error;
struct fd arg = fdget(fd);
struct osf_dirent_callback buf;
struct osf_dirent_callback buf = {
.ctx.actor = osf_filldir,
.dirent = dirent,
.basep = basep,
.count = count
};

if (!arg.file)
return -EBADF;

buf.dirent = dirent;
buf.basep = basep;
buf.count = count;
buf.error = 0;

error = vfs_readdir(arg.file, osf_filldir, &buf);
error = iterate_dir(arg.file, &buf.ctx);
if (error >= 0)
error = buf.error;
if (count != buf.count)
Expand Down
1 change: 0 additions & 1 deletion arch/alpha/kernel/pci-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ static int hose_mmap_page_range(struct pci_controller *hose,
base = sparse ? hose->sparse_io_base : hose->dense_io_base;

vma->vm_pgoff += base >> PAGE_SHIFT;
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;

return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
vma->vm_end - vma->vm_start,
Expand Down
3 changes: 0 additions & 3 deletions arch/arc/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,6 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
* remap a physical page `pfn' of size `size' with page protection `prot'
* into virtual address `from'
*/
#define io_remap_pfn_range(vma, from, pfn, size, prot) \
remap_pfn_range(vma, from, pfn, size, prot)

#include <asm-generic/pgtable.h>

/* to cope with aliasing VIPT cache */
Expand Down
2 changes: 0 additions & 2 deletions arch/arm/include/asm/pgtable-nommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ extern unsigned int kobjsize(const void *objp);
* No page table caches to initialise.
*/
#define pgtable_cache_init() do { } while (0)
#define io_remap_pfn_range remap_pfn_range


/*
* All 32bit addresses are effectively valid for vmalloc...
Expand Down
7 changes: 0 additions & 7 deletions arch/arm/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
#define HAVE_ARCH_UNMAPPED_AREA
#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN

/*
* remap a physical page `pfn' of size `size' with page protection `prot'
* into virtual address `from'
*/
#define io_remap_pfn_range(vma,from,pfn,size,prot) \
remap_pfn_range(vma, from, pfn, size, prot)

#define pgtable_cache_init() do { } while (0)

#endif /* !__ASSEMBLY__ */
Expand Down
7 changes: 0 additions & 7 deletions arch/arm64/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,6 @@ extern int kern_addr_valid(unsigned long addr);

#include <asm-generic/pgtable.h>

/*
* remap a physical page `pfn' of size `size' with page protection `prot'
* into virtual address `from'
*/
#define io_remap_pfn_range(vma,from,pfn,size,prot) \
remap_pfn_range(vma, from, pfn, size, prot)

#define pgtable_cache_init() do { } while (0)

#endif /* !__ASSEMBLY__ */
Expand Down
3 changes: 0 additions & 3 deletions arch/avr32/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,6 @@ typedef pte_t *pte_addr_t;

#define kern_addr_valid(addr) (1)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

/* No page table caches to initialize (?) */
#define pgtable_cache_init() do { } while(0)

Expand Down
1 change: 0 additions & 1 deletion arch/blackfin/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ extern char empty_zero_page[];
* No page table caches to initialise.
*/
#define pgtable_cache_init() do { } while (0)
#define io_remap_pfn_range remap_pfn_range

/*
* All 32bit addresses are effectively valid for vmalloc...
Expand Down
1 change: 0 additions & 1 deletion arch/c6x/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ extern unsigned long empty_zero_page;
* No page table caches to initialise
*/
#define pgtable_cache_init() do { } while (0)
#define io_remap_pfn_range remap_pfn_range

#include <asm-generic/pgtable.h>

Expand Down
3 changes: 0 additions & 3 deletions arch/cris/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,6 @@ static inline pgd_t * pgd_offset(const struct mm_struct *mm, unsigned long addre
#define pgd_ERROR(e) \
printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e))

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)


extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* defined in head.S */

Expand Down
3 changes: 0 additions & 3 deletions arch/frv/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,6 @@ static inline int pte_file(pte_t pte)
#define PageSkip(page) (0)
#define kern_addr_valid(addr) (1)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
#define __HAVE_ARCH_PTEP_SET_WRPROTECT
Expand Down
3 changes: 0 additions & 3 deletions arch/h8300/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ extern int is_in_rom(unsigned long);
*/
#define pgtable_cache_init() do { } while (0)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

/*
* All 32bit addresses are effectively valid for vmalloc...
* Sort of meaningless for non-VM targets.
Expand Down
4 changes: 0 additions & 4 deletions arch/hexagon/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,6 @@ static inline int pte_exec(pte_t pte)

#define __pte_offset(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))

/* Nothing special about IO remapping at this point */
#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

/* I think this is in case we have page table caches; needed by init/main.c */
#define pgtable_cache_init() do { } while (0)

Expand Down
3 changes: 0 additions & 3 deletions arch/ia64/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,6 @@ extern void paging_init (void);
#define pte_to_pgoff(pte) ((pte_val(pte) << 1) >> 3)
#define pgoff_to_pte(off) ((pte_t) { ((off) << 2) | _PAGE_FILE })

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

/*
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
Expand Down
3 changes: 0 additions & 3 deletions arch/m32r/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,6 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
#define kern_addr_valid(addr) (1)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
#define __HAVE_ARCH_PTEP_SET_WRPROTECT
Expand Down
3 changes: 0 additions & 3 deletions arch/m68k/include/asm/pgtable_mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,

#define kern_addr_valid(addr) (1)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

/* MMU-specific headers */

#ifdef CONFIG_SUN3
Expand Down
3 changes: 0 additions & 3 deletions arch/m68k/include/asm/pgtable_no.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ extern unsigned int kobjsize(const void *objp);
*/
#define pgtable_cache_init() do { } while (0)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

/*
* All 32bit addresses are effectively valid for vmalloc...
* Sort of meaningless for non-VM targets.
Expand Down
3 changes: 0 additions & 3 deletions arch/metag/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,

#define kern_addr_valid(addr) (1)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

/*
* No page table caches to initialise
*/
Expand Down
3 changes: 0 additions & 3 deletions arch/microblaze/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

#include <asm/setup.h>

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

#ifndef __ASSEMBLY__
extern int mem_init_done;
#endif
Expand Down
4 changes: 1 addition & 3 deletions arch/mips/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size);
return remap_pfn_range(vma, vaddr, phys_addr_high >> PAGE_SHIFT, size, prot);
}
#else
#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)
#define io_remap_pfn_range io_remap_pfn_range
#endif

#ifdef CONFIG_TRANSPARENT_HUGEPAGE
Expand Down
3 changes: 0 additions & 3 deletions arch/mn10300/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,6 @@ extern void update_mmu_cache(struct vm_area_struct *vma,

#define kern_addr_valid(addr) (1)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range((vma), (vaddr), (pfn), (size), (prot))

#define MK_IOSPACE_PFN(space, pfn) (pfn)
#define GET_IOSPACE(pfn) 0
#define GET_PFN(pfn) (pfn)
Expand Down
2 changes: 1 addition & 1 deletion arch/mn10300/unit-asb2305/pci-asb2305.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
/* Leave vm_pgoff as-is, the PCI space address is the physical
* address on this platform.
*/
vma->vm_flags |= VM_LOCKED | VM_IO;
vma->vm_flags |= VM_LOCKED;

prot = pgprot_val(vma->vm_page_prot);
prot &= ~_PAGE_CACHE;
Expand Down
3 changes: 0 additions & 3 deletions arch/openrisc/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,

#define kern_addr_valid(addr) (1)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

#include <asm-generic/pgtable.h>

/*
Expand Down
16 changes: 8 additions & 8 deletions arch/parisc/hpux/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct hpux_dirent {
};

struct getdents_callback {
struct dir_context ctx;
struct hpux_dirent __user *current_dir;
struct hpux_dirent __user *previous;
int count;
Expand Down Expand Up @@ -110,24 +111,23 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned i
{
struct fd arg;
struct hpux_dirent __user * lastdirent;
struct getdents_callback buf;
struct getdents_callback buf = {
.ctx.actor = filldir,
.current_dir = dirent,
.count = count
};
int error;

arg = fdget(fd);
if (!arg.file)
return -EBADF;

buf.current_dir = dirent;
buf.previous = NULL;
buf.count = count;
buf.error = 0;

error = vfs_readdir(arg.file, filldir, &buf);
error = iterate_dir(arg.file, &buf.ctx);
if (error >= 0)
error = buf.error;
lastdirent = buf.previous;
if (lastdirent) {
if (put_user(arg.file->f_pos, &lastdirent->d_off))
if (put_user(buf.ctx.pos, &lastdirent->d_off))
error = -EFAULT;
else
error = count - buf.count;
Expand Down
3 changes: 0 additions & 3 deletions arch/parisc/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
#endif


#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

#define pgprot_noncached(prot) __pgprot(pgprot_val(prot) | _PAGE_NO_CACHE)

/* We provide our own get_unmapped_area to provide cache coherency */
Expand Down
3 changes: 0 additions & 3 deletions arch/powerpc/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ extern void paging_init(void);
*/
#define kern_addr_valid(addr) (1)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

#include <asm-generic/pgtable.h>


Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/cell/spufs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const struct file_operations spufs_context_fops = {
.release = spufs_dir_close,
.llseek = dcache_dir_lseek,
.read = generic_read_dir,
.readdir = dcache_readdir,
.iterate = dcache_readdir,
.fsync = noop_fsync,
};
EXPORT_SYMBOL_GPL(spufs_context_fops);
Expand Down
3 changes: 0 additions & 3 deletions arch/s390/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ extern unsigned long zero_page_mask;
#define __HAVE_COLOR_ZERO_PAGE

/* TODO: s390 cannot support io_remap_pfn_range... */
#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

#endif /* !__ASSEMBLY__ */

/*
Expand Down
3 changes: 0 additions & 3 deletions arch/score/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
#define pte_clear(mm, addr, xp) \
do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
remap_pfn_range(vma, vaddr, pfn, size, prot)

/*
* The "pgd_xxx()" functions here are trivial for a folded two-level
* setup: the pgd is never bad, and a pmd always exists (as it's folded
Expand Down
Loading

0 comments on commit 63580e5

Please sign in to comment.