Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull VFS updates from Al Viro,

Misc cleanups all over the place, mainly wrt /proc interfaces (switch
create_proc_entry to proc_create(), get rid of the deprecated
create_proc_read_entry() in favor of using proc_create_data() and
seq_file etc).

7kloc removed.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits)
  don't bother with deferred freeing of fdtables
  proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
  proc: Make the PROC_I() and PDE() macros internal to procfs
  proc: Supply a function to remove a proc entry by PDE
  take cgroup_open() and cpuset_open() to fs/proc/base.c
  ppc: Clean up scanlog
  ppc: Clean up rtas_flash driver somewhat
  hostap: proc: Use remove_proc_subtree()
  drm: proc: Use remove_proc_subtree()
  drm: proc: Use minor->index to label things, not PDE->name
  drm: Constify drm_proc_list[]
  zoran: Don't print proc_dir_entry data in debug
  reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show()
  proc: Supply an accessor for getting the data from a PDE's parent
  airo: Use remove_proc_subtree()
  rtl8192u: Don't need to save device proc dir PDE
  rtl8187se: Use a dir under /proc/net/r8180/
  proc: Add proc_mkdir_data()
  proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h}
  proc: Move PDE_NET() to fs/proc/proc_net.c
  ...
This commit is contained in:
Linus Torvalds 2013-05-01 17:51:54 -07:00
commit 20b4fb4852
385 changed files with 7396 additions and 14540 deletions

View file

@ -234,68 +234,9 @@ int reiserfs_commit_page(struct inode *inode, struct page *page,
return ret;
}
/* Write @count bytes at position @ppos in a file indicated by @file
from the buffer @buf.
generic_file_write() is only appropriate for filesystems that are not seeking to optimize performance and want
something simple that works. It is not for serious use by general purpose filesystems, excepting the one that it was
written for (ext2/3). This is for several reasons:
* It has no understanding of any filesystem specific optimizations.
* It enters the filesystem repeatedly for each page that is written.
* It depends on reiserfs_get_block() function which if implemented by reiserfs performs costly search_by_key
* operation for each page it is supplied with. By contrast reiserfs_file_write() feeds as much as possible at a time
* to reiserfs which allows for fewer tree traversals.
* Each indirect pointer insertion takes a lot of cpu, because it involves memory moves inside of blocks.
* Asking the block allocation code for blocks one at a time is slightly less efficient.
All of these reasons for not using only generic file write were understood back when reiserfs was first miscoded to
use it, but we were in a hurry to make code freeze, and so it couldn't be revised then. This new code should make
things right finally.
Future Features: providing search_by_key with hints.
*/
static ssize_t reiserfs_file_write(struct file *file, /* the file we are going to write into */
const char __user * buf, /* pointer to user supplied data
(in userspace) */
size_t count, /* amount of bytes to write */
loff_t * ppos /* pointer to position in file that we start writing at. Should be updated to
* new current position before returning. */
)
{
struct inode *inode = file_inode(file); // Inode of the file that we are writing to.
/* To simplify coding at this time, we store
locked pages in array for now */
struct reiserfs_transaction_handle th;
th.t_trans_id = 0;
/* If a filesystem is converted from 3.5 to 3.6, we'll have v3.5 items
* lying around (most of the disk, in fact). Despite the filesystem
* now being a v3.6 format, the old items still can't support large
* file sizes. Catch this case here, as the rest of the VFS layer is
* oblivious to the different limitations between old and new items.
* reiserfs_setattr catches this for truncates. This chunk is lifted
* from generic_write_checks. */
if (get_inode_item_key_version (inode) == KEY_FORMAT_3_5 &&
*ppos + count > MAX_NON_LFS) {
if (*ppos >= MAX_NON_LFS) {
return -EFBIG;
}
if (count > MAX_NON_LFS - (unsigned long)*ppos)
count = MAX_NON_LFS - (unsigned long)*ppos;
}
return do_sync_write(file, buf, count, ppos);
}
const struct file_operations reiserfs_file_operations = {
.read = do_sync_read,
.write = reiserfs_file_write,
.write = do_sync_write,
.unlocked_ioctl = reiserfs_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = reiserfs_compat_ioctl,

View file

@ -394,20 +394,24 @@ static int set_sb(struct super_block *sb, void *data)
return -ENOENT;
}
struct reiserfs_seq_private {
struct super_block *sb;
int (*show) (struct seq_file *, struct super_block *);
};
static void *r_start(struct seq_file *m, loff_t * pos)
{
struct proc_dir_entry *de = m->private;
struct super_block *s = de->parent->data;
struct reiserfs_seq_private *priv = m->private;
loff_t l = *pos;
if (l)
return NULL;
if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, s)))
if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb)))
return NULL;
up_write(&s->s_umount);
return s;
up_write(&priv->sb->s_umount);
return priv->sb;
}
static void *r_next(struct seq_file *m, void *v, loff_t * pos)
@ -426,9 +430,8 @@ static void r_stop(struct seq_file *m, void *v)
static int r_show(struct seq_file *m, void *v)
{
struct proc_dir_entry *de = m->private;
int (*show) (struct seq_file *, struct super_block *) = de->data;
return show(m, v);
struct reiserfs_seq_private *priv = m->private;
return priv->show(m, v);
}
static const struct seq_operations r_ops = {
@ -440,11 +443,15 @@ static const struct seq_operations r_ops = {
static int r_open(struct inode *inode, struct file *file)
{
int ret = seq_open(file, &r_ops);
struct reiserfs_seq_private *priv;
int ret = seq_open_private(file, &r_ops,
sizeof(struct reiserfs_seq_private));
if (!ret) {
struct seq_file *m = file->private_data;
m->private = PDE(inode);
priv = m->private;
priv->sb = proc_get_parent_data(inode);
priv->show = PDE_DATA(inode);
}
return ret;
}
@ -453,7 +460,7 @@ static const struct file_operations r_file_operations = {
.open = r_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
.release = seq_release_private,
.owner = THIS_MODULE,
};
@ -479,9 +486,8 @@ int reiserfs_proc_info_init(struct super_block *sb)
*s = '!';
spin_lock_init(&__PINFO(sb).lock);
REISERFS_SB(sb)->procdir = proc_mkdir(b, proc_info_root);
REISERFS_SB(sb)->procdir = proc_mkdir_data(b, 0, proc_info_root, sb);
if (REISERFS_SB(sb)->procdir) {
REISERFS_SB(sb)->procdir->data = sb;
add_file(sb, "version", show_version);
add_file(sb, "super", show_super);
add_file(sb, "per-level", show_per_level);
@ -499,29 +505,17 @@ int reiserfs_proc_info_init(struct super_block *sb)
int reiserfs_proc_info_done(struct super_block *sb)
{
struct proc_dir_entry *de = REISERFS_SB(sb)->procdir;
char b[BDEVNAME_SIZE];
char *s;
/* Some block devices use /'s */
strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE);
s = strchr(b, '/');
if (s)
*s = '!';
if (de) {
remove_proc_entry("journal", de);
remove_proc_entry("oidmap", de);
remove_proc_entry("on-disk-super", de);
remove_proc_entry("bitmap", de);
remove_proc_entry("per-level", de);
remove_proc_entry("super", de);
remove_proc_entry("version", de);
}
spin_lock(&__PINFO(sb).lock);
__PINFO(sb).exiting = 1;
spin_unlock(&__PINFO(sb).lock);
if (proc_info_root) {
remove_proc_entry(b, proc_info_root);
char b[BDEVNAME_SIZE];
char *s;
/* Some block devices use /'s */
strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE);
s = strchr(b, '/');
if (s)
*s = '!';
remove_proc_subtree(b, proc_info_root);
REISERFS_SB(sb)->procdir = NULL;
}
return 0;