Commit 188d9cf
committed
perf(linux/rm): optimize descriptor usage by keeping dir_fd open in safe_remove_dir_recursive_impl
Reuse the existing directory file descriptor instead of opening/closing new ones for each subdirectory or file during recursive removal. This simplifies the code, reduces overhead from descriptor management, and prevents potential deep descriptor stacks on systems with many nested directories. Removed unnecessary `drop(dir_fd)` call and adjusted progress bar increments accordingly.1 parent 1f78fc6 commit 188d9cf
1 file changed
+9
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | | - | |
| 346 | + | |
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
360 | 359 | | |
361 | 360 | | |
362 | 361 | | |
| |||
383 | 382 | | |
384 | 383 | | |
385 | 384 | | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
| 385 | + | |
| 386 | + | |
397 | 387 | | |
| 388 | + | |
| 389 | + | |
398 | 390 | | |
399 | 391 | | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
| 392 | + | |
| 393 | + | |
411 | 394 | | |
| 395 | + | |
| 396 | + | |
412 | 397 | | |
413 | 398 | | |
414 | 399 | | |
| |||
0 commit comments