You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: remove detritus left by "mm: make read_cache_page synchronous" fix fs/sysv s_dirt handling fat: convert to use the new truncate convention. ext2: convert to use the new truncate convention. tmpfs: convert to use the new truncate convention fs: convert simple fs to new truncate kill spurious reference to vmtruncate fs: introduce new truncate sequence fs/super: fix kernel-doc warning fs/minix: bugfix, number of indirect block ptrs per block depends on block size rename the generic fsync implementations drop unused dentry argument to ->fsync fs: Add missing mutex_unlock Fix racy use of anon_inode_getfd() in perf_event.c get rid of the magic around f_count in aio VFS: fix recent breakage of FS_REVAL_DOT Revert "anon_inode: set S_IFREG on the anon_inode"
This commit is contained in:
@@ -380,7 +380,7 @@ prototypes:
|
||||
int (*open) (struct inode *, struct file *);
|
||||
int (*flush) (struct file *);
|
||||
int (*release) (struct inode *, struct file *);
|
||||
int (*fsync) (struct file *, struct dentry *, int datasync);
|
||||
int (*fsync) (struct file *, int datasync);
|
||||
int (*aio_fsync) (struct kiocb *, int datasync);
|
||||
int (*fasync) (int, struct file *, int);
|
||||
int (*lock) (struct file *, int, struct file_lock *);
|
||||
|
||||
@@ -401,11 +401,16 @@ otherwise noted.
|
||||
started might not be in the page cache at the end of the
|
||||
walk).
|
||||
|
||||
truncate: called by the VFS to change the size of a file. The
|
||||
truncate: Deprecated. This will not be called if ->setsize is defined.
|
||||
Called by the VFS to change the size of a file. The
|
||||
i_size field of the inode is set to the desired size by the
|
||||
VFS before this method is called. This method is called by
|
||||
the truncate(2) system call and related functionality.
|
||||
|
||||
Note: ->truncate and vmtruncate are deprecated. Do not add new
|
||||
instances/calls of these. Filesystems should be converted to do their
|
||||
truncate sequence via ->setattr().
|
||||
|
||||
permission: called by the VFS to check for access rights on a POSIX-like
|
||||
filesystem.
|
||||
|
||||
@@ -729,7 +734,7 @@ struct file_operations {
|
||||
int (*open) (struct inode *, struct file *);
|
||||
int (*flush) (struct file *);
|
||||
int (*release) (struct inode *, struct file *);
|
||||
int (*fsync) (struct file *, struct dentry *, int datasync);
|
||||
int (*fsync) (struct file *, int datasync);
|
||||
int (*aio_fsync) (struct kiocb *, int datasync);
|
||||
int (*fasync) (int, struct file *, int);
|
||||
int (*lock) (struct file *, int, struct file_lock *);
|
||||
|
||||
@@ -1849,8 +1849,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int spufs_mfc_fsync(struct file *file, struct dentry *dentry,
|
||||
int datasync)
|
||||
static int spufs_mfc_fsync(struct file *file, int datasync)
|
||||
{
|
||||
return spufs_mfc_flush(file, NULL);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ const struct file_operations spufs_context_fops = {
|
||||
.llseek = dcache_dir_lseek,
|
||||
.read = generic_read_dir,
|
||||
.readdir = dcache_readdir,
|
||||
.fsync = simple_sync_file,
|
||||
.fsync = noop_fsync,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(spufs_context_fops);
|
||||
|
||||
|
||||
@@ -305,8 +305,7 @@ static int ps3flash_flush(struct file *file, fl_owner_t id)
|
||||
return ps3flash_writeback(ps3flash_dev);
|
||||
}
|
||||
|
||||
static int ps3flash_fsync(struct file *file, struct dentry *dentry,
|
||||
int datasync)
|
||||
static int ps3flash_fsync(struct file *file, int datasync)
|
||||
{
|
||||
return ps3flash_writeback(ps3flash_dev);
|
||||
}
|
||||
|
||||
@@ -189,8 +189,7 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
|
||||
return new_offset;
|
||||
}
|
||||
|
||||
static int vol_cdev_fsync(struct file *file, struct dentry *dentry,
|
||||
int datasync)
|
||||
static int vol_cdev_fsync(struct file *file, int datasync)
|
||||
{
|
||||
struct ubi_volume_desc *desc = file->private_data;
|
||||
struct ubi_device *ubi = desc->vol->ubi;
|
||||
|
||||
@@ -880,7 +880,7 @@ static struct inode *pohmelfs_alloc_inode(struct super_block *sb)
|
||||
/*
|
||||
* We want fsync() to work on POHMELFS.
|
||||
*/
|
||||
static int pohmelfs_fsync(struct file *file, struct dentry *dentry, int datasync)
|
||||
static int pohmelfs_fsync(struct file *file, int datasync)
|
||||
{
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
struct writeback_control wbc = {
|
||||
|
||||
@@ -794,7 +794,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
|
||||
}
|
||||
|
||||
static int
|
||||
printer_fsync(struct file *fd, struct dentry *dentry, int datasync)
|
||||
printer_fsync(struct file *fd, int datasync)
|
||||
{
|
||||
struct printer_dev *dev = fd->private_data;
|
||||
unsigned long flags;
|
||||
|
||||
@@ -66,7 +66,7 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, int datasync)
|
||||
int fb_deferred_io_fsync(struct file *file, int datasync)
|
||||
{
|
||||
struct fb_info *info = file->private_data;
|
||||
|
||||
|
||||
+2
-4
@@ -257,15 +257,13 @@ v9fs_file_write(struct file *filp, const char __user * data,
|
||||
return total;
|
||||
}
|
||||
|
||||
static int v9fs_file_fsync(struct file *filp, struct dentry *dentry,
|
||||
int datasync)
|
||||
static int v9fs_file_fsync(struct file *filp, int datasync)
|
||||
{
|
||||
struct p9_fid *fid;
|
||||
struct p9_wstat wstat;
|
||||
int retval;
|
||||
|
||||
P9_DPRINTK(P9_DEBUG_VFS, "filp %p dentry %p datasync %x\n", filp,
|
||||
dentry, datasync);
|
||||
P9_DPRINTK(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
|
||||
|
||||
fid = filp->private_data;
|
||||
v9fs_blank_wstat(&wstat);
|
||||
|
||||
+1
-1
@@ -197,7 +197,7 @@ const struct file_operations adfs_dir_operations = {
|
||||
.read = generic_read_dir,
|
||||
.llseek = generic_file_llseek,
|
||||
.readdir = adfs_readdir,
|
||||
.fsync = simple_fsync,
|
||||
.fsync = generic_file_fsync,
|
||||
};
|
||||
|
||||
static int
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ const struct file_operations adfs_file_operations = {
|
||||
.read = do_sync_read,
|
||||
.aio_read = generic_file_aio_read,
|
||||
.mmap = generic_file_mmap,
|
||||
.fsync = simple_fsync,
|
||||
.fsync = generic_file_fsync,
|
||||
.write = do_sync_write,
|
||||
.aio_write = generic_file_aio_write,
|
||||
.splice_read = generic_file_splice_read,
|
||||
|
||||
+2
-1
@@ -322,8 +322,9 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr)
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
/* XXX: this is missing some actual on-disk truncation.. */
|
||||
if (ia_valid & ATTR_SIZE)
|
||||
error = vmtruncate(inode, attr->ia_size);
|
||||
error = simple_setsize(inode, attr->ia_size);
|
||||
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ extern int affs_add_entry(struct inode *dir, struct inode *inode, struct dent
|
||||
|
||||
void affs_free_prealloc(struct inode *inode);
|
||||
extern void affs_truncate(struct inode *);
|
||||
int affs_file_fsync(struct file *, struct dentry *, int);
|
||||
int affs_file_fsync(struct file *, int);
|
||||
|
||||
/* dir.c */
|
||||
|
||||
|
||||
+2
-2
@@ -916,9 +916,9 @@ affs_truncate(struct inode *inode)
|
||||
affs_free_prealloc(inode);
|
||||
}
|
||||
|
||||
int affs_file_fsync(struct file *filp, struct dentry *dentry, int datasync)
|
||||
int affs_file_fsync(struct file *filp, int datasync)
|
||||
{
|
||||
struct inode * inode = dentry->d_inode;
|
||||
struct inode *inode = filp->f_mapping->host;
|
||||
int ret, err;
|
||||
|
||||
ret = write_inode_now(inode, 0);
|
||||
|
||||
+1
-1
@@ -740,7 +740,7 @@ extern void afs_pages_written_back(struct afs_vnode *, struct afs_call *);
|
||||
extern ssize_t afs_file_write(struct kiocb *, const struct iovec *,
|
||||
unsigned long, loff_t);
|
||||
extern int afs_writeback_all(struct afs_vnode *);
|
||||
extern int afs_fsync(struct file *, struct dentry *, int);
|
||||
extern int afs_fsync(struct file *, int);
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
+2
-1
@@ -701,8 +701,9 @@ int afs_writeback_all(struct afs_vnode *vnode)
|
||||
* - the return status from this call provides a reliable indication of
|
||||
* whether any write errors occurred for this process.
|
||||
*/
|
||||
int afs_fsync(struct file *file, struct dentry *dentry, int datasync)
|
||||
int afs_fsync(struct file *file, int datasync)
|
||||
{
|
||||
struct dentry *dentry = file->f_path.dentry;
|
||||
struct afs_writeback *wb, *xwb;
|
||||
struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode);
|
||||
int ret;
|
||||
|
||||
@@ -527,7 +527,7 @@ static void aio_fput_routine(struct work_struct *data)
|
||||
|
||||
/* Complete the fput(s) */
|
||||
if (req->ki_filp != NULL)
|
||||
__fput(req->ki_filp);
|
||||
fput(req->ki_filp);
|
||||
|
||||
/* Link the iocb into the context's free list */
|
||||
spin_lock_irq(&ctx->ctx_lock);
|
||||
@@ -560,11 +560,11 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
|
||||
|
||||
/*
|
||||
* Try to optimize the aio and eventfd file* puts, by avoiding to
|
||||
* schedule work in case it is not __fput() time. In normal cases,
|
||||
* schedule work in case it is not final fput() time. In normal cases,
|
||||
* we would not be holding the last reference to the file*, so
|
||||
* this function will be executed w/out any aio kthread wakeup.
|
||||
*/
|
||||
if (unlikely(atomic_long_dec_and_test(&req->ki_filp->f_count))) {
|
||||
if (unlikely(!fput_atomic(req->ki_filp))) {
|
||||
get_ioctx(ctx);
|
||||
spin_lock(&fput_lock);
|
||||
list_add(&req->ki_list, &fput_head);
|
||||
|
||||
+1
-1
@@ -205,7 +205,7 @@ static struct inode *anon_inode_mkinode(void)
|
||||
* that it already _is_ on the dirty list.
|
||||
*/
|
||||
inode->i_state = I_DIRTY;
|
||||
inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR;
|
||||
inode->i_mode = S_IRUSR | S_IWUSR;
|
||||
inode->i_uid = current_fsuid();
|
||||
inode->i_gid = current_fsgid();
|
||||
inode->i_flags |= S_PRIVATE;
|
||||
|
||||
@@ -67,14 +67,14 @@ EXPORT_SYMBOL(inode_change_ok);
|
||||
* @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 will check filesystem limits and ulimits to check that the
|
||||
* new inode size is within limits. inode_newsize_ok will also send SIGXFSZ
|
||||
* when necessary. Caller must not proceed with inode size change if failure is
|
||||
* returned. @inode must be a file (not directory), with appropriate
|
||||
* permissions to allow truncate (inode_newsize_ok does NOT check these
|
||||
* conditions).
|
||||
*
|
||||
* inode_newsize_ok must be called with i_mutex held.
|
||||
*/
|
||||
int inode_newsize_ok(const struct inode *inode, loff_t offset)
|
||||
{
|
||||
@@ -104,17 +104,25 @@ out_big:
|
||||
}
|
||||
EXPORT_SYMBOL(inode_newsize_ok);
|
||||
|
||||
int inode_setattr(struct inode * inode, struct iattr * attr)
|
||||
/**
|
||||
* generic_setattr - copy simple metadata updates into the generic inode
|
||||
* @inode: the inode to be updated
|
||||
* @attr: the new attributes
|
||||
*
|
||||
* generic_setattr must be called with i_mutex held.
|
||||
*
|
||||
* generic_setattr updates the inode's metadata with that specified
|
||||
* in attr. Noticably missing is inode size update, which is more complex
|
||||
* as it requires pagecache updates. See simple_setsize.
|
||||
*
|
||||
* The inode is not marked as dirty after this operation. The rationale is
|
||||
* that for "simple" filesystems, the struct inode is the inode storage.
|
||||
* The caller is free to mark the inode dirty afterwards if needed.
|
||||
*/
|
||||
void generic_setattr(struct inode *inode, const struct iattr *attr)
|
||||
{
|
||||
unsigned int ia_valid = attr->ia_valid;
|
||||
|
||||
if (ia_valid & ATTR_SIZE &&
|
||||
attr->ia_size != i_size_read(inode)) {
|
||||
int error = vmtruncate(inode, attr->ia_size);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
|
||||
if (ia_valid & ATTR_UID)
|
||||
inode->i_uid = attr->ia_uid;
|
||||
if (ia_valid & ATTR_GID)
|
||||
@@ -135,6 +143,28 @@ int inode_setattr(struct inode * inode, struct iattr * attr)
|
||||
mode &= ~S_ISGID;
|
||||
inode->i_mode = mode;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(generic_setattr);
|
||||
|
||||
/*
|
||||
* note this function is deprecated, the new truncate sequence should be
|
||||
* used instead -- see eg. simple_setsize, generic_setattr.
|
||||
*/
|
||||
int inode_setattr(struct inode *inode, const struct iattr *attr)
|
||||
{
|
||||
unsigned int ia_valid = attr->ia_valid;
|
||||
|
||||
if (ia_valid & ATTR_SIZE &&
|
||||
attr->ia_size != i_size_read(inode)) {
|
||||
int error;
|
||||
|
||||
error = vmtruncate(inode, attr->ia_size);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
|
||||
generic_setattr(inode, attr);
|
||||
|
||||
mark_inode_dirty(inode);
|
||||
|
||||
return 0;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user