Hello Linus,
This patch splits fput into fput and __fput. __fput is needed by aio
to construct a mechanism for performing fput during io completion,
which typically occurs during interrupt context.
-ben
-- "You will be reincarnated as a toad; and you will be much happier."diff -urN v2.5.22/fs/file_table.c fput-v2.5.22/fs/file_table.c --- v2.5.22/fs/file_table.c Thu Jun 6 00:35:32 2002 +++ fput-v2.5.22/fs/file_table.c Mon Jun 17 15:43:10 2002 @@ -100,31 +100,38 @@ void fput(struct file * file) { + if (atomic_dec_and_test(&file->f_count)) + __fput(file); +} + +/* __fput is needed for aio, which provides a mechanism for doing fput + * from an interrupt handler. + */ +void __fput(struct file * file) +{ struct dentry * dentry = file->f_dentry; struct vfsmount * mnt = file->f_vfsmnt; struct inode * inode = dentry->d_inode; - if (atomic_dec_and_test(&file->f_count)) { - locks_remove_flock(file); + locks_remove_flock(file); - if (file->f_iobuf) - free_kiovec(1, &file->f_iobuf); + if (file->f_iobuf) + free_kiovec(1, &file->f_iobuf); - if (file->f_op && file->f_op->release) - file->f_op->release(inode, file); - fops_put(file->f_op); - if (file->f_mode & FMODE_WRITE) - put_write_access(inode); - file_list_lock(); - file->f_dentry = NULL; - file->f_vfsmnt = NULL; - list_del(&file->f_list); - list_add(&file->f_list, &free_list); - files_stat.nr_free_files++; - file_list_unlock(); - dput(dentry); - mntput(mnt); - } + if (file->f_op && file->f_op->release) + file->f_op->release(inode, file); + fops_put(file->f_op); + if (file->f_mode & FMODE_WRITE) + put_write_access(inode); + file_list_lock(); + file->f_dentry = NULL; + file->f_vfsmnt = NULL; + list_del(&file->f_list); + list_add(&file->f_list, &free_list); + files_stat.nr_free_files++; + file_list_unlock(); + dput(dentry); + mntput(mnt); } struct file * fget(unsigned int fd) diff -urN v2.5.22/include/linux/file.h fput-v2.5.22/include/linux/file.h --- v2.5.22/include/linux/file.h Thu Jun 6 00:35:16 2002 +++ fput-v2.5.22/include/linux/file.h Mon Jun 17 15:43:11 2002 @@ -33,6 +33,7 @@ struct file * fd_array[NR_OPEN_DEFAULT]; }; +extern void FASTCALL(__fput(struct file *)); extern void FASTCALL(fput(struct file *)); extern struct file * FASTCALL(fget(unsigned int fd)); extern void FASTCALL(set_close_on_exec(unsigned int fd, int flag)); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Jun 23 2002 - 22:00:14 EST