Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Use ioctl(F2FS_IOC_GET_FEATURES) to determine whether or not atomic batch writes are available. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | batch-atomic-write |
Files: | files | file ages | folders |
SHA3-256: |
532bbf1f2b1028db4e581c756533aa66 |
User & Date: | dan 2017-07-21 21:06:24.650 |
Context
2017-07-22
| ||
16:00 | Omit unused batch-atomic-write code if SQLITE_ENABLE_BATCH_ATOMIC_WRITE is not defined. (check-in: a89b62c496 user: drh tags: batch-atomic-write) | |
2017-07-21
| ||
21:06 | Use ioctl(F2FS_IOC_GET_FEATURES) to determine whether or not atomic batch writes are available. (check-in: 532bbf1f2b user: dan tags: batch-atomic-write) | |
20:29 | Fix typo in comment. No changes to code. (check-in: 65ec077ba6 user: mistachkin tags: batch-atomic-write) | |
Changes
Changes to src/os_unix.c.
︙ | ︙ | |||
328 329 330 331 332 333 334 335 336 337 338 339 340 341 | #endif #define F2FS_IOCTL_MAGIC 0xf5 #define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1) #define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2) #define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3) #define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) /* ** Different Unix systems declare open() in different ways. Same use ** open(const char*,int,mode_t). Others use open(const char*,int,...). ** The difference is important when using a pointer to the function. ** | > > > | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | #endif #define F2FS_IOCTL_MAGIC 0xf5 #define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1) #define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2) #define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3) #define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) #define F2FS_IOC_GET_FEATURES _IOR(F2FS_IOCTL_MAGIC, 12, u32) #define F2FS_FEATURE_ATOMIC_WRITE 0x0004 /* ** Different Unix systems declare open() in different ways. Same use ** open(const char*,int,mode_t). Others use open(const char*,int,...). ** The difference is important when using a pointer to the function. ** |
︙ | ︙ | |||
503 504 505 506 507 508 509 | { "lstat", (sqlite3_syscall_ptr)lstat, 0 }, #else { "lstat", (sqlite3_syscall_ptr)0, 0 }, #endif #define osLstat ((int(*)(const char*,struct stat*))aSyscall[27].pCurrent) { "ioctl", (sqlite3_syscall_ptr)ioctl, 0 }, | | | 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | { "lstat", (sqlite3_syscall_ptr)lstat, 0 }, #else { "lstat", (sqlite3_syscall_ptr)0, 0 }, #endif #define osLstat ((int(*)(const char*,struct stat*))aSyscall[27].pCurrent) { "ioctl", (sqlite3_syscall_ptr)ioctl, 0 }, #define osIoctl ((int(*)(int,int,...))aSyscall[28].pCurrent) }; /* End of the overrideable system calls */ /* ** On some systems, calls to fchown() will trigger a message in a security ** log if they come from non-root processes. So avoid calling fchown() if |
︙ | ︙ | |||
3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 | ** There are two versions of this function. One for QNX and one for all ** other systems. */ #ifndef __QNXNTO__ static void setDeviceCharacteristics(unixFile *pFd){ if( pFd->sectorSize==0 ){ int res; assert( pFd->deviceCharacteristics==0 ); /* Check for support for F2FS atomic batch writes. */ | > | | < | 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 | ** There are two versions of this function. One for QNX and one for all ** other systems. */ #ifndef __QNXNTO__ static void setDeviceCharacteristics(unixFile *pFd){ if( pFd->sectorSize==0 ){ int res; u32 f = 0; assert( pFd->deviceCharacteristics==0 ); /* Check for support for F2FS atomic batch writes. */ res = osIoctl(pFd->h, F2FS_IOC_GET_FEATURES, &f); if( res==0 && (f & F2FS_FEATURE_ATOMIC_WRITE) ){ pFd->deviceCharacteristics = SQLITE_IOCAP_BATCH_ATOMIC | SQLITE_IOCAP_ATOMIC | SQLITE_IOCAP_SEQUENTIAL | SQLITE_IOCAP_SAFE_APPEND; } |
︙ | ︙ |