@@ -828,25 +828,35 @@ int bch2_btree_bit_mod_buffered(struct btree_trans *trans, enum btree_id btree,
828
828
return bch2_trans_update_buffered (trans , btree , & k );
829
829
}
830
830
831
- int bch2_trans_log_msg (struct btree_trans * trans , struct printbuf * buf )
831
+ static int __bch2_trans_log_str (struct btree_trans * trans , const char * str , unsigned len )
832
832
{
833
- unsigned u64s = DIV_ROUND_UP (buf -> pos , sizeof (u64 ));
834
-
835
- int ret = buf -> allocation_failure ? - BCH_ERR_ENOMEM_trans_log_msg : 0 ;
836
- if (ret )
837
- return ret ;
833
+ unsigned u64s = DIV_ROUND_UP (len , sizeof (u64 ));
838
834
839
835
struct jset_entry * e = bch2_trans_jset_entry_alloc (trans , jset_u64s (u64s ));
840
- ret = PTR_ERR_OR_ZERO (e );
836
+ int ret = PTR_ERR_OR_ZERO (e );
841
837
if (ret )
842
838
return ret ;
843
839
844
840
struct jset_entry_log * l = container_of (e , struct jset_entry_log , entry );
845
841
journal_entry_init (e , BCH_JSET_ENTRY_log , 0 , 1 , u64s );
846
- memcpy_and_pad (l -> d , u64s * sizeof (u64 ), buf -> buf , buf -> pos , 0 );
842
+ memcpy_and_pad (l -> d , u64s * sizeof (u64 ), str , len , 0 );
847
843
return 0 ;
848
844
}
849
845
846
+ int bch2_trans_log_str (struct btree_trans * trans , const char * str )
847
+ {
848
+ return __bch2_trans_log_str (trans , str , strlen (str ));
849
+ }
850
+
851
+ int bch2_trans_log_msg (struct btree_trans * trans , struct printbuf * buf )
852
+ {
853
+ int ret = buf -> allocation_failure ? - BCH_ERR_ENOMEM_trans_log_msg : 0 ;
854
+ if (ret )
855
+ return ret ;
856
+
857
+ return __bch2_trans_log_str (trans , buf -> buf , buf -> pos );
858
+ }
859
+
850
860
int bch2_trans_log_bkey (struct btree_trans * trans , enum btree_id btree ,
851
861
unsigned level , struct bkey_i * k )
852
862
{
0 commit comments