From 3bcefbe89078778384448f8ae406b0a9d7827091 Mon Sep 17 00:00:00 2001
From: Alberto Bertogli <albertito@blitiri.com.ar>
Date: Fri, 3 Apr 2009 01:08:15 -0300
Subject: [PATCH 01/38] Only call posix_fadvise() if we know we're going to read the data.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
---
 libjio/trans.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libjio/trans.c b/libjio/trans.c
index 6fb6885..95ecfad 100644
--- a/libjio/trans.c
+++ b/libjio/trans.c
@@ -204,9 +204,11 @@ int jtrans_add(struct jtrans *ts, const void *buf, size_t count, off_t offset)
 	jop->pdata = NULL;
 	jop->locked = 0;
 
-	/* it's highly likely that jtrans_commit() will want to read the
-	 * current data, so we tell the kernel about that */
-	posix_fadvise(ts->fs->fd, offset, count, POSIX_FADV_WILLNEED);
+	if (!(ts->flags & J_NOROLLBACK)) {
+		/* jtrans_commit() will want to read the current data, so we
+		 * tell the kernel about that */
+		posix_fadvise(ts->fs->fd, offset, count, POSIX_FADV_WILLNEED);
+	}
 
 	return 1;
 }
-- 
1.6.2.2.646.gb214

