summaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-06-25 01:20:01 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-06-25 01:20:01 +0000
commit3797ba0b62debb71af4606910acacc9896a9ae3b (patch)
tree414eea76253c7871bfdf3bd9d1817771eb40917c /include/linux/fs.h
parent2b6c0c580795a4404f72d2a794214dd9e080709d (diff)
Merge with Linux 2.4.0-test2.
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h92
1 files changed, 34 insertions, 58 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3eafb9a55..8a1f8e9b6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -47,12 +47,7 @@ struct poll_table_struct;
#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
/* And dynamically-tunable limits and defaults: */
-struct files_stat_struct {
- int nr_files; /* read only */
- int nr_free_files; /* read only */
- int max_files; /* tunable */
-};
-extern struct files_stat_struct files_stat;
+extern int max_files, nr_files, nr_free_files;
extern int max_super_blocks, nr_super_blocks;
#define NR_FILE 8192 /* this can well be larger on a larger system */
@@ -241,9 +236,6 @@ struct buffer_head {
unsigned long b_rsector; /* Real buffer location on disk */
wait_queue_head_t b_wait;
struct kiobuf * b_kiobuf; /* kiobuf which owns this IO */
-
- struct inode * b_inode;
- struct list_head b_inode_buffers; /* doubly linked list of inode dirty buffers */
};
typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
@@ -383,8 +375,6 @@ struct inode {
struct list_head i_list;
struct list_head i_dentry;
- struct list_head i_dirty_buffers;
-
unsigned long i_ino;
atomic_t i_count;
kdev_t i_dev;
@@ -451,24 +441,16 @@ struct inode {
};
/* Inode state bits.. */
-#define I_DIRTY_SYNC 1 /* Not dirty enough for O_DATASYNC */
-#define I_DIRTY_DATASYNC 2 /* Data-related inode changes pending */
-#define I_LOCK 4
-#define I_FREEING 8
-#define I_CLEAR 16
+#define I_DIRTY 1
+#define I_LOCK 2
+#define I_FREEING 4
+#define I_CLEAR 8
-#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
-
-extern void __mark_inode_dirty(struct inode *, int);
+extern void __mark_inode_dirty(struct inode *);
static inline void mark_inode_dirty(struct inode *inode)
{
- if ((inode->i_state & I_DIRTY) != I_DIRTY)
- __mark_inode_dirty(inode, I_DIRTY);
-}
-static inline void mark_inode_dirty_sync(struct inode *inode)
-{
- if (!(inode->i_state & I_DIRTY_SYNC))
- __mark_inode_dirty(inode, I_DIRTY_SYNC);
+ if (!(inode->i_state & I_DIRTY))
+ __mark_inode_dirty(inode);
}
struct fown_struct {
@@ -522,8 +504,10 @@ typedef struct files_struct *fl_owner_t;
struct file_lock {
struct file_lock *fl_next; /* singly linked list for this inode */
- struct list_head fl_link; /* doubly linked list of all locks */
- struct list_head fl_block; /* circular list of blocked processes */
+ struct file_lock *fl_nextlink; /* doubly linked list of all locks */
+ struct file_lock *fl_prevlink; /* used to simplify lock removal */
+ struct file_lock *fl_nextblock; /* circular list of blocked processes */
+ struct file_lock *fl_prevblock;
fl_owner_t fl_owner;
unsigned int fl_pid;
wait_queue_head_t fl_wait;
@@ -548,7 +532,7 @@ struct file_lock {
#define OFFSET_MAX INT_LIMIT(loff_t)
#endif
-extern struct list_head file_lock_list;
+extern struct file_lock *file_lock_table;
#include <linux/fcntl.h>
@@ -737,7 +721,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 *, struct dentry *);
int (*fasync) (int, struct file *, int);
int (*lock) (struct file *, int, struct file_lock *);
ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);
@@ -770,7 +754,7 @@ struct inode_operations {
*/
struct super_operations {
void (*read_inode) (struct inode *);
- void (*write_inode) (struct inode *, int);
+ void (*write_inode) (struct inode *);
void (*put_inode) (struct inode *);
void (*delete_inode) (struct inode *);
void (*put_super) (struct super_block *);
@@ -875,8 +859,8 @@ static inline int locks_verify_truncate(struct inode *inode,
return locks_mandatory_area(
FLOCK_VERIFY_WRITE, inode, filp,
size < inode->i_size ? size : inode->i_size,
- size < inode->i_size ? inode->i_size - size
- : size - inode->i_size);
+ abs(inode->i_size - size)
+ );
return 0;
}
@@ -997,44 +981,23 @@ static inline void buffer_IO_error(struct buffer_head * bh)
bh->b_end_io(bh, 0);
}
-extern void buffer_insert_inode_queue(struct buffer_head *, struct inode *);
-static inline void mark_buffer_dirty_inode(struct buffer_head *bh, int flag, struct inode *inode)
-{
- mark_buffer_dirty(bh, flag);
- buffer_insert_inode_queue(bh, inode);
-}
-
extern void balance_dirty(kdev_t);
extern int check_disk_change(kdev_t);
extern int invalidate_inodes(struct super_block *);
extern void invalidate_inode_pages(struct inode *);
-extern void invalidate_inode_buffers(struct inode *);
#define invalidate_buffers(dev) __invalidate_buffers((dev), 0)
#define destroy_buffers(dev) __invalidate_buffers((dev), 1)
extern void __invalidate_buffers(kdev_t dev, int);
extern void sync_inodes(kdev_t);
-extern void write_inode_now(struct inode *, int);
+extern void write_inode_now(struct inode *);
extern void sync_dev(kdev_t);
extern int fsync_dev(kdev_t);
-extern int fsync_inode_buffers(struct inode *);
-extern int osync_inode_buffers(struct inode *);
-extern int generic_osync_inode(struct inode *, int);
-extern int inode_has_buffers(struct inode *);
extern void sync_supers(kdev_t);
extern int bmap(struct inode *, int);
extern int notify_change(struct dentry *, struct iattr *);
extern int permission(struct inode *, int);
extern int get_write_access(struct inode *);
-extern int deny_write_access(struct file *);
-static inline void put_write_access(struct inode * inode)
-{
- atomic_dec(&inode->i_writecount);
-}
-static inline void allow_write_access(struct file *file)
-{
- if (file)
- atomic_inc(&file->f_dentry->d_inode->i_writecount);
-}
+extern void put_write_access(struct inode *);
extern int do_pipe(int *);
extern int open_namei(const char *, int, int, struct nameidata *);
@@ -1156,7 +1119,6 @@ typedef int (get_block_t)(struct inode*,long,struct buffer_head*,int);
/* Generic buffer handling for block filesystems.. */
extern int block_flushpage(struct page *, unsigned long);
-extern void block_destroy_buffers(struct page *);
extern int block_symlink(struct inode *, const char *, int);
extern int block_write_full_page(struct page*, get_block_t*);
extern int block_read_full_page(struct page*, get_block_t*);
@@ -1210,7 +1172,7 @@ extern int read_ahead[];
extern ssize_t char_write(struct file *, const char *, size_t, loff_t *);
extern ssize_t block_write(struct file *, const char *, size_t, loff_t *);
-extern int file_fsync(struct file *, struct dentry *, int);
+extern int file_fsync(struct file *, struct dentry *);
extern int generic_buffer_fdatasync(struct inode *inode, unsigned long start_idx, unsigned long end_idx);
extern int inode_change_ok(struct inode *, struct iattr *);
@@ -1224,6 +1186,20 @@ extern void inode_setattr(struct inode *, struct iattr *);
*/
/*
+ * We need to do a check-parent every time
+ * after we have locked the parent - to verify
+ * that the parent is still our parent and
+ * that we are still hashed onto it..
+ *
+ * This is required in case two processes race
+ * on removing (or moving) the same entry: the
+ * parent lock will serialize them, but the
+ * other process will be too late..
+ */
+#define check_parent(dir, dentry) \
+ ((dir) == (dentry)->d_parent && !d_unhashed(dentry))
+
+/*
* Locking the parent is needed to:
* - serialize directory operations
* - make sure the parent doesn't change from