[Ocfs2-commits] mfasheh commits r1404 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Aug 30 14:20:52 CDT 2004
Author: mfasheh
Date: 2004-08-30 14:20:50 -0500 (Mon, 30 Aug 2004)
New Revision: 1404
Modified:
trunk/src/file.c
Log:
* Commit a patch by Christoph Hellwig <hch at lst.de>:
Subject: [Ocfs2-devel] [PATCH] simplify and cleanup ocfs_file_release
- add private variable ocfs_inode_private *oip to get rid of the
gazillions of OCFS_I calls
- removed check for root inode - root inode is always a directory
so the directory check triggers
- but actually we don't need the directory check either because
directories can never be opened O_DIRECT
- remove usage of obsfucation macros for bitmasks
- clear OCFS_OIN_OPEN_FOR_DIRECTIO unconditionally on last close,
either it was set or not, after clearing it'll be unset
- remove "PURE_EVIL"
- reformat to match kernel coding style
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-08-30 18:56:28 UTC (rev 1403)
+++ trunk/src/file.c 2004-08-30 19:20:50 UTC (rev 1404)
@@ -257,67 +257,24 @@
return ret;
} /* ocfs_file_open */
-/*
- * ocfs_file_release()
- *
- */
-static int ocfs_file_release (struct inode *inode, struct file *file)
+static int ocfs_file_release(struct inode *inode, struct file *file)
{
- ocfs_super * osb;
- struct dentry *dentry;
- int last_close = 0;
- int dec = 0;
+ ocfs_inode_private *oip = OCFS_I(inode);
LOG_SET_CONTEXT(RELEASE);
+ LOG_ENTRY_ARGS("(0x%p, 0x%p, '%*s')\n", inode, file,
+ file->f_dentry->d_name.len,
+ file->f_dentry->d_name.name);
- LOG_ENTRY_ARGS ("(0x%p, 0x%p, '%*s')\n", inode, file,
- file->f_dentry->d_name.len, file->f_dentry->d_name.name);
+ down(&oip->ip_sem);
+ if (!--oip->ip_open_cnt)
+ oip->ip_open_flags &= ~OCFS_OIN_OPEN_FOR_DIRECTIO;
+ up(&oip->ip_sem);
- dentry = file->f_dentry;
-
-#ifdef PURE_EVIL
- if (evil_filename_check(EVIL_DENTRY, dentry)) {
- LOG_ERROR_ARGS("EVIL FRELEASE: mode=%d\n", file->f_flags);
- }
-#endif
-
- osb = OCFS_SB(inode->i_sb);
-
- /* dir */
- if (S_ISDIR (inode->i_mode)) {
- /* fix all this - need a real open/close for directories */
- goto bail;
- }
-
- down (&(OCFS_I(inode)->ip_sem));
- OCFS_I(inode)->ip_open_cnt--;
- if (!OCFS_I(inode)->ip_open_cnt)
- last_close = 1;
-
- if (inode == osb->root_inode) {
- up (&(OCFS_I(inode)->ip_sem));
- goto bail;
- }
-
- LOG_TRACE_ARGS ("openhandles: %d / osbfiles: %lld / refcount: %d\n",
- OCFS_I(inode)->ip_open_cnt, osb->file_open_cnt,
- atomic_read(&dentry->d_count));
-
- if (last_close
- && (OCFS_I(inode)->ip_open_flags & OCFS_OIN_OPEN_FOR_DIRECTIO))
- OCFS_CLEAR_FLAG(OCFS_I(inode)->ip_open_flags,
- OCFS_OIN_OPEN_FOR_DIRECTIO);
- up (&(OCFS_I(inode)->ip_sem));
-
-bail:
- if (dec)
- iput(inode);
-
- LOG_EXIT_INT (0);
-
+ LOG_EXIT_INT(0);
LOG_CLEAR_CONTEXT();
return 0;
-} /* ocfs_file_release */
+}
/*
* ocfs_inode_fill_ext_map()
More information about the Ocfs2-commits
mailing list