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-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (41 commits)
  fs: add documentation on fallocate hole punching
  Gfs2: fail if we try to use hole punch
  Btrfs: fail if we try to use hole punch
  Ext4: fail if we try to use hole punch
  Ocfs2: handle hole punching via fallocate properly
  XFS: handle hole punching via fallocate properly
  fs: add hole punching to fallocate
  vfs: pass struct file to do_truncate on O_TRUNC opens (try #2)
  fix signedness mess in rw_verify_area() on 64bit architectures
  fs: fix kernel-doc for dcache::prepend_path
  fs: fix kernel-doc for dcache::d_validate
  sanitize ecryptfs ->mount()
  switch afs
  move internal-only parts of ncpfs headers to fs/ncpfs
  switch ncpfs
  switch 9p
  pass default dentry_operations to mount_pseudo()
  switch hostfs
  switch affs
  switch configfs
  ...
  • Loading branch information
torvalds committed Jan 13, 2011
2 parents 27d189c + 9242415 commit b2034d4
Show file tree
Hide file tree
Showing 108 changed files with 424 additions and 582 deletions.
9 changes: 9 additions & 0 deletions Documentation/filesystems/porting
Original file line number Diff line number Diff line change
Expand Up @@ -385,3 +385,12 @@ Documentation/filesystems/vfs.txt for more details.
on many or all directory inodes on the way down a path walk (to check for
exec permission). These must now be rcu-walk aware (flags & IPERM_RCU). See
Documentation/filesystems/vfs.txt for more details.

--
[mandatory]
In ->fallocate() you must check the mode option passed in. If your
filesystem does not support hole punching (deallocating space in the middle of a
file) you must return -EOPNOTSUPP if FALLOC_FL_PUNCH_HOLE is set in mode.
Currently you can only have FALLOC_FL_PUNCH_HOLE with FALLOC_FL_KEEP_SIZE set,
so the i_size should not change when hole punching, even when puching the end of
a file off.
2 changes: 1 addition & 1 deletion Documentation/magic-number.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ NBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.h
STL_BOARDMAGIC 0xa2267f52 stlbrd include/linux/stallion.h
ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h
SCI_MAGIC 0xbabeface gs_port drivers/char/sh-sci.h
CODA_MAGIC 0xC0DAC0DA coda_file_info include/linux/coda_fs_i.h
CODA_MAGIC 0xC0DAC0DA coda_file_info fs/coda/coda_fs_i.h
DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h
STLI_PORTMAGIC 0xe671c7a1 stliport include/linux/istallion.h
YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c
Expand Down
6 changes: 4 additions & 2 deletions arch/ia64/kernel/perfmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,14 @@ pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
return get_unmapped_area(file, addr, len, pgoff, flags);
}

/* forward declaration */
static static const struct dentry_operations pfmfs_dentry_operations;

static struct dentry *
pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
{
return mount_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC);
return mount_pseudo(fs_type, "pfm:", NULL, &pfmfs_dentry_operations,
PFMFS_MAGIC);
}

static struct file_system_type pfm_fs_type = {
Expand Down Expand Up @@ -2232,7 +2235,6 @@ pfm_alloc_file(pfm_context_t *ctx)
}
path.mnt = mntget(pfmfs_mnt);

d_set_d_op(path.dentry, &pfmfs_dentry_operations);
d_add(path.dentry, inode);

file = alloc_file(&path, FMODE_READ, &pfm_file_ops);
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ static const struct file_operations mtd_fops = {
static struct dentry *mtd_inodefs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
return mount_pseudo(fs_type, "mtd_inode:", NULL, MTD_INODE_FS_MAGIC);
return mount_pseudo(fs_type, "mtd_inode:", NULL, NULL, MTD_INODE_FS_MAGIC);
}

static struct file_system_type mtd_inodefs_type = {
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/pohmelfs/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ static int pohmelfs_readdir_response(struct netfs_state *st)
if (dentry) {
alias = d_materialise_unique(dentry, &npi->vfs_inode);
if (alias)
dput(dentry);
dput(alias);
}

dput(dentry);
Expand Down
13 changes: 0 additions & 13 deletions drivers/staging/smbfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,6 @@ smb_delete_dentry(const struct dentry *dentry)
void
smb_new_dentry(struct dentry *dentry)
{
struct smb_sb_info *server = server_from_dentry(dentry);

if (server->mnt->flags & SMB_MOUNT_CASE)
d_set_d_op(dentry, &smbfs_dentry_operations_case);
else
d_set_d_op(dentry, &smbfs_dentry_operations);
dentry->d_time = jiffies;
}

Expand Down Expand Up @@ -440,7 +434,6 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
struct smb_fattr finfo;
struct inode *inode;
int error;
struct smb_sb_info *server;

error = -ENAMETOOLONG;
if (dentry->d_name.len > SMB_MAXNAMELEN)
Expand Down Expand Up @@ -468,12 +461,6 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
inode = smb_iget(dir->i_sb, &finfo);
if (inode) {
add_entry:
server = server_from_dentry(dentry);
if (server->mnt->flags & SMB_MOUNT_CASE)
d_set_d_op(dentry, &smbfs_dentry_operations_case);
else
d_set_d_op(dentry, &smbfs_dentry_operations);

d_add(dentry, inode);
smb_renew_times(dentry);
error = 0;
Expand Down
4 changes: 4 additions & 0 deletions drivers/staging/smbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,10 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
printk(KERN_ERR "smbfs: failed to start smbiod\n");
goto out_no_smbiod;
}
if (server->mnt->flags & SMB_MOUNT_CASE)
sb->s_d_op = &smbfs_dentry_operations_case;
else
sb->s_d_op = &smbfs_dentry_operations;

/*
* Keep the super block locked while we get the root inode.
Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/smbfs/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ extern void smb_install_null_ops(struct smb_ops *ops);
extern const struct file_operations smb_dir_operations;
extern const struct inode_operations smb_dir_inode_operations;
extern const struct inode_operations smb_dir_inode_operations_unix;
extern const struct dentry_operations smbfs_dentry_operations_case;
extern const struct dentry_operations smbfs_dentry_operations;
extern void smb_new_dentry(struct dentry *dentry);
extern void smb_renew_times(struct dentry *dentry);
/* cache.c */
Expand Down
1 change: 0 additions & 1 deletion fs/9p/v9fs_vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ void v9fs_stat2inode_dotl(struct p9_stat_dotl *, struct inode *);
int v9fs_dir_release(struct inode *inode, struct file *filp);
int v9fs_file_open(struct inode *inode, struct file *file);
void v9fs_inode2stat(struct inode *inode, struct p9_wstat *stat);
void v9fs_dentry_release(struct dentry *);
int v9fs_uflags2omode(int uflags, int extended);

ssize_t v9fs_file_readn(struct file *, char *, char __user *, u32, u64);
Expand Down
2 changes: 1 addition & 1 deletion fs/9p/vfs_dentry.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static int v9fs_cached_dentry_delete(const struct dentry *dentry)
*
*/

void v9fs_dentry_release(struct dentry *dentry)
static void v9fs_dentry_release(struct dentry *dentry)
{
struct v9fs_dentry *dent;
struct p9_fid *temp, *current_fid;
Expand Down
5 changes: 0 additions & 5 deletions fs/9p/vfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,6 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
goto error_iput;

inst_out:
if (v9ses->cache)
d_set_d_op(dentry, &v9fs_cached_dentry_operations);
else
d_set_d_op(dentry, &v9fs_dentry_operations);

d_add(dentry, inode);
return NULL;

Expand Down
8 changes: 5 additions & 3 deletions fs/9p/vfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
}
v9fs_fill_super(sb, v9ses, flags, data);

if (v9ses->cache)
sb->s_d_op = &v9fs_cached_dentry_operations;
else
sb->s_d_op = &v9fs_dentry_operations;

inode = v9fs_get_inode(sb, S_IFDIR | mode);
if (IS_ERR(inode)) {
retval = PTR_ERR(inode);
Expand Down Expand Up @@ -217,9 +222,6 @@ static void v9fs_kill_super(struct super_block *s)

P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s);

if (s->s_root)
v9fs_dentry_release(s->s_root); /* clunk root */

kill_anon_super(s);

v9fs_session_cancel(v9ses);
Expand Down
1 change: 0 additions & 1 deletion fs/adfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ adfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
struct object_info obj;
int error;

d_set_d_op(dentry, &adfs_dentry_operations);
lock_kernel();
error = adfs_dir_lookup_byname(dir, &dentry->d_name, &obj);
if (error == 0) {
Expand Down
4 changes: 2 additions & 2 deletions fs/adfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
asb->s_namelen = ADFS_F_NAME_LEN;
}

sb->s_d_op = &adfs_dentry_operations;
root = adfs_iget(sb, &root_obj);
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
Expand All @@ -483,8 +484,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
kfree(asb->s_map);
adfs_error(sb, "get root inode failed\n");
goto error;
} else
d_set_d_op(sb->s_root, &adfs_dentry_operations);
}
unlock_kernel();
return 0;

Expand Down
1 change: 1 addition & 0 deletions fs/affs/affs.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ extern const struct address_space_operations affs_aops;
extern const struct address_space_operations affs_aops_ofs;

extern const struct dentry_operations affs_dentry_operations;
extern const struct dentry_operations affs_intl_dentry_operations;

static inline void
affs_set_blocksize(struct super_block *sb, int size)
Expand Down
3 changes: 1 addition & 2 deletions fs/affs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const struct dentry_operations affs_dentry_operations = {
.d_compare = affs_compare_dentry,
};

static const struct dentry_operations affs_intl_dentry_operations = {
const struct dentry_operations affs_intl_dentry_operations = {
.d_hash = affs_intl_hash_dentry,
.d_compare = affs_intl_compare_dentry,
};
Expand Down Expand Up @@ -240,7 +240,6 @@ affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
if (IS_ERR(inode))
return ERR_CAST(inode);
}
d_set_d_op(dentry, AFFS_SB(sb)->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations);
d_add(dentry, inode);
return NULL;
}
Expand Down
6 changes: 5 additions & 1 deletion fs/affs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,16 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
goto out_error_noinode;
}

if (AFFS_SB(sb)->s_flags & SF_INTL)
sb->s_d_op = &affs_intl_dentry_operations;
else
sb->s_d_op = &affs_dentry_operations;

sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root) {
printk(KERN_ERR "AFFS: Get root inode failed\n");
goto out_error;
}
d_set_d_op(sb->s_root, &affs_dentry_operations);

pr_debug("AFFS: s_flags=%lX\n",sb->s_flags);
return 0;
Expand Down
4 changes: 1 addition & 3 deletions fs/afs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const struct inode_operations afs_dir_inode_operations = {
.setattr = afs_setattr,
};

static const struct dentry_operations afs_fs_dentry_operations = {
const struct dentry_operations afs_fs_dentry_operations = {
.d_revalidate = afs_d_revalidate,
.d_delete = afs_d_delete,
.d_release = afs_d_release,
Expand Down Expand Up @@ -582,8 +582,6 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
}

success:
d_set_d_op(dentry, &afs_fs_dentry_operations);

d_add(dentry, inode);
_leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%llu }",
fid.vnode,
Expand Down
1 change: 1 addition & 0 deletions fs/afs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ extern bool afs_cm_incoming_call(struct afs_call *);
* dir.c
*/
extern const struct inode_operations afs_dir_inode_operations;
extern const struct dentry_operations afs_fs_dentry_operations;
extern const struct file_operations afs_dir_file_operations;

/*
Expand Down
1 change: 1 addition & 0 deletions fs/afs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ static int afs_fill_super(struct super_block *sb, void *data)
if (!root)
goto error;

sb->s_d_op = &afs_fs_dentry_operations;
sb->s_root = root;

_leave(" = 0");
Expand Down
21 changes: 11 additions & 10 deletions fs/anon_inodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ static struct vfsmount *anon_inode_mnt __read_mostly;
static struct inode *anon_inode_inode;
static const struct file_operations anon_inode_fops;

static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
return mount_pseudo(fs_type, "anon_inode:", NULL, ANON_INODE_FS_MAGIC);
}

/*
* anon_inodefs_dname() is called from d_path().
*/
Expand All @@ -41,14 +35,22 @@ static char *anon_inodefs_dname(struct dentry *dentry, char *buffer, int buflen)
dentry->d_name.name);
}

static const struct dentry_operations anon_inodefs_dentry_operations = {
.d_dname = anon_inodefs_dname,
};

static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
return mount_pseudo(fs_type, "anon_inode:", NULL,
&anon_inodefs_dentry_operations, ANON_INODE_FS_MAGIC);
}

static struct file_system_type anon_inode_fs_type = {
.name = "anon_inodefs",
.mount = anon_inodefs_mount,
.kill_sb = kill_anon_super,
};
static const struct dentry_operations anon_inodefs_dentry_operations = {
.d_dname = anon_inodefs_dname,
};

/*
* nop .set_page_dirty method so that people can use .page_mkwrite on
Expand Down Expand Up @@ -113,7 +115,6 @@ struct file *anon_inode_getfile(const char *name,
*/
ihold(anon_inode_inode);

d_set_d_op(path.dentry, &anon_inodefs_dentry_operations);
d_instantiate(path.dentry, anon_inode_inode);

error = -ENFILE;
Expand Down
2 changes: 1 addition & 1 deletion fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ static const struct super_operations bdev_sops = {
static struct dentry *bd_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
return mount_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576);
return mount_pseudo(fs_type, "bdev:", &bdev_sops, NULL, 0x62646576);
}

static struct file_system_type bd_type = {
Expand Down
12 changes: 2 additions & 10 deletions fs/btrfs/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
{
struct btrfs_fs_info *fs_info = btrfs_sb(sb)->fs_info;
struct btrfs_root *root;
struct dentry *dentry;
struct inode *inode;
struct btrfs_key key;
int index;
Expand Down Expand Up @@ -108,10 +107,7 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
return ERR_PTR(-ESTALE);
}

dentry = d_obtain_alias(inode);
if (!IS_ERR(dentry))
d_set_d_op(dentry, &btrfs_dentry_operations);
return dentry;
return d_obtain_alias(inode);
fail:
srcu_read_unlock(&fs_info->subvol_srcu, index);
return ERR_PTR(err);
Expand Down Expand Up @@ -166,7 +162,6 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
static struct dentry *btrfs_get_parent(struct dentry *child)
{
struct inode *dir = child->d_inode;
struct dentry *dentry;
struct btrfs_root *root = BTRFS_I(dir)->root;
struct btrfs_path *path;
struct extent_buffer *leaf;
Expand Down Expand Up @@ -223,10 +218,7 @@ static struct dentry *btrfs_get_parent(struct dentry *child)

key.type = BTRFS_INODE_ITEM_KEY;
key.offset = 0;
dentry = d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL));
if (!IS_ERR(dentry))
d_set_d_op(dentry, &btrfs_dentry_operations);
return dentry;
return d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL));
fail:
btrfs_free_path(path);
return ERR_PTR(ret);
Expand Down
6 changes: 4 additions & 2 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4084,8 +4084,6 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
int index;
int ret;

d_set_d_op(dentry, &btrfs_dentry_operations);

if (dentry->d_name.len > BTRFS_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);

Expand Down Expand Up @@ -7117,6 +7115,10 @@ static long btrfs_fallocate(struct inode *inode, int mode,
alloc_start = offset & ~mask;
alloc_end = (offset + len + mask) & ~mask;

/* We only support the FALLOC_FL_KEEP_SIZE mode */
if (mode && (mode != FALLOC_FL_KEEP_SIZE))
return -EOPNOTSUPP;

/*
* wait for ordered IO before we have any locks. We'll loop again
* below with the locks held.
Expand Down
1 change: 1 addition & 0 deletions fs/btrfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ static int btrfs_fill_super(struct super_block *sb,
sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_magic = BTRFS_SUPER_MAGIC;
sb->s_op = &btrfs_super_ops;
sb->s_d_op = &btrfs_dentry_operations;
sb->s_export_op = &btrfs_export_ops;
sb->s_xattr = btrfs_xattr_handlers;
sb->s_time_gran = 1;
Expand Down
Loading

0 comments on commit b2034d4

Please sign in to comment.