[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <44F59E79.2080402@gmail.com>
Date: Wed, 30 Aug 2006 22:19:37 +0800
From: Yi Yang <yang.y.yi@...il.com>
To: linux-kernel@...r.kernel.org
CC: Zach Brown <zab@...bo.net>, Andrew Morton <akpm@...l.org>,
linux-aio <linux-aio@...ck.org>, torvalds@...l.org
Subject: [2.6.18-rc5 PATCH]: aio cleanup
As Zach Brown said, a cleanup patch is reasonable. Here it is.
This patch extracts the common part from aio_fsync and aio_fdsync
and define a new inlined function aio_xsync, then aio_fsync and
aio_fdsync just call aio_xsunc in the almost same way except second
argument is different, one is 1 and another 0.
--- a/fs/aio.c.orig 2006-08-30 22:00:00.000000000 +0800
+++ b/fs/aio.c 2006-08-30 22:08:35.000000000 +0800
@@ -1363,24 +1363,24 @@ static ssize_t aio_pwrite(struct kiocb *
return ret;
}
-static ssize_t aio_fdsync(struct kiocb *iocb)
+static inline ssize_t aio_xsync(struct kiocb *iocb, int flags)
{
struct file *file = iocb->ki_filp;
ssize_t ret = -EINVAL;
if (file->f_op->aio_fsync)
- ret = file->f_op->aio_fsync(iocb, 1);
+ ret = file->f_op->aio_fsync(iocb, flags);
return ret;
}
-static ssize_t aio_fsync(struct kiocb *iocb)
+static ssize_t aio_fdsync(struct kiocb *iocb)
{
- struct file *file = iocb->ki_filp;
- ssize_t ret = -EINVAL;
+ return aio_xsync(iocb, 1);
+}
- if (file->f_op->aio_fsync)
- ret = file->f_op->aio_fsync(iocb, 0);
- return ret;
+static ssize_t aio_fsync(struct kiocb *iocb)
+{
+ return aio_xsync(iocb, 0);
}
/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists