public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] 2.5.22 add __fput for aio
@ 2002-06-17 19:47 Benjamin LaHaise
  2002-06-17 20:11 ` Linus Torvalds
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin LaHaise @ 2002-06-17 19:47 UTC (permalink / raw)
  To: Linus Torvalds, Linux Kernel

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));

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-06-17 22:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-17 19:47 [patch] 2.5.22 add __fput for aio Benjamin LaHaise
2002-06-17 20:11 ` Linus Torvalds
2002-06-17 20:19   ` Benjamin LaHaise
2002-06-17 20:22     ` Linus Torvalds
2002-06-17 20:41       ` Dynamic Timer X.Xiao
2002-06-17 22:27         ` george anzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox