diff options
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r-- | fs/ubifs/super.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index d4b4cb4596e2..e360c7a71f9e 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1213,6 +1213,13 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1213 | if (c->bulk_read == 1) | 1213 | if (c->bulk_read == 1) |
1214 | bu_init(c); | 1214 | bu_init(c); |
1215 | 1215 | ||
1216 | if (!c->ro_mount) { | ||
1217 | c->write_reserve_buf = kmalloc(COMPRESSED_DATA_NODE_BUF_SZ, | ||
1218 | GFP_KERNEL); | ||
1219 | if (!c->write_reserve_buf) | ||
1220 | goto out_free; | ||
1221 | } | ||
1222 | |||
1216 | c->mounting = 1; | 1223 | c->mounting = 1; |
1217 | 1224 | ||
1218 | err = ubifs_read_superblock(c); | 1225 | err = ubifs_read_superblock(c); |
@@ -1482,6 +1489,7 @@ out_wbufs: | |||
1482 | out_cbuf: | 1489 | out_cbuf: |
1483 | kfree(c->cbuf); | 1490 | kfree(c->cbuf); |
1484 | out_free: | 1491 | out_free: |
1492 | kfree(c->write_reserve_buf); | ||
1485 | kfree(c->bu.buf); | 1493 | kfree(c->bu.buf); |
1486 | vfree(c->ileb_buf); | 1494 | vfree(c->ileb_buf); |
1487 | vfree(c->sbuf); | 1495 | vfree(c->sbuf); |
@@ -1520,6 +1528,7 @@ static void ubifs_umount(struct ubifs_info *c) | |||
1520 | kfree(c->cbuf); | 1528 | kfree(c->cbuf); |
1521 | kfree(c->rcvrd_mst_node); | 1529 | kfree(c->rcvrd_mst_node); |
1522 | kfree(c->mst_node); | 1530 | kfree(c->mst_node); |
1531 | kfree(c->write_reserve_buf); | ||
1523 | kfree(c->bu.buf); | 1532 | kfree(c->bu.buf); |
1524 | vfree(c->ileb_buf); | 1533 | vfree(c->ileb_buf); |
1525 | vfree(c->sbuf); | 1534 | vfree(c->sbuf); |
@@ -1605,6 +1614,10 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1605 | goto out; | 1614 | goto out; |
1606 | } | 1615 | } |
1607 | 1616 | ||
1617 | c->write_reserve_buf = kmalloc(COMPRESSED_DATA_NODE_BUF_SZ, GFP_KERNEL); | ||
1618 | if (!c->write_reserve_buf) | ||
1619 | goto out; | ||
1620 | |||
1608 | err = ubifs_lpt_init(c, 0, 1); | 1621 | err = ubifs_lpt_init(c, 0, 1); |
1609 | if (err) | 1622 | if (err) |
1610 | goto out; | 1623 | goto out; |
@@ -1669,6 +1682,8 @@ out: | |||
1669 | c->bgt = NULL; | 1682 | c->bgt = NULL; |
1670 | } | 1683 | } |
1671 | free_wbufs(c); | 1684 | free_wbufs(c); |
1685 | kfree(c->write_reserve_buf); | ||
1686 | c->write_reserve_buf = NULL; | ||
1672 | vfree(c->ileb_buf); | 1687 | vfree(c->ileb_buf); |
1673 | c->ileb_buf = NULL; | 1688 | c->ileb_buf = NULL; |
1674 | ubifs_lpt_free(c, 1); | 1689 | ubifs_lpt_free(c, 1); |
@@ -1712,6 +1727,8 @@ static void ubifs_remount_ro(struct ubifs_info *c) | |||
1712 | free_wbufs(c); | 1727 | free_wbufs(c); |
1713 | vfree(c->orph_buf); | 1728 | vfree(c->orph_buf); |
1714 | c->orph_buf = NULL; | 1729 | c->orph_buf = NULL; |
1730 | kfree(c->write_reserve_buf); | ||
1731 | c->write_reserve_buf = NULL; | ||
1715 | vfree(c->ileb_buf); | 1732 | vfree(c->ileb_buf); |
1716 | c->ileb_buf = NULL; | 1733 | c->ileb_buf = NULL; |
1717 | ubifs_lpt_free(c, 1); | 1734 | ubifs_lpt_free(c, 1); |
@@ -1942,6 +1959,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) | |||
1942 | mutex_init(&c->mst_mutex); | 1959 | mutex_init(&c->mst_mutex); |
1943 | mutex_init(&c->umount_mutex); | 1960 | mutex_init(&c->umount_mutex); |
1944 | mutex_init(&c->bu_mutex); | 1961 | mutex_init(&c->bu_mutex); |
1962 | mutex_init(&c->write_reserve_mutex); | ||
1945 | init_waitqueue_head(&c->cmt_wq); | 1963 | init_waitqueue_head(&c->cmt_wq); |
1946 | c->buds = RB_ROOT; | 1964 | c->buds = RB_ROOT; |
1947 | c->old_idx = RB_ROOT; | 1965 | c->old_idx = RB_ROOT; |