yamt commented on PR #2913: URL: https://github.com/apache/nuttx/pull/2913#issuecomment-2791477503
> > > > > Any reason there isn't a sync in [`littlefs_truncate`](https://github.com/apache/nuttx/blob/90e9b2426d54682070b0fcc38ad5415bbf77f733/fs/littlefs/lfs_vfs.c#L929), > > > > > > > > > > > > good idea, patch is welcome. > > > > > > > > > i agree it's a good idea to make O_TRUNC and truncate consistent. i don't think it's a good idea to make this hack in the first place though. it's better to leave it to user applications. my suggestion is to revert this PR to make it consistent. > > > > > then? The woraround for users like me is to open the file without `O_TRUNC` and then call `truncate` to ensure no commit. > > > > > > > > > > > > but, the sync still need in open to ensure the truncate take effect immediately, but the sync could be called only when O_TRUNC is specified. > > > > > > > > > a user application which needs the behavior can call fsync by itself. > > > > > > the behaviour of littlefs wrapper should be consistent with other nuttx supported fs(e.g. fatfs, smartfs, spiffs). So before you revert this patch, please make sure you align other fs with the same behaviour, thanks. > > it doesn't make much sense when we are talking about a low-level behavior, which can vary among filesystems. (ie. when O_TRUNC makes the disk space available) anyway, i myself have no plan to change it either ways. i updated the comment in https://github.com/apache/nuttx/pull/16171 with my understanding from the discussion. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org