Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEGA65_FTP: Add a 'defrag' command #52

Open
gurcei opened this issue Apr 11, 2021 · 2 comments
Open

MEGA65_FTP: Add a 'defrag' command #52

gurcei opened this issue Apr 11, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@gurcei
Copy link
Collaborator

gurcei commented Apr 11, 2021

A little Discord discussion on this recently:

My thoughts for it are:

  1. For a future defrag MYFILE.D81 command, behind the scenes, I'd just be doing a get, delete and put behind the scenes.

  2. For the case of trying to put MYFILE.D81 where it already exists on the sd-card in a fragmented state, I've added a function into mega65_ftp.c called is_fragmented(filename) to check if an existing file is fragmented. So the logic here could be:

On upload_file()
{
  If file exists on sd-card then
  {
    If `is_fragmented(filename)` then
      delete existing file
  }
  copy across the new file
}
@lydon42 lydon42 added the enhancement New feature or request label Jul 26, 2022
@lydon42
Copy link
Member

lydon42 commented Sep 25, 2022

Implemented in:
52a7047
c98499b
9901cc8

is_fragmented can still be optimized a bit (no need to go through the whole file, if it finds the first non-consecutive cluster, it can return fragmentation directly). And it needs to be used, which is not done yet.

@lydon42
Copy link
Member

lydon42 commented May 20, 2024

So this is no defrag command, but it will not reuse an existing files clusters if it was fragmented, and instead delete it, so that it is recreated in one continues clusterchain.

I think that should solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants