]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Use ioctl(F2FS_IOC_GET_FEATURES) to determine whether or not atomic batch
authordan <dan@noemail.net>
Fri, 21 Jul 2017 21:06:24 +0000 (21:06 +0000)
committerdan <dan@noemail.net>
Fri, 21 Jul 2017 21:06:24 +0000 (21:06 +0000)
writes are available.

FossilOrigin-Name: 532bbf1f2b1028db4e581c756533aa660e482d833caaed4eafb299ef9b584f3a

manifest
manifest.uuid
src/os_unix.c

index e651e78919a7a20fff660eed8bbc724abdb8aa20..1433d6978f0c0c504d01b55c1507d75b5adb428f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\stypo\sin\scomment.\s\sNo\schanges\sto\scode.
-D 2017-07-21T20:29:06.248
+C Use\sioctl(F2FS_IOC_GET_FEATURES)\sto\sdetermine\swhether\sor\snot\satomic\sbatch\nwrites\sare\savailable.
+D 2017-07-21T21:06:24.650
 F Makefile.in d9873c9925917cca9990ee24be17eb9613a668012c85a343aef7e5536ae266e8
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 02b469e9dcd5b7ee63fc1fb05babc174260ee4cfa4e0ef2e48c3c6801567a016
@@ -436,7 +436,7 @@ F src/os.c add02933b1dce7a39a005b00a2f5364b763e9a24
 F src/os.h 8e976e59eb4ca1c0fca6d35ee803e38951cb0343
 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
 F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
-F src/os_unix.c eca7004f2cde959ed233951256e22aa4169c72f69b831e14276d0bdded4372f5
+F src/os_unix.c 7feae9cad46b5e43a87bf15133dd463b72ed7b8ad913833981582d8cd3f3802f
 F src/os_win.c 2a6c73eef01c51a048cc4ddccd57f981afbec18a
 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
 F src/pager.c a42704980ed4ce38ed75981acf12a4d34bea2419306c7ffe26940869c458df48
@@ -1637,7 +1637,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 83077ec8b5804e6c709fa4f0b50afec9eae6d5b603cc4c3e8a408ed6b2bfaf28
-R b334012c21dfa06dd301dc7ad606c856
-U mistachkin
-Z fe62579b0ed14603dc9bb2d3159486da
+P 65ec077ba63ab84ab8da91033adcf4a57bb9269ebcdd10f9e6c97c265512a80c
+R 327ce51aa62d96bf2e9523d47812fe94
+U dan
+Z 311d111b16e6fbf70dad068ea69fda6d
index 00d2c0502d342249f863280137e620734f84de97..e23616fc1432c26b3d65c77b01d4c7f57fa6fd12 100644 (file)
@@ -1 +1 @@
-65ec077ba63ab84ab8da91033adcf4a57bb9269ebcdd10f9e6c97c265512a80c
\ No newline at end of file
+532bbf1f2b1028db4e581c756533aa660e482d833caaed4eafb299ef9b584f3a
\ No newline at end of file
index 3397b3a2138cdc19a2a62d10eb811171a8de8fa2..460b0a9bdca220dbc4a9c9fb806f55b61c03d20a 100644 (file)
@@ -332,6 +332,9 @@ static pid_t randomnessPid = 0;
 #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
 
 
 /*
@@ -507,7 +510,7 @@ static struct unix_syscall {
 #define osLstat      ((int(*)(const char*,struct stat*))aSyscall[27].pCurrent)
 
   { "ioctl",         (sqlite3_syscall_ptr)ioctl,          0 },
-#define osIoctl ((int(*)(int,int))aSyscall[28].pCurrent)
+#define osIoctl ((int(*)(int,int,...))aSyscall[28].pCurrent)
 
 }; /* End of the overrideable system calls */
 
@@ -3894,12 +3897,12 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
 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_START_VOLATILE_WRITE);
-    if( res==SQLITE_OK ){
-      osIoctl(pFd->h, F2FS_IOC_ABORT_VOLATILE_WRITE);
+    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 |