diff options
| author | Alexander Viro <viro@www.linux.org.uk> | 2003-05-24 21:42:29 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-05-24 21:42:29 -0700 |
| commit | 9bda5f681fd216b6a856b72940195e5335317bf1 (patch) | |
| tree | f41a2cf805156cd9336be8c2eab01fbbacddc62d /include/linux | |
| parent | 787d458a0ce55dd6ca7595a3e9003d2e089cd60c (diff) | |
[PATCH] i_cdev/i_cindex
new fields in struct inode - i_cdev and i_cindex. When we do open() on
a character device we cache result of cdev lookup in inode and put the
inode on a cyclic list anchored in cdev. If we already have that done,
we don't bother with any lookups. When inode disappears it's removed
from the list. When cdev gets unregistered we remove all cached
references to it (and remove such inodes from the list). cdev is held
until final fput() now.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cdev.h | 9 | ||||
| -rw-r--r-- | include/linux/fs.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/include/linux/cdev.h b/include/linux/cdev.h index faa67d2f4323..191c800fa127 100644 --- a/include/linux/cdev.h +++ b/include/linux/cdev.h @@ -6,17 +6,14 @@ struct cdev { struct kobject kobj; struct module *owner; struct file_operations *ops; + struct list_head list; }; void cdev_init(struct cdev *, struct file_operations *); struct cdev *cdev_alloc(void); -static inline void cdev_put(struct cdev *p) -{ - if (p) - kobject_put(&p->kobj); -} +void cdev_put(struct cdev *p); struct kobject *cdev_get(struct cdev *); @@ -26,5 +23,7 @@ void cdev_del(struct cdev *); void cdev_unmap(dev_t, unsigned); +void cd_forget(struct inode *); + #endif #endif diff --git a/include/linux/fs.h b/include/linux/fs.h index 6b32c6ab8727..de57729940ef 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -382,6 +382,8 @@ struct inode { struct list_head i_devices; struct pipe_inode_info *i_pipe; struct block_device *i_bdev; + struct cdev *i_cdev; + int i_cindex; unsigned long i_dnotify_mask; /* Directory notify events */ struct dnotify_struct *i_dnotify; /* for directory notifications */ |
