On Tue, Feb 11, 2014 at 01:28:01AM +0200, Marti Raudsepp wrote:
> On Tue, Feb 11, 2014 at 12:20 AM, Marti Raudsepp <ma...@juffo.org> wrote:
> > This is on Ubuntu 13.10 (kernel 3.11) with XFS (mount ed with noatime,
> > no other customizations).
> 
> I managed to track this down; XFS doesn't allow using O_DIRECT for
> writes smaller than the filesystem's sector size (probably same on
> other FSes). The XFS filesystem created by the Ubuntu installer uses
> 4kB sectors, for some weird reason:

I have added the attached, applied C comment about Direct I/O write
failures and mismatched block sizes.

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +
diff --git a/contrib/pg_test_fsync/pg_test_fsync.c b/contrib/pg_test_fsync/pg_test_fsync.c
new file mode 100644
index 669c419..682821a
*** a/contrib/pg_test_fsync/pg_test_fsync.c
--- b/contrib/pg_test_fsync/pg_test_fsync.c
*************** test_sync(int writes_per_op)
*** 369,374 ****
--- 369,380 ----
  		{
  			for (writes = 0; writes < writes_per_op; writes++)
  				if (write(tmpfile, buf, XLOG_BLCKSZ) != XLOG_BLCKSZ)
+ 				/*
+ 				 * This can generate write failures if the filesystem
+ 				 * has a large block size, e.g. 4k, and there is no
+ 				 * support for O_DIRECT writes smaller than the
+ 				 * file system block size, e.g. XFS.
+ 				 */
  					die("write failed");
  			if (lseek(tmpfile, 0, SEEK_SET) == -1)
  				die("seek failed");
-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to