Commit bd907413 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull misc vfs updates from Al Viro:
 "misc pile"

* tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  fs: sysv: Fix sysv_nblocks() returns wrong value
  get rid of INT_LIMIT, use type_max() instead
  btrfs: replace INT_LIMIT(loff_t) with OFFSET_MAX
  fs: simplify vfs_get_super
  fs: drop useless condition from inode_needs_update_time
parents 13c574fe e0c49bd2
...@@ -562,17 +562,6 @@ or looking up of superblocks. ...@@ -562,17 +562,6 @@ or looking up of superblocks.
The following helpers all wrap sget_fc(): The following helpers all wrap sget_fc():
* ::
int vfs_get_super(struct fs_context *fc,
enum vfs_get_super_keying keying,
int (*fill_super)(struct super_block *sb,
struct fs_context *fc))
This creates/looks up a deviceless superblock. The keying indicates how
many superblocks of this type may exist and in what manner they may be
shared:
(1) vfs_get_single_super (1) vfs_get_single_super
Only one such superblock may exist in the system. Any further Only one such superblock may exist in the system. Any further
......
...@@ -761,11 +761,11 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len) ...@@ -761,11 +761,11 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
struct btrfs_ordered_extent *ordered; struct btrfs_ordered_extent *ordered;
if (start + len < start) { if (start + len < start) {
orig_end = INT_LIMIT(loff_t); orig_end = OFFSET_MAX;
} else { } else {
orig_end = start + len - 1; orig_end = start + len - 1;
if (orig_end > INT_LIMIT(loff_t)) if (orig_end > OFFSET_MAX)
orig_end = INT_LIMIT(loff_t); orig_end = OFFSET_MAX;
} }
/* start IO across the range first to instantiate any delalloc /* start IO across the range first to instantiate any delalloc
......
...@@ -2071,9 +2071,6 @@ static int inode_needs_update_time(struct inode *inode, struct timespec64 *now) ...@@ -2071,9 +2071,6 @@ static int inode_needs_update_time(struct inode *inode, struct timespec64 *now)
if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode)) if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode))
sync_it |= S_VERSION; sync_it |= S_VERSION;
if (!sync_it)
return 0;
return sync_it; return sync_it;
} }
......
...@@ -1112,55 +1112,14 @@ static int test_single_super(struct super_block *s, struct fs_context *fc) ...@@ -1112,55 +1112,14 @@ static int test_single_super(struct super_block *s, struct fs_context *fc)
return 1; return 1;
} }
/** static int vfs_get_super(struct fs_context *fc, bool reconf,
* vfs_get_super - Get a superblock with a search key set in s_fs_info. int (*test)(struct super_block *, struct fs_context *),
* @fc: The filesystem context holding the parameters int (*fill_super)(struct super_block *sb,
* @keying: How to distinguish superblocks struct fs_context *fc))
* @fill_super: Helper to initialise a new superblock
*
* Search for a superblock and create a new one if not found. The search
* criterion is controlled by @keying. If the search fails, a new superblock
* is created and @fill_super() is called to initialise it.
*
* @keying can take one of a number of values:
*
* (1) vfs_get_single_super - Only one superblock of this type may exist on the
* system. This is typically used for special system filesystems.
*
* (2) vfs_get_keyed_super - Multiple superblocks may exist, but they must have
* distinct keys (where the key is in s_fs_info). Searching for the same
* key again will turn up the superblock for that key.
*
* (3) vfs_get_independent_super - Multiple superblocks may exist and are
* unkeyed. Each call will get a new superblock.
*
* A permissions check is made by sget_fc() unless we're getting a superblock
* for a kernel-internal mount or a submount.
*/
int vfs_get_super(struct fs_context *fc,
enum vfs_get_super_keying keying,
int (*fill_super)(struct super_block *sb,
struct fs_context *fc))
{ {
int (*test)(struct super_block *, struct fs_context *);
struct super_block *sb; struct super_block *sb;
int err; int err;
switch (keying) {
case vfs_get_single_super:
case vfs_get_single_reconf_super:
test = test_single_super;
break;
case vfs_get_keyed_super:
test = test_keyed_super;
break;
case vfs_get_independent_super:
test = NULL;
break;
default:
BUG();
}
sb = sget_fc(fc, test, set_anon_super_fc); sb = sget_fc(fc, test, set_anon_super_fc);
if (IS_ERR(sb)) if (IS_ERR(sb))
return PTR_ERR(sb); return PTR_ERR(sb);
...@@ -1174,7 +1133,7 @@ int vfs_get_super(struct fs_context *fc, ...@@ -1174,7 +1133,7 @@ int vfs_get_super(struct fs_context *fc,
fc->root = dget(sb->s_root); fc->root = dget(sb->s_root);
} else { } else {
fc->root = dget(sb->s_root); fc->root = dget(sb->s_root);
if (keying == vfs_get_single_reconf_super) { if (reconf) {
err = reconfigure_super(fc); err = reconfigure_super(fc);
if (err < 0) { if (err < 0) {
dput(fc->root); dput(fc->root);
...@@ -1190,13 +1149,12 @@ int vfs_get_super(struct fs_context *fc, ...@@ -1190,13 +1149,12 @@ int vfs_get_super(struct fs_context *fc,
deactivate_locked_super(sb); deactivate_locked_super(sb);
return err; return err;
} }
EXPORT_SYMBOL(vfs_get_super);
int get_tree_nodev(struct fs_context *fc, int get_tree_nodev(struct fs_context *fc,
int (*fill_super)(struct super_block *sb, int (*fill_super)(struct super_block *sb,
struct fs_context *fc)) struct fs_context *fc))
{ {
return vfs_get_super(fc, vfs_get_independent_super, fill_super); return vfs_get_super(fc, false, NULL, fill_super);
} }
EXPORT_SYMBOL(get_tree_nodev); EXPORT_SYMBOL(get_tree_nodev);
...@@ -1204,7 +1162,7 @@ int get_tree_single(struct fs_context *fc, ...@@ -1204,7 +1162,7 @@ int get_tree_single(struct fs_context *fc,
int (*fill_super)(struct super_block *sb, int (*fill_super)(struct super_block *sb,
struct fs_context *fc)) struct fs_context *fc))
{ {
return vfs_get_super(fc, vfs_get_single_super, fill_super); return vfs_get_super(fc, false, test_single_super, fill_super);
} }
EXPORT_SYMBOL(get_tree_single); EXPORT_SYMBOL(get_tree_single);
...@@ -1212,7 +1170,7 @@ int get_tree_single_reconf(struct fs_context *fc, ...@@ -1212,7 +1170,7 @@ int get_tree_single_reconf(struct fs_context *fc,
int (*fill_super)(struct super_block *sb, int (*fill_super)(struct super_block *sb,
struct fs_context *fc)) struct fs_context *fc))
{ {
return vfs_get_super(fc, vfs_get_single_reconf_super, fill_super); return vfs_get_super(fc, true, test_single_super, fill_super);
} }
EXPORT_SYMBOL(get_tree_single_reconf); EXPORT_SYMBOL(get_tree_single_reconf);
...@@ -1222,7 +1180,7 @@ int get_tree_keyed(struct fs_context *fc, ...@@ -1222,7 +1180,7 @@ int get_tree_keyed(struct fs_context *fc,
void *key) void *key)
{ {
fc->s_fs_info = key; fc->s_fs_info = key;
return vfs_get_super(fc, vfs_get_keyed_super, fill_super); return vfs_get_super(fc, false, test_keyed_super, fill_super);
} }
EXPORT_SYMBOL(get_tree_keyed); EXPORT_SYMBOL(get_tree_keyed);
......
...@@ -438,7 +438,7 @@ static unsigned sysv_nblocks(struct super_block *s, loff_t size) ...@@ -438,7 +438,7 @@ static unsigned sysv_nblocks(struct super_block *s, loff_t size)
res += blocks; res += blocks;
direct = 1; direct = 1;
} }
return blocks; return res;
} }
int sysv_getattr(struct user_namespace *mnt_userns, const struct path *path, int sysv_getattr(struct user_namespace *mnt_userns, const struct path *path,
......
...@@ -1131,9 +1131,8 @@ struct file_lock_context { ...@@ -1131,9 +1131,8 @@ struct file_lock_context {
/* The following constant reflects the upper bound of the file/locking space */ /* The following constant reflects the upper bound of the file/locking space */
#ifndef OFFSET_MAX #ifndef OFFSET_MAX
#define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1))) #define OFFSET_MAX type_max(loff_t)
#define OFFSET_MAX INT_LIMIT(loff_t) #define OFFT_OFFSET_MAX type_max(off_t)
#define OFFT_OFFSET_MAX INT_LIMIT(off_t)
#endif #endif
extern void send_sigio(struct fown_struct *fown, int fd, int band); extern void send_sigio(struct fown_struct *fown, int fd, int band);
......
...@@ -145,20 +145,6 @@ extern void fc_drop_locked(struct fs_context *fc); ...@@ -145,20 +145,6 @@ extern void fc_drop_locked(struct fs_context *fc);
int reconfigure_single(struct super_block *s, int reconfigure_single(struct super_block *s,
int flags, void *data); int flags, void *data);
/*
* sget() wrappers to be called from the ->get_tree() op.
*/
enum vfs_get_super_keying {
vfs_get_single_super, /* Only one such superblock may exist */
vfs_get_single_reconf_super, /* As above, but reconfigure if it exists */
vfs_get_keyed_super, /* Superblocks with different s_fs_info keys may exist */
vfs_get_independent_super, /* Multiple independent superblocks may exist */
};
extern int vfs_get_super(struct fs_context *fc,
enum vfs_get_super_keying keying,
int (*fill_super)(struct super_block *sb,
struct fs_context *fc));
extern int get_tree_nodev(struct fs_context *fc, extern int get_tree_nodev(struct fs_context *fc,
int (*fill_super)(struct super_block *sb, int (*fill_super)(struct super_block *sb,
struct fs_context *fc)); struct fs_context *fc));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment