Alien-Libjio

 view release on metacpan or  search on metacpan

libjio/bindings/preload/libjio_preload.c  view on Meta::CPAN

	#define rec_inc() do { called++; } while(0)
	#define rec_dec() do { called--; } while(0)
	#define printd(...) do { } while(0)

#else
	/* debug variants */

	#define rec_inc()				\
		do {					\
			called++;			\
			fprintf(stderr, "I: %d\n", called); \
			fflush(stderr);			\
		} while (0)

	#define rec_dec()				\
		do {					\
			called--;			\
			fprintf(stderr, "D: %d\n", called); \
			fflush(stderr);			\
		} while (0)

	#define printd(...)				\
		do {					\
			if (called)			\
				fprintf(stderr, "\t");	\
			called++;			\
			fprintf(stderr, "%5.5d ", getpid()); \
			fprintf(stderr, "%s(): ", __FUNCTION__ ); \
			fprintf(stderr, __VA_ARGS__);	\
			fflush(stderr);			\
			called--;			\
		} while(0)
#endif


/* functions used to lock fds from the table; they do boundary checks so we
 * catch out of bounds accesses */
static inline int fd_lock(int fd)
{
	int r;

libjio/libjio/journal.c  view on Meta::CPAN

	if (rv != 0 && (errno == EINVAL || errno == EBADF)) {
		/* it seems to be legal that fsync() on directories is not
		 * implemented, so if this fails with EINVAL or EBADF, just
		 * call a global sync(); which is awful (and might still
		 * return before metadata is done) but it seems to be the
		 * saner choice; otherwise we just fail */
		sync();
		rv = 0;

		if (!already_warned_about_sync) {
			fprintf(stderr, "libjio warning: falling back on " \
					"sync() for directory syncing\n");
			already_warned_about_sync = 1;
		}
	}

	return rv;
}

/** Corrupt a journal file. Used as a last resource to prevent an applied
 * transaction file laying around */

libjio/tests/performance/performance.c  view on Meta::CPAN

		pthread_create(threads + i, NULL, &worker, (void *) i);
	}

	for (i = 0; i < nthreads; i++) {
		pthread_join(*(threads + i), NULL);
	}

	jclose(fs);
	jfsck(FILENAME, NULL, &ckres, 0);
	if (ckres.total != 0) {
		fprintf(stderr, "There were %d errors during the test\n",
				ckres.total);
		fprintf(stderr, "jfsck() was used to fix them, but that ");
		fprintf(stderr, "shouldn't happen.\n");
		return 1;
	}

	return 0;
}

libjio/tests/performance/random.c  view on Meta::CPAN

		pthread_create(threads + i, NULL, &worker, (void *) i);
	}

	for (i = 0; i < nthreads; i++) {
		pthread_join(*(threads + i), NULL);
	}

	jclose(fs);
	jfsck(FILENAME, NULL, &ckres, 0);
	if (ckres.total != 0) {
		fprintf(stderr, "There were %d errors during the test\n",
				ckres.total);
		fprintf(stderr, "jfsck() was used to fix them, but that ");
		fprintf(stderr, "shouldn't happen.\n");
		return 1;
	}

	return 0;
}



( run in 1.628 second using v1.01-cache-2.11-cpan-49f99fa48dc )