1
0
mirror of https://github.com/linux-msm/rmtfs.git synced 2024-11-12 01:19:17 +00:00
rmtfs/rmtfs.h
Evan Green b08ef6f98e Use fdatasync instead of O_SYNC on storage
Opening the backing files with O_SYNC makes things really slow. So slow
in fact that the modem times out after 10 seconds waiting for the last
EFS sync to go through. I think this takes forever because rmtfs is
doing 512-byte reads and writes.

One option would be to make this bigger. But a better option is to not
use O_SYNC, but explicitly do an fdatasync() after the iovec operation
is complete. This is better because 1) it's way faster, we no longer see
10-12 second delays at rebooto time, and 2) partial syncs of the EFS
file aren't useful anyway.

Use fdatasync() as opposed to fsync() since it's not important for the
metadata to be synced, just the file contents.

Signed-off-by: Evan Green <evangreen86@gmail.com>
2021-08-09 14:33:25 -07:00

44 lines
1.3 KiB
C

#ifndef __RMTFS_H__
#define __RMTFS_H__
#include <stdint.h>
#include "qmi_rmtfs.h"
#define SECTOR_SIZE 512
struct qmi_packet {
uint8_t flags;
uint16_t txn_id;
uint16_t msg_id;
uint16_t msg_len;
uint8_t data[];
} __attribute__((__packed__));
struct rmtfs_mem;
struct rmtfs_mem *rmtfs_mem_open(void);
void rmtfs_mem_close(struct rmtfs_mem *rmem);
int64_t rmtfs_mem_alloc(struct rmtfs_mem *rmem, size_t size);
void rmtfs_mem_free(struct rmtfs_mem *rmem);
ssize_t rmtfs_mem_read(struct rmtfs_mem *rmem, unsigned long phys_address, void *buf, ssize_t len);
ssize_t rmtfs_mem_write(struct rmtfs_mem *rmem, unsigned long phys_address, const void *buf, ssize_t len);
struct rmtfd;
int storage_init(const char *storage_root, bool read_only, bool use_partitions);
struct rmtfd *storage_open(unsigned node, const char *path);
struct rmtfd *storage_get(unsigned node, int caller_id);
void storage_close(struct rmtfd *rmtfd);
int storage_get_caller_id(const struct rmtfd *rmtfd);
int storage_get_error(const struct rmtfd *rmtfd);
void storage_exit(void);
ssize_t storage_pread(const struct rmtfd *rmtfd, void *buf, size_t nbyte, off_t offset);
ssize_t storage_pwrite(struct rmtfd *rmtfd, const void *buf, size_t nbyte, off_t offset);
int storage_sync(struct rmtfd *rmtfd);
int rproc_init(void);
int rproc_start(void);
int rproc_stop(void);
#endif