aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/tnc.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-11-18 13:20:05 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-11-21 11:59:25 -0500
commit6c0c42cdfd73fb161417403d8d077cb136e10bbf (patch)
tree343de0cb98df07295bc3e03eee083012ac12bae7 /fs/ubifs/tnc.c
parent39ce81ce7168aa7226fb9f182c3a2b57060d0905 (diff)
UBIFS: do not allocate too much
Bulk-read allocates 128KiB or more using kmalloc. The allocation starts failing often when the memory gets fragmented. UBIFS still works fine in this case, because it falls-back to standard (non-optimized) read method, though. This patch teaches bulk-read to allocate exactly the amount of memory it needs, instead of allocating 128KiB every time. This patch is also a preparation to the further fix where we'll have a pre-allocated bulk-read buffer as well. For example, now the @bu object is prepared in 'ubifs_bulk_read()', so we could path either pre-allocated or allocated information to 'ubifs_do_bulk_read()' later. Or teaching 'ubifs_do_bulk_read()' not to allocate 'bu->buf' if it is already there. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/tnc.c')
-rw-r--r--fs/ubifs/tnc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 99e9a744cfd0..6eef5344a145 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -1501,7 +1501,12 @@ out:
1501 * @bu: bulk-read parameters and results 1501 * @bu: bulk-read parameters and results
1502 * 1502 *
1503 * Lookup consecutive data node keys for the same inode that reside 1503 * Lookup consecutive data node keys for the same inode that reside
1504 * consecutively in the same LEB. 1504 * consecutively in the same LEB. This function returns zero in case of success
1505 * and a negative error code in case of failure.
1506 *
1507 * Note, if the bulk-read buffer length (@bu->buf_len) is known, this function
1508 * makes sure bulk-read nodes fit the buffer. Otherwise, this function prepares
1509 * maxumum possible amount of nodes for bulk-read.
1505 */ 1510 */
1506int ubifs_tnc_get_bu_keys(struct ubifs_info *c, struct bu_info *bu) 1511int ubifs_tnc_get_bu_keys(struct ubifs_info *c, struct bu_info *bu)
1507{ 1512{