Merge branches 'work.misc' and 'work.dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc vfs updates from Al Viro: "Misc cleanups from various folks all over the place I expected more fs/dcache.c cleanups this cycle, so that went into a separate branch. Said cleanups have missed the window, so in the hindsight it could've gone into work.misc instead. Decided not to cherry-pick, thus the 'work.dcache' branch" * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs: dcache: Use true and false for boolean values fold generic_readlink() into its only caller fs: shave 8 bytes off of struct inode fs: Add more kernel-doc to the produced documentation fs: Fix attr.c kernel-doc removed extra extern file_fdatawait_range * 'work.dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: kill dentry_update_name_case()
This commit is contained in:
commit
4591343e35
@ -71,6 +71,39 @@ Other Functions
|
|||||||
.. kernel-doc:: fs/block_dev.c
|
.. kernel-doc:: fs/block_dev.c
|
||||||
:export:
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/anon_inodes.c
|
||||||
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/attr.c
|
||||||
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/d_path.c
|
||||||
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/dax.c
|
||||||
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/direct-io.c
|
||||||
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/file_table.c
|
||||||
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/libfs.c
|
||||||
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/posix_acl.c
|
||||||
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/stat.c
|
||||||
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/sync.c
|
||||||
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: fs/xattr.c
|
||||||
|
:export:
|
||||||
|
|
||||||
The proc filesystem
|
The proc filesystem
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
@ -120,7 +120,6 @@ EXPORT_SYMBOL(setattr_prepare);
|
|||||||
* inode_newsize_ok - may this inode be truncated to a given size
|
* inode_newsize_ok - may this inode be truncated to a given size
|
||||||
* @inode: the inode to be truncated
|
* @inode: the inode to be truncated
|
||||||
* @offset: the new size to assign to the inode
|
* @offset: the new size to assign to the inode
|
||||||
* @Returns: 0 on success, -ve errno on failure
|
|
||||||
*
|
*
|
||||||
* inode_newsize_ok must be called with i_mutex held.
|
* inode_newsize_ok must be called with i_mutex held.
|
||||||
*
|
*
|
||||||
@ -130,6 +129,8 @@ EXPORT_SYMBOL(setattr_prepare);
|
|||||||
* returned. @inode must be a file (not directory), with appropriate
|
* returned. @inode must be a file (not directory), with appropriate
|
||||||
* permissions to allow truncate (inode_newsize_ok does NOT check these
|
* permissions to allow truncate (inode_newsize_ok does NOT check these
|
||||||
* conditions).
|
* conditions).
|
||||||
|
*
|
||||||
|
* Return: 0 on success, -ve errno on failure
|
||||||
*/
|
*/
|
||||||
int inode_newsize_ok(const struct inode *inode, loff_t offset)
|
int inode_newsize_ok(const struct inode *inode, loff_t offset)
|
||||||
{
|
{
|
||||||
@ -205,7 +206,7 @@ EXPORT_SYMBOL(setattr_copy);
|
|||||||
/**
|
/**
|
||||||
* notify_change - modify attributes of a filesytem object
|
* notify_change - modify attributes of a filesytem object
|
||||||
* @dentry: object affected
|
* @dentry: object affected
|
||||||
* @iattr: new attributes
|
* @attr: new attributes
|
||||||
* @delegated_inode: returns inode, if the inode is delegated
|
* @delegated_inode: returns inode, if the inode is delegated
|
||||||
*
|
*
|
||||||
* The caller must hold the i_mutex on the affected object.
|
* The caller must hold the i_mutex on the affected object.
|
||||||
|
39
fs/dcache.c
39
fs/dcache.c
@ -729,16 +729,16 @@ static inline bool fast_dput(struct dentry *dentry)
|
|||||||
if (dentry->d_lockref.count > 1) {
|
if (dentry->d_lockref.count > 1) {
|
||||||
dentry->d_lockref.count--;
|
dentry->d_lockref.count--;
|
||||||
spin_unlock(&dentry->d_lock);
|
spin_unlock(&dentry->d_lock);
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we weren't the last ref, we're done.
|
* If we weren't the last ref, we're done.
|
||||||
*/
|
*/
|
||||||
if (ret)
|
if (ret)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Careful, careful. The reference count went down
|
* Careful, careful. The reference count went down
|
||||||
@ -767,7 +767,7 @@ static inline bool fast_dput(struct dentry *dentry)
|
|||||||
|
|
||||||
/* Nothing to do? Dropping the reference was all we needed? */
|
/* Nothing to do? Dropping the reference was all we needed? */
|
||||||
if (d_flags == (DCACHE_REFERENCED | DCACHE_LRU_LIST) && !d_unhashed(dentry))
|
if (d_flags == (DCACHE_REFERENCED | DCACHE_LRU_LIST) && !d_unhashed(dentry))
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Not the fast normal case? Get the lock. We've already decremented
|
* Not the fast normal case? Get the lock. We've already decremented
|
||||||
@ -784,7 +784,7 @@ static inline bool fast_dput(struct dentry *dentry)
|
|||||||
*/
|
*/
|
||||||
if (dentry->d_lockref.count) {
|
if (dentry->d_lockref.count) {
|
||||||
spin_unlock(&dentry->d_lock);
|
spin_unlock(&dentry->d_lock);
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -793,7 +793,7 @@ static inline bool fast_dput(struct dentry *dentry)
|
|||||||
* set it to 1.
|
* set it to 1.
|
||||||
*/
|
*/
|
||||||
dentry->d_lockref.count = 1;
|
dentry->d_lockref.count = 1;
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2648,33 +2648,6 @@ struct dentry *d_exact_alias(struct dentry *entry, struct inode *inode)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(d_exact_alias);
|
EXPORT_SYMBOL(d_exact_alias);
|
||||||
|
|
||||||
/**
|
|
||||||
* dentry_update_name_case - update case insensitive dentry with a new name
|
|
||||||
* @dentry: dentry to be updated
|
|
||||||
* @name: new name
|
|
||||||
*
|
|
||||||
* Update a case insensitive dentry with new case of name.
|
|
||||||
*
|
|
||||||
* dentry must have been returned by d_lookup with name @name. Old and new
|
|
||||||
* name lengths must match (ie. no d_compare which allows mismatched name
|
|
||||||
* lengths).
|
|
||||||
*
|
|
||||||
* Parent inode i_mutex must be held over d_lookup and into this call (to
|
|
||||||
* keep renames and concurrent inserts, and readdir(2) away).
|
|
||||||
*/
|
|
||||||
void dentry_update_name_case(struct dentry *dentry, const struct qstr *name)
|
|
||||||
{
|
|
||||||
BUG_ON(!inode_is_locked(dentry->d_parent->d_inode));
|
|
||||||
BUG_ON(dentry->d_name.len != name->len); /* d_lookup gives this */
|
|
||||||
|
|
||||||
spin_lock(&dentry->d_lock);
|
|
||||||
write_seqcount_begin(&dentry->d_seq);
|
|
||||||
memcpy((unsigned char *)dentry->d_name.name, name->name, name->len);
|
|
||||||
write_seqcount_end(&dentry->d_seq);
|
|
||||||
spin_unlock(&dentry->d_lock);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(dentry_update_name_case);
|
|
||||||
|
|
||||||
static void swap_names(struct dentry *dentry, struct dentry *target)
|
static void swap_names(struct dentry *dentry, struct dentry *target)
|
||||||
{
|
{
|
||||||
if (unlikely(dname_external(target))) {
|
if (unlikely(dname_external(target))) {
|
||||||
|
36
fs/namei.c
36
fs/namei.c
@ -4655,29 +4655,6 @@ out:
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* A helper for ->readlink(). This should be used *ONLY* for symlinks that
|
|
||||||
* have ->get_link() not calling nd_jump_link(). Using (or not using) it
|
|
||||||
* for any given inode is up to filesystem.
|
|
||||||
*/
|
|
||||||
static int generic_readlink(struct dentry *dentry, char __user *buffer,
|
|
||||||
int buflen)
|
|
||||||
{
|
|
||||||
DEFINE_DELAYED_CALL(done);
|
|
||||||
struct inode *inode = d_inode(dentry);
|
|
||||||
const char *link = inode->i_link;
|
|
||||||
int res;
|
|
||||||
|
|
||||||
if (!link) {
|
|
||||||
link = inode->i_op->get_link(dentry, inode, &done);
|
|
||||||
if (IS_ERR(link))
|
|
||||||
return PTR_ERR(link);
|
|
||||||
}
|
|
||||||
res = readlink_copy(buffer, buflen, link);
|
|
||||||
do_delayed_call(&done);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vfs_readlink - copy symlink body into userspace buffer
|
* vfs_readlink - copy symlink body into userspace buffer
|
||||||
* @dentry: dentry on which to get symbolic link
|
* @dentry: dentry on which to get symbolic link
|
||||||
@ -4691,6 +4668,9 @@ static int generic_readlink(struct dentry *dentry, char __user *buffer,
|
|||||||
int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
|
int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
|
||||||
{
|
{
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
|
DEFINE_DELAYED_CALL(done);
|
||||||
|
const char *link;
|
||||||
|
int res;
|
||||||
|
|
||||||
if (unlikely(!(inode->i_opflags & IOP_DEFAULT_READLINK))) {
|
if (unlikely(!(inode->i_opflags & IOP_DEFAULT_READLINK))) {
|
||||||
if (unlikely(inode->i_op->readlink))
|
if (unlikely(inode->i_op->readlink))
|
||||||
@ -4704,7 +4684,15 @@ int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
|
|||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
return generic_readlink(dentry, buffer, buflen);
|
link = inode->i_link;
|
||||||
|
if (!link) {
|
||||||
|
link = inode->i_op->get_link(dentry, inode, &done);
|
||||||
|
if (IS_ERR(link))
|
||||||
|
return PTR_ERR(link);
|
||||||
|
}
|
||||||
|
res = readlink_copy(buffer, buflen, link);
|
||||||
|
do_delayed_call(&done);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(vfs_readlink);
|
EXPORT_SYMBOL(vfs_readlink);
|
||||||
|
|
||||||
|
@ -270,8 +270,6 @@ extern void d_rehash(struct dentry *);
|
|||||||
|
|
||||||
extern void d_add(struct dentry *, struct inode *);
|
extern void d_add(struct dentry *, struct inode *);
|
||||||
|
|
||||||
extern void dentry_update_name_case(struct dentry *, const struct qstr *);
|
|
||||||
|
|
||||||
/* used for rename() and baskets */
|
/* used for rename() and baskets */
|
||||||
extern void d_move(struct dentry *, struct dentry *);
|
extern void d_move(struct dentry *, struct dentry *);
|
||||||
extern void d_exchange(struct dentry *, struct dentry *);
|
extern void d_exchange(struct dentry *, struct dentry *);
|
||||||
|
@ -278,6 +278,7 @@ struct writeback_control;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Write life time hint values.
|
* Write life time hint values.
|
||||||
|
* Stored in struct inode as u8.
|
||||||
*/
|
*/
|
||||||
enum rw_hint {
|
enum rw_hint {
|
||||||
WRITE_LIFE_NOT_SET = 0,
|
WRITE_LIFE_NOT_SET = 0,
|
||||||
@ -612,8 +613,8 @@ struct inode {
|
|||||||
struct timespec64 i_ctime;
|
struct timespec64 i_ctime;
|
||||||
spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
|
spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
|
||||||
unsigned short i_bytes;
|
unsigned short i_bytes;
|
||||||
unsigned int i_blkbits;
|
u8 i_blkbits;
|
||||||
enum rw_hint i_write_hint;
|
u8 i_write_hint;
|
||||||
blkcnt_t i_blocks;
|
blkcnt_t i_blocks;
|
||||||
|
|
||||||
#ifdef __NEED_I_SIZE_ORDERED
|
#ifdef __NEED_I_SIZE_ORDERED
|
||||||
@ -2637,8 +2638,6 @@ static inline int filemap_fdatawait(struct address_space *mapping)
|
|||||||
|
|
||||||
extern bool filemap_range_has_page(struct address_space *, loff_t lstart,
|
extern bool filemap_range_has_page(struct address_space *, loff_t lstart,
|
||||||
loff_t lend);
|
loff_t lend);
|
||||||
extern int __must_check file_fdatawait_range(struct file *file, loff_t lstart,
|
|
||||||
loff_t lend);
|
|
||||||
extern int filemap_write_and_wait(struct address_space *mapping);
|
extern int filemap_write_and_wait(struct address_space *mapping);
|
||||||
extern int filemap_write_and_wait_range(struct address_space *mapping,
|
extern int filemap_write_and_wait_range(struct address_space *mapping,
|
||||||
loff_t lstart, loff_t lend);
|
loff_t lstart, loff_t lend);
|
||||||
|
Loading…
Reference in New Issue
Block a user