[Ocfs2-commits] zab commits r2008 - in trunk: . fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Mar 18 13:26:52 CST 2005
Author: zab
Signed-off-by: mfasheh
Date: 2005-03-18 13:26:50 -0600 (Fri, 18 Mar 2005)
New Revision: 2008
Modified:
trunk/Config.make.in
trunk/configure.in
trunk/fs/ocfs2/Makefile
trunk/fs/ocfs2/aio.c
Log:
o learn to drive the ki_dtor that might be embedded in the historic iocb
private array.
Signed-Off-By: mfasheh
Modified: trunk/Config.make.in
===================================================================
--- trunk/Config.make.in 2005-03-18 06:02:19 UTC (rev 2007)
+++ trunk/Config.make.in 2005-03-18 19:26:50 UTC (rev 2008)
@@ -63,6 +63,7 @@
MISSING_SOCK_CREATE_LITE = @MISSING_SOCK_CREATE_LITE@
JOURNAL_ACCESS_WITH_CREDITS = @JOURNAL_ACCESS_WITH_CREDITS@
+KIOCB_DTOR_IN_PRIVATE = @KIOCB_DTOR_IN_PRIVATE@
COMPAT_SAFE_WRITE = @COMPAT_SAFE_WRITE@
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2005-03-18 06:02:19 UTC (rev 2007)
+++ trunk/configure.in 2005-03-18 19:26:50 UTC (rev 2008)
@@ -360,6 +360,16 @@
fi
AC_SUBST(JOURNAL_ACCESS_WITH_CREDITS)
+KIOCB_DTOR_IN_PRIVATE=
+AC_MSG_CHECKING([for iocb dtor in union])
+if grep "\<DTOR_IN_PRIVATE\>" "$KERNELINC/linux/aio.h" >/dev/null 2>&1 ; then
+ AC_MSG_RESULT(yes)
+ KIOCB_DTOR_IN_PRIVATE=yes
+else
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST(KIOCB_DTOR_IN_PRIVATE)
+
# using -include has two advantages:
# the source doesn't need to know to include compat headers
# the compat header file names don't go through the search path
Modified: trunk/fs/ocfs2/Makefile
===================================================================
--- trunk/fs/ocfs2/Makefile 2005-03-18 06:02:19 UTC (rev 2007)
+++ trunk/fs/ocfs2/Makefile 2005-03-18 19:26:50 UTC (rev 2008)
@@ -34,6 +34,10 @@
EXTRA_CFLAGS += -DJOURNAL_ACCESS_WITH_CREDITS
endif
+ifdef KIOCB_DTOR_IN_PRIVATE
+EXTRA_CFLAGS += -DKIOCB_DTOR_IN_PRIVATE
+endif
+
ifneq ($(QUIET),1)
EXTRA_CFLAGS += -DVERBOSE_BH_JBD_TRACE
EXTRA_CFLAGS += -DVERBOSE_LOCKING_TRACE
Modified: trunk/fs/ocfs2/aio.c
===================================================================
--- trunk/fs/ocfs2/aio.c 2005-03-18 06:02:19 UTC (rev 2007)
+++ trunk/fs/ocfs2/aio.c 2005-03-18 19:26:50 UTC (rev 2008)
@@ -64,6 +64,34 @@
static LIST_HEAD(okp_teardown_list);
static spinlock_t okp_teardown_lock = SPIN_LOCK_UNLOCKED;
+static struct ocfs2_kiocb_private *okp_from_iocb(struct kiocb *iocb)
+{
+ struct ocfs2_kiocb_private *okp;
+
+#ifndef KIOCB_DTOR_IN_PRIVATE
+ okp = iocb->private;
+#else
+
+ if (!kiocbIsDtorInPrivate(iocb)) {
+ kiocbSetDtorInPrivate(iocb);
+ iocb->ki_dip.ki_private = 0;
+ }
+
+ okp = (struct ocfs2_kiocb_private *)iocb->ki_dip.ki_private;
+#endif
+
+ return okp;
+}
+static void okp_to_iocb(struct kiocb *iocb, struct ocfs2_kiocb_private *okp)
+{
+#ifndef KIOCB_DTOR_IN_PRIVATE
+ iocb->private = okp;
+#else
+ BUG_ON(!kiocbIsDtorInPrivate(iocb));
+ iocb->ki_dip.ki_private = (unsigned long)okp;
+#endif
+}
+
static void okp_teardown(struct ocfs2_kiocb_private *okp)
{
BUG_ON(okp->kp_inode == NULL);
@@ -99,15 +127,20 @@
static void ocfs2_ki_dtor(struct kiocb *iocb)
{
- struct ocfs2_kiocb_private *okp = iocb->private;
+ struct ocfs2_kiocb_private *okp;
unsigned long flags;
+ okp = okp_from_iocb(iocb);
+
/* okp_alloc only assigns the iocb->private and ->ki_dtor pointers if
* it was able to alloc the okp and get an inode reference */
BUG_ON(okp == NULL);
BUG_ON(okp->kp_inode == NULL);
BUG_ON(!list_empty(&okp->kp_teardown_item));
+ /* we had better not try to work with this iocb again */
+ okp_to_iocb(iocb, NULL);
+
if (in_interrupt()) {
/*
* there is very little in the teardown that is interrupt-safe,
@@ -141,8 +174,12 @@
goto out;
}
- iocb->private = okp;
+ okp_to_iocb(iocb, okp);
+#ifndef KIOCB_DTOR_IN_PRIVATE
iocb->ki_dtor = ocfs2_ki_dtor;
+#else
+ iocb->ki_dip.ki_dtor = ocfs2_ki_dtor;
+#endif
INIT_BUFFER_LOCK_CTXT(&okp->kp_ctxt);
INIT_LIST_HEAD(&okp->kp_teardown_item);
out:
@@ -167,12 +204,13 @@
ssize_t ocfs2_file_aio_read(struct kiocb *iocb, char *buf, size_t count,
loff_t pos)
{
- struct ocfs2_kiocb_private *okp = iocb->private;
+ struct ocfs2_kiocb_private *okp;
struct file *filp = iocb->ki_filp;
struct inode *inode = filp->f_dentry->d_inode;
ocfs2_backing_inode *target_binode;
- int ret;
+ ssize_t ret;
+ okp = okp_from_iocb(iocb);
if (okp == NULL) {
okp = okp_alloc(iocb);
if (IS_ERR(okp)) {
@@ -212,7 +250,7 @@
ret = generic_file_aio_read(iocb, buf, count, pos);
out:
- /* ki_dtor is always called, no matter what we return. */
+ /* ki_dtor will always be called eventually, no tear down here */
return ret;
}
@@ -221,13 +259,14 @@
ssize_t ocfs2_file_aio_write(struct kiocb *iocb, const char *buf,
size_t count, loff_t pos)
{
- struct ocfs2_kiocb_private *okp = iocb->private;
+ struct ocfs2_kiocb_private *okp;
struct file *filp = iocb->ki_filp;
struct inode *inode = filp->f_dentry->d_inode;
- int ret = 0;
+ ssize_t ret = 0;
struct iovec local_iov = { .iov_base = (void *)buf,
.iov_len = count };
+ okp = okp_from_iocb(iocb);
if (okp == NULL) {
okp = okp_alloc(iocb);
if (IS_ERR(okp)) {
@@ -286,6 +325,6 @@
ret = generic_file_aio_write_nolock(iocb, &local_iov, 1,
&iocb->ki_pos);
- /* ki_dtor is always called, no matter what we return. */
+ /* ki_dtor will always be called eventually, no tear down here */
return ret;
}
More information about the Ocfs2-commits
mailing list