Home | History | Annotate | Download | only in ext2fs

Lines Matching full:data

102 			       int count, void *data);
104 int count, const void *data);
107 int size, const void *data);
112 static void reuse_cache(io_channel channel, struct unix_private_data *data,
115 int count, void *data);
117 int count, const void *data);
141 struct unix_private_data *data;
144 data = (struct unix_private_data *) channel->private_data;
145 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
148 *stats = &data->io_stats;
157 struct unix_private_data *data,
167 data->io_stats.bytes_read += size;
168 location = ((ext2_loff_t) block * channel->block_size) + data->offset;
169 if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) {
173 if ((data->align == 0) ||
174 ((IS_ALIGNED(buf, data->align)) && IS_ALIGNED(size, data->align))) {
175 actual = read(data->dev, buf, size);
196 actual = read(data->dev, data->bounce, channel->block_size);
202 memcpy(buf, data->bounce, actual);
217 struct unix_private_data *data,
234 data->io_stats.bytes_written += size;
236 location = ((ext2_loff_t) block * channel->block_size) + data->offset;
237 if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) {
242 if ((data->align == 0) ||
243 ((IS_ALIGNED(buf, data->align)) && IS_ALIGNED(size, data->align))) {
244 actual = write(data->dev, buf, size);
263 actual = read(data->dev, data->bounce,
273 memcpy(data->bounce, buf, actual);
274 actual = write(data->dev, data->bounce, channel->block_size);
296 struct unix_private_data *data)
302 data->access_time = 0;
303 for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
311 data->align, &cache->buf);
315 if (data->align) {
316 if (data->bounce)
317 ext2fs_free_mem(&data->bounce);
318 retval = ext2fs_get_memalign(channel->block_size, data->align,
319 &data->bounce);
325 static void free_cache(struct unix_private_data *data)
330 data->access_time = 0;
331 for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
339 if (data->bounce)
340 ext2fs_free_mem(&data->bounce);
349 static struct unix_cache *find_cached_block(struct unix_private_data *data,
357 for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
364 cache->access_time = ++data->access_time;
379 static void reuse_cache(io_channel channel, struct unix_private_data *data,
383 raw_write_blk(channel, data, cache->block, 1, cache->buf);
388 cache->access_time = ++data->access_time;
395 struct unix_private_data *data,
404 for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
414 retval = raw_write_blk(channel, data,
428 struct unix_private_data *data = NULL;
444 retval = ext2fs_get_mem(sizeof(struct unix_private_data), &data);
454 io->private_data = data;
460 memset(data, 0, sizeof(struct unix_private_data));
461 data->magic = EXT2_ET_MAGIC_UNIX_IO_CHANNEL;
462 data->io_stats.num_fields = 2;
473 data->flags = flags;
476 data->dev = open64(io->name, open_flags);
478 data->dev = open(io->name, open_flags);
480 if (data->dev < 0) {
486 if (fcntl(data->dev, f_nocache, 1) < 0) {
494 if (ioctl(data->dev, BLKSSZGET, &data->align) != 0)
495 data->align = io->block_size;
504 data->align = 512;
508 if ((retval = alloc_cache(io, data)))
517 error = ioctl(data->dev, BLKROGET, &readonly);
519 close(data->dev);
546 (fstat(data->dev, &st) == 0) &&
564 if (data) {
565 free_cache(data);
566 ext2fs_free_mem(&data);
575 struct unix_private_data *data;
579 data = (struct unix_private_data *) channel->private_data;
580 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
586 retval = flush_cached_blocks(channel, data, 0);
589 if (close(data->dev) < 0)
591 free_cache(data);
602 struct unix_private_data *data;
606 data = (struct unix_private_data *) channel->private_data;
607 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
611 if ((retval = flush_cached_blocks(channel, data, 0)))
616 free_cache(data);
617 if ((retval = alloc_cache(channel, data)))
627 struct unix_private_data *data;
634 data = (struct unix_private_data *) channel->private_data;
635 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
638 return raw_read_blk(channel, data, block, count, buf);
645 if ((retval = flush_cached_blocks(channel, data, 0)))
647 return raw_read_blk(channel, data, block, count, buf);
653 if ((cache = find_cached_block(data, block, &reuse[0]))) {
669 reuse_cache(channel, data
670 if ((retval = raw_read_blk(channel, data, block, 1,
684 if (find_cached_block(data, block+i, &reuse[i]))
689 if ((retval = raw_read_blk(channel, data, block, i, cp)))
696 reuse_cache(channel, data, cache, block++);
714 struct unix_private_data *data;
721 data = (struct unix_private_data *) channel->private_data;
722 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
725 return raw_write_blk(channel, data, block, count, buf);
732 if ((retval = flush_cached_blocks(channel, data, 1)))
734 return raw_write_blk(channel, data, block, count, buf);
744 retval = raw_write_blk(channel, data, block, count, buf);
748 cache = find_cached_block(data, block, &reuse);
751 reuse_cache(channel, data, cache, block);
772 struct unix_private_data *data;
777 data = (struct unix_private_data *) channel->private_data;
778 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
780 if (data->align != 0) {
791 if ((retval = flush_cached_blocks(channel, data, 1)))
795 if (lseek(data->dev, offset + data->offset, SEEK_SET) < 0)
798 actual = write(data->dev, buf, size);
806 * Flush data buffers to disk.
810 struct unix_private_data *data;
814 data = (struct unix_private_data *) channel->private_data;
815 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
818 retval = flush_cached_blocks(channel, data, 0);
820 fsync(data->dev);
827 struct unix_private_data *data;
832 data = (struct unix_private_data *) channel->private_data;
833 EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
842 data->offset = tmp;
843 if (data->offset < 0)