diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-09-07 08:36:28 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2018-10-23 07:48:24 -0400 |
commit | 83407437bbeae39551195861e51608c9638ffda4 (patch) | |
tree | cd9d6e56316db4310b75e1e34a3b31c665315990 /fs/ubifs/journal.c | |
parent | e635cf8c3bbd7b9bd3e282156c6cc4f818b72ee9 (diff) |
ubifs: Drop write_node
write_node() is used only once and can easily be replaced with calls
to ubifs_prepare_node()/write_head() which makes the code a bit shorter.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs/journal.c')
-rw-r--r-- | fs/ubifs/journal.c | 39 |
1 files changed, 5 insertions, 34 deletions
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 802565a17733..de7ac9e7acce 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c | |||
@@ -229,36 +229,6 @@ out_return: | |||
229 | } | 229 | } |
230 | 230 | ||
231 | /** | 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 | /** | ||
262 | * write_head - write data to a journal head. | 232 | * write_head - write data to a journal head. |
263 | * @c: UBIFS file-system description object | 233 | * @c: UBIFS file-system description object |
264 | * @jhead: journal head | 234 | * @jhead: journal head |
@@ -268,9 +238,9 @@ static int write_node(struct ubifs_info *c, int jhead, void *node, int len, | |||
268 | * @offs: offset written is returned here | 238 | * @offs: offset written is returned here |
269 | * @sync: non-zero if the write-buffer has to by synchronized | 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 | 241 | * This function writes data to the reserved space of journal head @jhead. |
272 | * buffer it is writing is a node, so it does not prepare it (which means | 242 | * Returns zero in case of success and a negative error code in case of |
273 | * initializing common header and calculating CRC). | 243 | * failure. |
274 | */ | 244 | */ |
275 | static int write_head(struct ubifs_info *c, int jhead, void *buf, int len, | 245 | static int write_head(struct ubifs_info *c, int jhead, void *buf, int len, |
276 | int *lnum, int *offs, int sync) | 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 | if (err) | 734 | if (err) |
765 | goto out_free; | 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 | if (err) | 739 | if (err) |
769 | goto out_release; | 740 | goto out_release; |
770 | ubifs_wbuf_add_ino_nolock(&c->jheads[DATAHD].wbuf, key_inum(c, key)); | 741 | ubifs_wbuf_add_ino_nolock(&c->jheads[DATAHD].wbuf, key_inum(c, key)); |