Skip to content

Commit

Permalink
🐞 fix(dfs_v2): fix readonly fs can not write
Browse files Browse the repository at this point in the history
  • Loading branch information
xqyjlj committed Nov 2, 2023
1 parent c00040b commit 8d47a37
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions components/dfs/dfs_v2/src/dfs_pcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ static void dfs_pcache_thread(void *parameter)
page->len = page->size;
}
//rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, page->page, page->size);
aspace->ops->write(page);
if (aspace->ops->write)
aspace->ops->write(page);

page->is_dirty = 0;

Expand Down Expand Up @@ -739,7 +740,8 @@ static void dfs_page_release(struct dfs_page *page)
page->len = page->size;
}
//rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, page->page, page->size);
aspace->ops->write(page);
if (aspace->ops->write)
aspace->ops->write(page);
page->is_dirty = 0;
}
RT_ASSERT(page->is_dirty == 0);
Expand Down Expand Up @@ -1066,6 +1068,8 @@ int dfs_aspace_read(struct dfs_file *file, void *buf, size_t count, off_t *pos)

if (file && file->vnode && file->vnode->aspace)
{
if (!(file->vnode->aspace->ops->read))
return ret;
struct dfs_vnode *vnode = file->vnode;
struct dfs_aspace *aspace = vnode->aspace;

Expand Down Expand Up @@ -1126,6 +1130,8 @@ int dfs_aspace_write(struct dfs_file *file, const void *buf, size_t count, off_t

if (file && file->vnode && file->vnode->aspace)
{
if (!(file->vnode->aspace->ops->write))
return ret;
struct dfs_vnode *vnode = file->vnode;
struct dfs_aspace *aspace = vnode->aspace;

Expand Down Expand Up @@ -1213,8 +1219,8 @@ int dfs_aspace_flush(struct dfs_aspace *aspace)
page->len = page->size;
}
//rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, page->page, page->size);

aspace->ops->write(page);
if (aspace->ops->write)
aspace->ops->write(page);

page->is_dirty = 0;
}
Expand Down

0 comments on commit 8d47a37

Please sign in to comment.