[Ocfs2-tools-commits] jlbec commits r239 - in trunk: extras
libocfs2 ocfs2cdsl
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Sep 16 16:56:10 CDT 2004
Author: jlbec
Date: 2004-09-16 16:56:08 -0500 (Thu, 16 Sep 2004)
New Revision: 239
Modified:
trunk/extras/
trunk/libocfs2/unix_io.c
trunk/ocfs2cdsl/
Log:
o Teach unix_io.c to discover a minimum O_DIRECT blocksize.
o Fix svn:ignore values for mark and manish.
Property changes on: trunk/extras
___________________________________________________________________
Name: svn:ignore
- .*.sw?
find_hardlinks
find_dup_extents
+ .*.sw?
find_hardlinks
find_dup_extents
find_inode_paths
Modified: trunk/libocfs2/unix_io.c
===================================================================
--- trunk/libocfs2/unix_io.c 2004-09-16 02:07:16 UTC (rev 238)
+++ trunk/libocfs2/unix_io.c 2004-09-16 21:56:08 UTC (rev 239)
@@ -55,6 +55,29 @@
};
+static errcode_t io_validate_o_direct(io_channel *channel)
+{
+ errcode_t ret = OCFS2_ET_UNEXPECTED_BLOCK_SIZE;
+ int block_size;
+ char *blk;
+
+ for (block_size = io_get_blksize(channel);
+ block_size <= OCFS2_MAX_BLOCKSIZE;
+ block_size <<= 1) {
+ io_set_blksize(channel, block_size);
+ ret = ocfs2_malloc_block(channel, &blk);
+ if (ret)
+ break;
+
+ ret = io_read_block(channel, 0, 1, blk);
+ ocfs2_free(&blk);
+ if (!ret)
+ break;
+ }
+
+ return ret;
+}
+
errcode_t io_open(const char *name, int flags, io_channel **channel)
{
errcode_t ret;
@@ -88,6 +111,10 @@
goto out_name;
}
+ ret = io_validate_o_direct(chan);
+ if (ret)
+ goto out_close; /* FIXME: bindraw here */
+
/* Workaround from e2fsprogs */
#ifdef __linux__
#undef RLIM_INFINITY
@@ -127,6 +154,10 @@
*channel = chan;
return 0;
+out_close:
+ /* Ignore the return, leave the original error */
+ close(chan->io_fd);
+
out_name:
ocfs2_free(&chan->io_name);
Property changes on: trunk/ocfs2cdsl
___________________________________________________________________
Name: svn:ignore
+ .*.sw?
ocfs2cdsl
stamp-md5
More information about the Ocfs2-tools-commits
mailing list