25
25
#include "ec.h"
26
26
#include "inode.h"
27
27
#include "journal.h"
28
+ #include "journal_reclaim.h"
28
29
#include "keylist.h"
29
30
#include "move.h"
30
31
#include "movinggc.h"
@@ -138,6 +139,7 @@ do { \
138
139
write_attribute (trigger_gc );
139
140
write_attribute (trigger_discards );
140
141
write_attribute (trigger_invalidates );
142
+ write_attribute (trigger_journal_flush );
141
143
write_attribute (prune_cache );
142
144
write_attribute (btree_wakeup );
143
145
rw_attribute (btree_gc_periodic );
@@ -500,7 +502,7 @@ STORE(bch2_fs)
500
502
501
503
/* Debugging: */
502
504
503
- if (!test_bit ( BCH_FS_rw , & c -> flags ))
505
+ if (!bch2_write_ref_tryget ( c , BCH_WRITE_REF_sysfs ))
504
506
return - EROFS ;
505
507
506
508
if (attr == & sysfs_prune_cache ) {
@@ -533,6 +535,11 @@ STORE(bch2_fs)
533
535
if (attr == & sysfs_trigger_invalidates )
534
536
bch2_do_invalidates (c );
535
537
538
+ if (attr == & sysfs_trigger_journal_flush ) {
539
+ bch2_journal_flush_all_pins (& c -> journal );
540
+ bch2_journal_meta (& c -> journal );
541
+ }
542
+
536
543
#ifdef CONFIG_BCACHEFS_TESTS
537
544
if (attr == & sysfs_perf_test ) {
538
545
char * tmp = kstrdup (buf , GFP_KERNEL ), * p = tmp ;
@@ -553,6 +560,7 @@ STORE(bch2_fs)
553
560
size = ret ;
554
561
}
555
562
#endif
563
+ bch2_write_ref_put (c , BCH_WRITE_REF_sysfs );
556
564
return size ;
557
565
}
558
566
SYSFS_OPS (bch2_fs );
@@ -651,6 +659,7 @@ struct attribute *bch2_fs_internal_files[] = {
651
659
& sysfs_trigger_gc ,
652
660
& sysfs_trigger_discards ,
653
661
& sysfs_trigger_invalidates ,
662
+ & sysfs_trigger_journal_flush ,
654
663
& sysfs_prune_cache ,
655
664
& sysfs_btree_wakeup ,
656
665
0 commit comments