Skip to content

Commit cbfe0de

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS changes from Al Viro: "First pile out of several (there _definitely_ will be more). Stuff in this one: - unification of d_splice_alias()/d_materialize_unique() - iov_iter rewrite - killing a bunch of ->f_path.dentry users (and f_dentry macro). Getting that completed will make life much simpler for unionmount/overlayfs, since then we'll be able to limit the places sensitive to file _dentry_ to reasonably few. Which allows to have file_inode(file) pointing to inode in a covered layer, with dentry pointing to (negative) dentry in union one. Still not complete, but much closer now. - crapectomy in lustre (dead code removal, mostly) - "let's make seq_printf return nothing" preparations - assorted cleanups and fixes There _definitely_ will be more piles" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits) copy_from_iter_nocache() new helper: iov_iter_kvec() csum_and_copy_..._iter() iov_iter.c: handle ITER_KVEC directly iov_iter.c: convert copy_to_iter() to iterate_and_advance iov_iter.c: convert copy_from_iter() to iterate_and_advance iov_iter.c: get rid of bvec_copy_page_{to,from}_iter() iov_iter.c: convert iov_iter_zero() to iterate_and_advance iov_iter.c: convert iov_iter_get_pages_alloc() to iterate_all_kinds iov_iter.c: convert iov_iter_get_pages() to iterate_all_kinds iov_iter.c: convert iov_iter_npages() to iterate_all_kinds iov_iter.c: iterate_and_advance iov_iter.c: macros for iterating over iov_iter kill f_dentry macro dcache: fix kmemcheck warning in switch_names new helper: audit_file() nfsd_vfs_write(): use file_inode() ncpfs: use file_inode() kill f_dentry uses lockd: get rid of ->f_path.dentry->d_sb ...
2 parents 8322b6f + ba00410 commit cbfe0de

157 files changed

Lines changed: 1666 additions & 2166 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/filesystems/debugfs.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ file.
140140
struct dentry *parent,
141141
struct debugfs_regset32 *regset);
142142

143-
int debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
143+
void debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
144144
int nregs, void __iomem *base, char *prefix);
145145

146146
The "base" argument may be 0, but you may want to build the reg32 array

‎Documentation/filesystems/nfs/Exporting‎

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,11 @@ c/ Helper routines to allocate anonymous dentries, and to help attach
7272
DCACHE_DISCONNECTED) dentry is allocated and attached.
7373
In the case of a directory, care is taken that only one dentry
7474
can ever be attached.
75-
d_splice_alias(inode, dentry) or d_materialise_unique(dentry, inode)
76-
will introduce a new dentry into the tree; either the passed-in
77-
dentry or a preexisting alias for the given inode (such as an
78-
anonymous one created by d_obtain_alias), if appropriate. The two
79-
functions differ in their handling of directories with preexisting
80-
aliases:
81-
d_splice_alias will use any existing IS_ROOT dentry, but it will
82-
return -EIO rather than try to move a dentry with a different
83-
parent. This is appropriate for local filesystems, which
84-
should never see such an alias unless the filesystem is
85-
corrupted somehow (for example, if two on-disk directory
86-
entries refer to the same directory.)
87-
d_materialise_unique will attempt to move any dentry. This is
88-
appropriate for distributed filesystems, where finding a
89-
directory other than where we last cached it may be a normal
90-
consequence of concurrent operations on other hosts.
91-
Both functions return NULL when the passed-in dentry is used,
92-
following the calling convention of ->lookup.
75+
d_splice_alias(inode, dentry) will introduce a new dentry into the tree;
76+
either the passed-in dentry or a preexisting alias for the given inode
77+
(such as an anonymous one created by d_obtain_alias), if appropriate.
78+
It returns NULL when the passed-in dentry is used, following the calling
79+
convention of ->lookup.
9380

9481

9582
Filesystem Issues

‎Documentation/filesystems/porting‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,3 +463,11 @@ in your dentry operations instead.
463463
of the in-tree instances did). inode_hash_lock is still held,
464464
of course, so they are still serialized wrt removal from inode hash,
465465
as well as wrt set() callback of iget5_locked().
466+
--
467+
[mandatory]
468+
d_materialise_unique() is gone; d_splice_alias() does everything you
469+
need now. Remember that they have opposite orders of arguments ;-/
470+
--
471+
[mandatory]
472+
f_dentry is gone; use f_path.dentry, or, better yet, see if you can avoid
473+
it entirely.

‎Documentation/filesystems/seq_file.txt‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,23 +180,19 @@ output must be passed to the seq_file code. Some utility functions have
180180
been defined which make this task easy.
181181

182182
Most code will simply use seq_printf(), which works pretty much like
183-
printk(), but which requires the seq_file pointer as an argument. It is
184-
common to ignore the return value from seq_printf(), but a function
185-
producing complicated output may want to check that value and quit if
186-
something non-zero is returned; an error return means that the seq_file
187-
buffer has been filled and further output will be discarded.
183+
printk(), but which requires the seq_file pointer as an argument.
188184

189185
For straight character output, the following functions may be used:
190186

191-
int seq_putc(struct seq_file *m, char c);
192-
int seq_puts(struct seq_file *m, const char *s);
193-
int seq_escape(struct seq_file *m, const char *s, const char *esc);
187+
seq_putc(struct seq_file *m, char c);
188+
seq_puts(struct seq_file *m, const char *s);
189+
seq_escape(struct seq_file *m, const char *s, const char *esc);
194190

195191
The first two output a single character and a string, just like one would
196192
expect. seq_escape() is like seq_puts(), except that any character in s
197193
which is in the string esc will be represented in octal form in the output.
198194

199-
There is also a pair of functions for printing filenames:
195+
There are also a pair of functions for printing filenames:
200196

201197
int seq_path(struct seq_file *m, struct path *path, char *esc);
202198
int seq_path_root(struct seq_file *m, struct path *path,
@@ -209,6 +205,14 @@ root is desired, it can be used with seq_path_root(). Note that, if it
209205
turns out that path cannot be reached from root, the value of root will be
210206
changed in seq_file_root() to a root which *does* work.
211207

208+
A function producing complicated output may want to check
209+
bool seq_has_overflowed(struct seq_file *m);
210+
and avoid further seq_<output> calls if true is returned.
211+
212+
A true return from seq_has_overflowed means that the seq_file buffer will
213+
be discarded and the seq_show function will attempt to allocate a larger
214+
buffer and retry printing.
215+
212216

213217
Making it all work
214218

‎Documentation/filesystems/vfs.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ struct file_operations {
835835
ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int);
836836
int (*setlease)(struct file *, long arg, struct file_lock **, void **);
837837
long (*fallocate)(struct file *, int mode, loff_t offset, loff_t len);
838-
int (*show_fdinfo)(struct seq_file *m, struct file *f);
838+
void (*show_fdinfo)(struct seq_file *m, struct file *f);
839839
};
840840

841841
Again, all methods are called without any locks being held, unless

‎arch/alpha/kernel/osf_sys.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,12 @@ struct osf_dirent_callback {
104104
};
105105

106106
static int
107-
osf_filldir(void *__buf, const char *name, int namlen, loff_t offset,
108-
u64 ino, unsigned int d_type)
107+
osf_filldir(struct dir_context *ctx, const char *name, int namlen,
108+
loff_t offset, u64 ino, unsigned int d_type)
109109
{
110110
struct osf_dirent __user *dirent;
111-
struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf;
111+
struct osf_dirent_callback *buf =
112+
container_of(ctx, struct osf_dirent_callback, ctx);
112113
unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32));
113114
unsigned int d_ino;
114115

‎arch/parisc/hpux/fs.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ struct getdents_callback {
5656

5757
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
5858

59-
static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
60-
u64 ino, unsigned d_type)
59+
static int filldir(struct dir_context *ctx, const char *name, int namlen,
60+
loff_t offset, u64 ino, unsigned d_type)
6161
{
6262
struct hpux_dirent __user * dirent;
63-
struct getdents_callback * buf = (struct getdents_callback *) __buf;
63+
struct getdents_callback *buf =
64+
container_of(ctx, struct getdents_callback, ctx);
6465
ino_t d_ino;
6566
int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long));
6667

‎arch/powerpc/oprofile/cell/spu_task_sync.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp,
331331

332332
if (mm->exe_file) {
333333
app_cookie = fast_get_dcookie(&mm->exe_file->f_path);
334-
pr_debug("got dcookie for %s\n",
335-
mm->exe_file->f_dentry->d_name.name);
334+
pr_debug("got dcookie for %pD\n", mm->exe_file);
336335
}
337336

338337
for (vma = mm->mmap; vma; vma = vma->vm_next) {
@@ -342,15 +341,14 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp,
342341
if (!vma->vm_file)
343342
goto fail_no_image_cookie;
344343

345-
pr_debug("Found spu ELF at %X(object-id:%lx) for file %s\n",
346-
my_offset, spu_ref,
347-
vma->vm_file->f_dentry->d_name.name);
344+
pr_debug("Found spu ELF at %X(object-id:%lx) for file %pD\n",
345+
my_offset, spu_ref, vma->vm_file);
348346
*offsetp = my_offset;
349347
break;
350348
}
351349

352350
*spu_bin_dcookie = fast_get_dcookie(&vma->vm_file->f_path);
353-
pr_debug("got dcookie for %s\n", vma->vm_file->f_dentry->d_name.name);
351+
pr_debug("got dcookie for %pD\n", vma->vm_file);
354352

355353
up_read(&mm->mmap_sem);
356354

‎arch/powerpc/platforms/cell/spufs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static void spufs_prune_dir(struct dentry *dir)
164164
struct dentry *dentry, *tmp;
165165

166166
mutex_lock(&dir->d_inode->i_mutex);
167-
list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) {
167+
list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
168168
spin_lock(&dentry->d_lock);
169169
if (!(d_unhashed(dentry)) && dentry->d_inode) {
170170
dget_dlock(dentry);

‎arch/s390/hypfs/hypfs_dbfs.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@ static ssize_t dbfs_read(struct file *file, char __user *buf,
8383

8484
static long dbfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
8585
{
86-
struct hypfs_dbfs_file *df;
86+
struct hypfs_dbfs_file *df = file_inode(file)->i_private;
8787
long rc;
8888

89-
df = file->f_path.dentry->d_inode->i_private;
9089
mutex_lock(&df->lock);
9190
if (df->unlocked_ioctl)
9291
rc = df->unlocked_ioctl(file, cmd, arg);

0 commit comments

Comments
 (0)