mirror of
https://github.com/torvalds/linux.git
synced 2026-12-02 19:42:26 +00:00
Val's cross-port of the ext3 reservations code into ext2. [[email protected]: Small type error for printk [[email protected]: fix types, sync with ext3] [[email protected]: Bring ext2 reservations code in line with latest ext3] [[email protected]: kill noisy printk] [[email protected]: remember to dirty the gdp's block] [[email protected]: cross-port the missed5dea5176e5] [[email protected]: cross-porte6022603b9] [[email protected]: Port the omitted08fb306fe6] [[email protected]: Backport the missed20acaa18d0] [[email protected]: fixes] [[email protected]: fix reservation extension] [[email protected]: make ext2_get_blocks() static] [[email protected]: fix hang] [[email protected]: ext2_new_blocks should reset the reservation window size] [[email protected]: ext2 balloc: fix off-by-one against rsv_end] [[email protected]: grp_goal 0 is a genuine goal (unlike -1), so ext2_try_to_allocate_with_rsv should treat it as such] [[email protected]: rbtree usage cleanup] [[email protected]: Fix for ext2 reservation] [[email protected]: remove fs/ext2/balloc.c:reserve_blocks()] [[email protected]: ext2 balloc: use io_error label] Cc: "Martin J. Bligh" <[email protected]> Cc: Valerie Henson <[email protected]> Cc: Mingming Cao <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Hugh Dickins <[email protected]> Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Hugh Dickins <[email protected]> Signed-off-by: Badari Pulavarty <[email protected]> Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
90 lines
2.2 KiB
C
90 lines
2.2 KiB
C
/*
|
|
* linux/fs/ext2/file.c
|
|
*
|
|
* Copyright (C) 1992, 1993, 1994, 1995
|
|
* Remy Card ([email protected])
|
|
* Laboratoire MASI - Institut Blaise Pascal
|
|
* Universite Pierre et Marie Curie (Paris VI)
|
|
*
|
|
* from
|
|
*
|
|
* linux/fs/minix/file.c
|
|
*
|
|
* Copyright (C) 1991, 1992 Linus Torvalds
|
|
*
|
|
* ext2 fs regular file handling primitives
|
|
*
|
|
* 64-bit file support on 64-bit platforms by Jakub Jelinek
|
|
* ([email protected])
|
|
*/
|
|
|
|
#include <linux/time.h>
|
|
#include "ext2.h"
|
|
#include "xattr.h"
|
|
#include "acl.h"
|
|
|
|
/*
|
|
* Called when filp is released. This happens when all file descriptors
|
|
* for a single struct file are closed. Note that different open() calls
|
|
* for the same file yield different struct file structures.
|
|
*/
|
|
static int ext2_release_file (struct inode * inode, struct file * filp)
|
|
{
|
|
if (filp->f_mode & FMODE_WRITE) {
|
|
mutex_lock(&EXT2_I(inode)->truncate_mutex);
|
|
ext2_discard_reservation(inode);
|
|
mutex_unlock(&EXT2_I(inode)->truncate_mutex);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* We have mostly NULL's here: the current defaults are ok for
|
|
* the ext2 filesystem.
|
|
*/
|
|
const struct file_operations ext2_file_operations = {
|
|
.llseek = generic_file_llseek,
|
|
.read = do_sync_read,
|
|
.write = do_sync_write,
|
|
.aio_read = generic_file_aio_read,
|
|
.aio_write = generic_file_aio_write,
|
|
.ioctl = ext2_ioctl,
|
|
#ifdef CONFIG_COMPAT
|
|
.compat_ioctl = ext2_compat_ioctl,
|
|
#endif
|
|
.mmap = generic_file_mmap,
|
|
.open = generic_file_open,
|
|
.release = ext2_release_file,
|
|
.fsync = ext2_sync_file,
|
|
.splice_read = generic_file_splice_read,
|
|
.splice_write = generic_file_splice_write,
|
|
};
|
|
|
|
#ifdef CONFIG_EXT2_FS_XIP
|
|
const struct file_operations ext2_xip_file_operations = {
|
|
.llseek = generic_file_llseek,
|
|
.read = xip_file_read,
|
|
.write = xip_file_write,
|
|
.ioctl = ext2_ioctl,
|
|
#ifdef CONFIG_COMPAT
|
|
.compat_ioctl = ext2_compat_ioctl,
|
|
#endif
|
|
.mmap = xip_file_mmap,
|
|
.open = generic_file_open,
|
|
.release = ext2_release_file,
|
|
.fsync = ext2_sync_file,
|
|
};
|
|
#endif
|
|
|
|
const struct inode_operations ext2_file_inode_operations = {
|
|
.truncate = ext2_truncate,
|
|
#ifdef CONFIG_EXT2_FS_XATTR
|
|
.setxattr = generic_setxattr,
|
|
.getxattr = generic_getxattr,
|
|
.listxattr = ext2_listxattr,
|
|
.removexattr = generic_removexattr,
|
|
#endif
|
|
.setattr = ext2_setattr,
|
|
.permission = ext2_permission,
|
|
};
|