[2.6.18-rc5 PATCH]: aio cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux