首页 新闻 会员 周边 捐助

UBIFS读写文件的问题, 删除文件后存储空间不会主动释放, echo 2 > /proc/sys/vm/drop_caches可以释放

0
悬赏园豆:10 [待解决问题]

嵌入式系统,在UBIFS文件系统里面大量写文件再删除会导致df查询到的存储空间一直在减少,除非使用echo 2 > /proc/sys/vm/drop_caches或者sync, 否则df查询的空间一直在变小
无法理解这种现象, nr_dirty为0的情况下, 应该没有脏页,为什么释放slab会影响statfs查询到的磁盘信息.

# cat /proc/vmstat
nr_free_pages 2531
nr_zone_inactive_anon 397
nr_zone_active_anon 11243
nr_zone_inactive_file 223
nr_zone_active_file 5104
nr_zone_unevictable 0
nr_zone_write_pending 0
nr_mlock 0
nr_slab_reclaimable 4881
nr_slab_unreclaimable 1773
nr_page_table_pages 266
nr_kernel_stack 1392
nr_overhead 0
nr_bounce 0
nr_free_cma 45
nr_inactive_anon 397
nr_active_anon 11243
nr_inactive_file 223
nr_active_file 5104
nr_unevictable 0
nr_isolated_anon 0
nr_isolated_file 0
nr_pages_scanned 0
workingset_refault 230
workingset_activate 229
workingset_nodereclaim 0
nr_anon_pages 11154
nr_mapped 5466
nr_file_pages 5818
nr_dirty 0
nr_writeback 0
nr_writeback_temp 0
nr_shmem 491
nr_shmem_hugepages 0
nr_shmem_pmdmapped 0
nr_anon_transparent_hugepages 0
nr_unstable 0
nr_vmscan_write 0
nr_vmscan_immediate_reclaim 156
nr_dirtied 202922
nr_written 202880
nr_dirty_threshold 1280
nr_dirty_background_threshold 640
# df -h /
Filesystem                Size      Used Available Use% Mounted on
ubi:rootfs               84.6M     56.1M     28.5M  66% /
# free
             total       used       free     shared    buffers     cached
Mem:        114812     104628      10184       1976          0      23284
-/+ buffers/cache:      81344      33468
Swap:            0          0          0
#
# echo 2 > /proc/sys/vm/drop_caches
# df -h /
Filesystem                Size      Used Available Use% Mounted on
ubi:rootfs               84.6M     48.7M     35.9M  58% /
猫车的主页 猫车 | 菜鸟二级 | 园豆:392
提问于:2024-01-17 17:26
< >
分享
所有回答(1)
0

猜测删除文件操作之后,磁盘上对应磁盘空间的block未能被标记为可用,“echo 2 > /proc/sys/vm/drop_caches”用来释放页缓存和inodes,此操作导致前面被标记为不可用的磁盘空间被回收。(只是提供一个思路)

realzhangsan | 园豆:264 (菜鸟二级) | 2024-01-18 10:42
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册