2023-10-02 11:01:00 This seems to be the "seminal paper" on log structured file systems: 2023-10-02 11:01:02 https://web.stanford.edu/~ouster/cgi-bin/papers/lfs.pdf 2023-10-02 11:03:42 So is a "log file system" sort of the other extreme from an unjournaled filesystem? 2023-10-02 11:05:10 My understanding of journaling is you have a journal/log for new data for speed and reliability but periodically move data into efficient access patterns for long term storage 2023-10-02 11:07:41 Yes, the entire job is done by writing sequentially through the disk. At least that's the "primary strategy." 2023-10-02 11:08:00 As we discussed the other day, heat segregation might cause some deviations. 2023-10-02 11:08:14 You don't update any data "in place." 2023-10-02 11:09:02 One of the assumptions that makes it effective is that you presume a lot of RAM, so that most reads are satisfied from a RAM cache. 2023-10-02 11:09:14 That lets you keep the seek head at the write point, so you eliminate most seeks. 2023-10-02 11:09:27 In a flash drive seeking isn't really an issue anyway, though. 2023-10-02 11:10:50 Seems like it works fine with modest RAM and assuming you can read the whole disk in one go relatively quickly 2023-10-02 11:11:18 Then you can build a RAM index/tree and you wouldn't even need to store any index structures on disk 2023-10-02 11:11:30 The only advantage of writing index structures would be initial reading cost 2023-10-02 11:16:27 Yes, I'd think so too. 2023-10-02 11:17:00 Anyway, though, at the time it was proposed spinning disks were still primary, and if you do have to service random reads from the disk you get back a lot of seek time. 2023-10-02 11:17:50 The way I'm approaching this, for my project, is that I primarily need the flash to hold my stuff between sessions, when power is off. 2023-10-02 11:18:03 During a session my guess is that most often I'll read once and then just "work." 2023-10-02 11:18:39 And in my case it's a NOR flash, so reading is a non-issue anyway. 2023-10-02 11:18:45 Reads like RAM. 2023-10-02 11:19:29 Yeah I'm thinking for a small storage device like a NOR Flash you can handle something that you just index yourself by reading the whole journal at power-on 2023-10-02 11:19:38 Yep. 2023-10-02 11:19:43 It's worth it for how it simplifies the structure/code 2023-10-02 11:20:01 Of course, I'm using a calculator as my "target application," so I'll need to store all of my variable values across power offs. 2023-10-02 11:20:10 But for a big capacity disk that would be rubbish 2023-10-02 11:20:25 I guess think of it as saving a "workspace." 2023-10-02 11:20:31 You really don't need a filesystem for a calculator though 2023-10-02 11:20:54 No, and I'm not thinking quite in those terms. Still thinking in terms of blocks. 2023-10-02 11:21:00 You probably need similar idea to journal for your wear levelling though 2023-10-02 11:21:04 But I'm planning a mapping... 2023-10-02 11:21:08 Right - ^ that. 2023-10-02 11:21:34 Also store in a format that increases number of 1's 2023-10-02 11:21:41 0's cause more wear 2023-10-02 11:21:49 If I remember right 2023-10-02 11:21:50 Well, erases cause wear. 2023-10-02 11:22:01 When you erase the bits either all go to 0 or all go to 1. 2023-10-02 11:22:12 And "writing" is how you switch some of them to the other value. 2023-10-02 11:22:18 I'm thinking of erase-to-1, the programming causes some wear too if I remember right 2023-10-02 11:22:49 I don't know for sure, but I've always thought you could write a cell more than once, so long as you were only taking bits from "erased" to "not erased." 2023-10-02 11:23:03 It's often easy to reduce number of 0's, you can have a bit represent whether a block should be inverted on read 2023-10-02 11:23:15 You can usually program 1 or a few times, depending on the NOR 2023-10-02 11:23:22 But a limited number of programs 2023-10-02 11:23:23 It probably varies from device to device. 2023-10-02 11:23:34 Yes that varies a lot 2023-10-02 11:23:41 For NOR especially 2023-10-02 11:24:37 I'll need to save my page mapping across power cycles. I was thinking i'd just write it to whatever is the write point and then save that location somewhere - tricks like we're talking about might be useful when saving that table location in a "special place." 2023-10-02 11:24:53 that probably made no sense. 2023-10-02 11:24:58 I didn't phrase it very well. 2023-10-02 11:25:28 I just figure I need one piece of data in a known location, to find the stuff that moves. 2023-10-02 11:25:40 And in that fixed location, any tricks to extend lifetime would be of interest. 2023-10-02 11:26:16 I could just use a signature and a time/date stamp on the mapping table and then just search the whole flash for the latest one at power on. 2023-10-02 11:26:43 Since it's only 512k, searching all of it wouldn't be that big of a deal, if you only had to do it once each session. 2023-10-02 11:33:55 I'm still pondering exactly how far toward a file system to go. My wife's calculator (HP-48) supports a "directory structure." It feels a lot like a typical file system. 2023-10-02 11:34:35 And "programs" are stored by name, a lot like just having source code in a string variable. 2023-10-02 11:35:27 I think this system I'm planning now may turn out to be fully decompilable, so I might not actually need "source." 2023-10-02 11:35:39 Just decompile for screen rendering. Not 100% sure of that yet, though. 2023-10-02 11:36:48 I don't want to get SO focused on a calculator, though, that I overlook other applications completely. 2023-10-02 11:45:27 is ok to have lowercase words and symbols into them? e.g. kd3@C or kd3@O ? 2023-10-02 11:47:20 Yes, Forth is fine with that. 2023-10-02 11:47:40 "Standard" operation is to be case sensitive, but how you "use that" is entirely up to you. 2023-10-02 11:47:59 You can even define fully numeric names, if you want to mess with your own head. 2023-10-02 11:48:06 Forth doesn't care. 2023-10-02 11:48:13 programmers might 2023-10-02 11:48:23 Sometimes you run into case insensitive ones, but that has to be done "deliberately." 2023-10-02 11:48:23 : 0 1 ; :P 2023-10-02 11:48:32 Yep. 2023-10-02 11:49:01 but Forth words are case sensitive usually, right? 2023-10-02 11:49:03 Some older systems would sometimes define : 0 0 ; so it didn't have to parse 0 every time 2023-10-02 11:49:07 Yes. 2023-10-02 11:49:14 Case sensitivity is the norm. 2023-10-02 11:49:28 But Forth has absolutely zero concept of "reserved words." 2023-10-02 11:49:32 Nothing is off limits. 2023-10-02 11:50:26 Usually, it's anything but a space 2023-10-02 11:50:47 Well, yes - spaces are special. 2023-10-02 11:51:04 indeed 2023-10-02 11:51:37 vms14 mentioned multi-word word names the other day, and I've thought a teeny bit about it on occasion. 2023-10-02 11:52:07 You could make a dictionary entry with spaces in the name no problem - it's the parsing of the source out of the input stream where the spaces are relevant. 2023-10-02 11:52:21 It only ever tries to look up words with no internal spaces. 2023-10-02 11:52:21 multi-word word? a word with spaces into it? 2023-10-02 11:52:37 And the standard tools for word creation won't let you make an internal space. 2023-10-02 11:52:43 yeah 2023-10-02 11:52:46 But the dictionary as a data structure could hold such a thing. 2023-10-02 11:53:07 i use lisp notation for space, e.g. some-thing 2023-10-02 11:53:23 That works fine in Forth. 2023-10-02 11:53:48 yeah 2023-10-02 12:06:54 let's say i have x,y in the stack, and i want to do some math operations on those coordinates, my functions results in `1.0 1.0 dup sin swap cos * swap dup sin swap cos *` where 1.0 1.0 are x y coordinates, but ..isn't much overhead 3 swaps? consider if we do that millions of times.. 2023-10-02 12:09:33 basically the operation is x,y => sin(x)*cos(x), sin(y)*cos(y) 2023-10-02 12:13:07 Well, sure - anything you do a million times is going to take some amount of time. 2023-10-02 12:13:41 However, a couple of stack motions in the midst of a bunch of floating point arithmetic, and particularly including trig functions, isn't going to add much relatively speaking. 2023-10-02 12:13:43 rendar: maybe. doing a lot of stack operations can slow your code down if it's not being compiled to optimized machine code. on the other hand, if other things like sin and cos take a lot longer than swap, the overall hit to performance may not be noticeable 2023-10-02 12:14:28 hmm i see 2023-10-02 12:14:46 let's consider that in my case a swap would result in swapping 32 bytes 2023-10-02 12:15:20 How would it do that? 2023-10-02 12:15:26 Swap swaps a pair of cells. 2023-10-02 12:15:34 in my case 1 cell is 32 bytes 2023-10-02 12:15:37 So that would be eight bytes in a 64-bit system. 2023-10-02 12:15:43 I see - you're creating something new? 2023-10-02 12:15:48 yeah 2023-10-02 12:16:01 You're dealing with 32 BYTE floating point numbers?? 2023-10-02 12:16:03 this is not a Forth like we know 2023-10-02 12:16:08 lol nope 2023-10-02 12:16:20 but i have an algebraic type which includes also floating points 2023-10-02 12:16:29 I see. 2023-10-02 12:16:45 Well, obviously swapping 32 byte items will cost more than swapping 64-bit ones. 2023-10-02 12:17:05 yeah 2023-10-02 12:17:11 But worse, I'm guessing you'll have written that swap word in Forth, so you'll have some standard Forth overhead in that. 2023-10-02 12:17:16 Normal swap is a fast primitive. 2023-10-02 12:17:45 What's actually on the stack? The whole 32 bytes or a pointer? 2023-10-02 12:17:55 no that swap word executes some code written in Rust 2023-10-02 12:18:08 GeDaMo, the whole 32 bytes thing 2023-10-02 12:19:20 At least it should still be in L1 cache 2023-10-02 12:19:46 indeed 2023-10-02 12:19:55 but i think i'll add some facilities to manipulate stack 2023-10-02 12:20:52 e.g., let's consider this is the stack |1.0 2.0| so, stack-0 is 2.0 and stack-1 is 1.0, now, if *without swapping* i can fake that top of stack is stack-1, i can call cos and sin operations into that 2023-10-02 12:21:36 basically i manipulate top of stack index 2023-10-02 12:22:18 without moving items, that remains just there 2023-10-02 12:26:58 Hmmm. 2023-10-02 12:27:15 You'd have to guarantee that that code wouldn't push anything onto the stack. 2023-10-02 12:27:44 Somehow you have to keep up with what memory is "in use." 2023-10-02 12:27:53 And usually the stack0 item is cached in a register. 2023-10-02 12:28:01 But your system sounds pretty different. 2023-10-02 12:29:15 indeed 2023-10-02 12:33:47 I do still feel that the floating point math and the trig functions are likely to dominate your timing. 2023-10-02 12:34:23 Especially since, as GeDaMo pointed out, those stack items are likely in your cache. 2023-10-02 12:46:20 yeah i think so 2023-10-02 14:52:37 thrig: hi, are you thrig of thrig.me fame? 2023-10-02 14:54:23 I was reading the Funky Filenames post, I was just curious if you knew: is there some program that lists all the files on a filesystem by inode, without having to walk the directory trees? 2023-10-02 14:55:36 it would probably be a very low level tool that knows how to find where the filesystem puts inodes 2023-10-02 14:56:04 I can't think of a compelling reason that would be necessary, but was curious 2023-10-02 14:57:04 I couldn't find one in a shallow duckduckgo search 2023-10-02 14:57:27 maybe I should search for filesystem specific utilities 2023-10-02 14:58:53 e2fsprogs, that sounds promising 2023-10-02 14:59:56 you dd over some portion of your disk and want the inodes back would be one case 2023-10-02 15:03:53 I just found fstransform package ... automatically converts file system to another file system type without copying the files 2023-10-02 15:04:18 that is fancy 2023-10-02 15:04:57 a few file recovery tools available in Guix, maybe one of them has option to list the inodes