Recent changes

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

 



The following changes since commit 449767ed6db2e0cb36f880d52573b069864286d0:

  Fio 1.52 (2011-04-29 11:40:06 +0200)

are available in the git repository at:
  git://git.kernel.dk/fio.git master

Jens Axboe (1):
      Switch mutex to using anonymous mmap

 mutex.c |   26 +++-----------------------
 mutex.h |    2 --
 2 files changed, 3 insertions(+), 25 deletions(-)

---

Diff of recent changes:

diff --git a/mutex.c b/mutex.c
index e33e7cc..bbbcccb 100644
--- a/mutex.c
+++ b/mutex.c
@@ -15,44 +15,25 @@
 
 void fio_mutex_remove(struct fio_mutex *mutex)
 {
-	close(mutex->mutex_fd);
 	munmap((void *) mutex, sizeof(*mutex));
 }
 
 struct fio_mutex *fio_mutex_init(int value)
 {
-	char mutex_name[] = "/tmp/.fio_mutex.XXXXXX";
 	struct fio_mutex *mutex = NULL;
 	pthread_mutexattr_t attr;
 	pthread_condattr_t cond;
-	int fd, ret, mflag;
-
-	fd = mkstemp(mutex_name);
-	if (fd < 0) {
-		perror("open mutex");
-		return NULL;
-	}
-
-#ifdef FIO_HAVE_FALLOCATE
-	posix_fallocate(fd, 0, sizeof(struct fio_mutex));
-#endif
-
-	if (ftruncate(fd, sizeof(struct fio_mutex)) < 0) {
-		perror("ftruncate mutex");
-		goto err;
-	}
+	int ret, mflag;
 
 	mutex = (void *) mmap(NULL, sizeof(struct fio_mutex),
-				PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+				PROT_READ | PROT_WRITE,
+				OS_MAP_ANON | MAP_SHARED, -1, 0);
 	if (mutex == MAP_FAILED) {
 		perror("mmap mutex");
-		close(fd);
 		mutex = NULL;
 		goto err;
 	}
 
-	unlink(mutex_name);
-	mutex->mutex_fd = fd;
 	mutex->value = value;
 
 	/*
@@ -97,7 +78,6 @@ err:
 	if (mutex)
 		fio_mutex_remove(mutex);
 
-	unlink(mutex_name);
 	return NULL;
 }
 
diff --git a/mutex.h b/mutex.h
index ac79dc6..5938e95 100644
--- a/mutex.h
+++ b/mutex.h
@@ -8,8 +8,6 @@ struct fio_mutex {
 	pthread_cond_t cond;
 	int value;
 	int waiters;
-
-	int mutex_fd;
 };
 
 extern struct fio_mutex *fio_mutex_init(int);
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux