summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
65ee799)
The align field which indicated the required data alignment of data
buffers was stored in a field specific to the unix_io manager. Move
it to the top-level io_channel structure so it can be better
generalized.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
long reserved[14];
void *private_data;
void *app_data;
long reserved[14];
void *private_data;
void *app_data;
};
struct struct_io_stats {
};
struct struct_io_stats {
if ((value = safe_getenv("TEST_IO_WRITE_ABORT")) != NULL)
data->write_abort_count = strtoul(value, NULL, 0);
if ((value = safe_getenv("TEST_IO_WRITE_ABORT")) != NULL)
data->write_abort_count = strtoul(value, NULL, 0);
+ if (data->real)
+ io->align = data->real->align;
+
data = (struct test_private_data *) channel->private_data;
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL);
data = (struct test_private_data *) channel->private_data;
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL);
retval = io_channel_set_blksize(data->real, blksize);
retval = io_channel_set_blksize(data->real, blksize);
+ channel->align = data->real->align;
+ }
if (data->set_blksize)
data->set_blksize(blksize, retval);
if (data->flags & TEST_FLAG_SET_BLKSIZE)
if (data->set_blksize)
data->set_blksize(blksize, retval);
if (data->flags & TEST_FLAG_SET_BLKSIZE)
retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
goto error_out;
}
retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
goto error_out;
}
- if ((data->align == 0) ||
- ((IS_ALIGNED(buf, data->align)) && IS_ALIGNED(size, data->align))) {
+ if ((channel->align == 0) ||
+ (IS_ALIGNED(buf, channel->align) &&
+ IS_ALIGNED(size, channel->align))) {
actual = read(data->dev, buf, size);
if (actual != size) {
short_read:
actual = read(data->dev, buf, size);
if (actual != size) {
short_read:
- if ((data->align == 0) ||
- ((IS_ALIGNED(buf, data->align)) && IS_ALIGNED(size, data->align))) {
+ if ((channel->align == 0) ||
+ (IS_ALIGNED(buf, channel->align) &&
+ IS_ALIGNED(size, channel->align))) {
actual = write(data->dev, buf, size);
if (actual != size) {
short_write:
actual = write(data->dev, buf, size);
if (actual != size) {
short_write:
if (cache->buf)
ext2fs_free_mem(&cache->buf);
retval = ext2fs_get_memalign(channel->block_size,
if (cache->buf)
ext2fs_free_mem(&cache->buf);
retval = ext2fs_get_memalign(channel->block_size,
- data->align, &cache->buf);
+ channel->align, &cache->buf);
if (retval)
return retval;
}
if (retval)
return retval;
}
if (data->bounce)
ext2fs_free_mem(&data->bounce);
if (data->bounce)
ext2fs_free_mem(&data->bounce);
- retval = ext2fs_get_memalign(channel->block_size, data->align,
+ retval = ext2fs_get_memalign(channel->block_size,
+ channel->align,
&data->bounce);
}
return retval;
&data->bounce);
}
return retval;
#ifdef BLKSSZGET
if (flags & IO_FLAG_DIRECT_IO) {
#ifdef BLKSSZGET
if (flags & IO_FLAG_DIRECT_IO) {
- if (ioctl(data->dev, BLKSSZGET, &data->align) != 0)
- data->align = io->block_size;
+ if (ioctl(data->dev, BLKSSZGET, &io->align) != 0)
+ io->align = io->block_size;
* Some operating systems require that the buffers be aligned,
* regardless of O_DIRECT
*/
* Some operating systems require that the buffers be aligned,
* regardless of O_DIRECT
*/
data = (struct unix_private_data *) channel->private_data;
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
data = (struct unix_private_data *) channel->private_data;
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
- if (data->align != 0) {
+ if (channel->align != 0) {
#ifdef ALIGN_DEBUG
printf("unix_write_byte: O_DIRECT fallback\n");
#endif
#ifdef ALIGN_DEBUG
printf("unix_write_byte: O_DIRECT fallback\n");
#endif