@@ -228,36 +228,6 @@ static int reserve_space(struct ubifs_info *c, int jhead, int len)
228
228
return err ;
229
229
}
230
230
231
- /**
232
- * write_node - write node to a journal head.
233
- * @c: UBIFS file-system description object
234
- * @jhead: journal head
235
- * @node: node to write
236
- * @len: node length
237
- * @lnum: LEB number written is returned here
238
- * @offs: offset written is returned here
239
- *
240
- * This function writes a node to reserved space of journal head @jhead.
241
- * Returns zero in case of success and a negative error code in case of
242
- * failure.
243
- */
244
- static int write_node (struct ubifs_info * c , int jhead , void * node , int len ,
245
- int * lnum , int * offs )
246
- {
247
- struct ubifs_wbuf * wbuf = & c -> jheads [jhead ].wbuf ;
248
-
249
- ubifs_assert (c , jhead != GCHD );
250
-
251
- * lnum = c -> jheads [jhead ].wbuf .lnum ;
252
- * offs = c -> jheads [jhead ].wbuf .offs + c -> jheads [jhead ].wbuf .used ;
253
-
254
- dbg_jnl ("jhead %s, LEB %d:%d, len %d" ,
255
- dbg_jhead (jhead ), * lnum , * offs , len );
256
- ubifs_prepare_node (c , node , len , 0 );
257
-
258
- return ubifs_wbuf_write_nolock (wbuf , node , len );
259
- }
260
-
261
231
/**
262
232
* write_head - write data to a journal head.
263
233
* @c: UBIFS file-system description object
@@ -268,9 +238,9 @@ static int write_node(struct ubifs_info *c, int jhead, void *node, int len,
268
238
* @offs: offset written is returned here
269
239
* @sync: non-zero if the write-buffer has to by synchronized
270
240
*
271
- * This function is the same as 'write_node()' but it does not assume the
272
- * buffer it is writing is a node, so it does not prepare it (which means
273
- * initializing common header and calculating CRC) .
241
+ * This function writes data to the reserved space of journal head @jhead.
242
+ * Returns zero in case of success and a negative error code in case of
243
+ * failure .
274
244
*/
275
245
static int write_head (struct ubifs_info * c , int jhead , void * buf , int len ,
276
246
int * lnum , int * offs , int sync )
@@ -764,7 +734,8 @@ int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode,
764
734
if (err )
765
735
goto out_free ;
766
736
767
- err = write_node (c , DATAHD , data , dlen , & lnum , & offs );
737
+ ubifs_prepare_node (c , data , dlen , 0 );
738
+ err = write_head (c , DATAHD , data , dlen , & lnum , & offs , 0 );
768
739
if (err )
769
740
goto out_release ;
770
741
ubifs_wbuf_add_ino_nolock (& c -> jheads [DATAHD ].wbuf , key_inum (c , key ));
0 commit comments