dir.c (d053cf0d771f6547cb0537759a9af63cf402908d) dir.c (88dca4ca5a93d2c09e5bbc6a62fbfc3af83c4fca)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
4 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
5 */
6
7/*
8 * Implements Extendible Hashing as described in:

--- 340 unchanged lines hidden (view full) ---

349 hsize *= sizeof(__be64);
350 if (hsize != i_size_read(&ip->i_inode)) {
351 gfs2_consist_inode(ip);
352 return ERR_PTR(-EIO);
353 }
354
355 hc = kmalloc(hsize, GFP_NOFS | __GFP_NOWARN);
356 if (hc == NULL)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
4 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
5 */
6
7/*
8 * Implements Extendible Hashing as described in:

--- 340 unchanged lines hidden (view full) ---

349 hsize *= sizeof(__be64);
350 if (hsize != i_size_read(&ip->i_inode)) {
351 gfs2_consist_inode(ip);
352 return ERR_PTR(-EIO);
353 }
354
355 hc = kmalloc(hsize, GFP_NOFS | __GFP_NOWARN);
356 if (hc == NULL)
357 hc = __vmalloc(hsize, GFP_NOFS, PAGE_KERNEL);
357 hc = __vmalloc(hsize, GFP_NOFS);
358
359 if (hc == NULL)
360 return ERR_PTR(-ENOMEM);
361
362 ret = gfs2_dir_read_data(ip, hc, hsize);
363 if (ret < 0) {
364 kvfree(hc);
365 return ERR_PTR(ret);

--- 795 unchanged lines hidden (view full) ---

1161 hsize_bytes = hsize * sizeof(__be64);
1162
1163 hc = gfs2_dir_get_hash_table(dip);
1164 if (IS_ERR(hc))
1165 return PTR_ERR(hc);
1166
1167 hc2 = kmalloc_array(hsize_bytes, 2, GFP_NOFS | __GFP_NOWARN);
1168 if (hc2 == NULL)
358
359 if (hc == NULL)
360 return ERR_PTR(-ENOMEM);
361
362 ret = gfs2_dir_read_data(ip, hc, hsize);
363 if (ret < 0) {
364 kvfree(hc);
365 return ERR_PTR(ret);

--- 795 unchanged lines hidden (view full) ---

1161 hsize_bytes = hsize * sizeof(__be64);
1162
1163 hc = gfs2_dir_get_hash_table(dip);
1164 if (IS_ERR(hc))
1165 return PTR_ERR(hc);
1166
1167 hc2 = kmalloc_array(hsize_bytes, 2, GFP_NOFS | __GFP_NOWARN);
1168 if (hc2 == NULL)
1169 hc2 = __vmalloc(hsize_bytes * 2, GFP_NOFS, PAGE_KERNEL);
1169 hc2 = __vmalloc(hsize_bytes * 2, GFP_NOFS);
1170
1171 if (!hc2)
1172 return -ENOMEM;
1173
1174 h = hc2;
1175 error = gfs2_meta_inode_buffer(dip, &dibh);
1176 if (error)
1177 goto out_kfree;

--- 144 unchanged lines hidden (view full) ---

1322
1323static void *gfs2_alloc_sort_buffer(unsigned size)
1324{
1325 void *ptr = NULL;
1326
1327 if (size < KMALLOC_MAX_SIZE)
1328 ptr = kmalloc(size, GFP_NOFS | __GFP_NOWARN);
1329 if (!ptr)
1170
1171 if (!hc2)
1172 return -ENOMEM;
1173
1174 h = hc2;
1175 error = gfs2_meta_inode_buffer(dip, &dibh);
1176 if (error)
1177 goto out_kfree;

--- 144 unchanged lines hidden (view full) ---

1322
1323static void *gfs2_alloc_sort_buffer(unsigned size)
1324{
1325 void *ptr = NULL;
1326
1327 if (size < KMALLOC_MAX_SIZE)
1328 ptr = kmalloc(size, GFP_NOFS | __GFP_NOWARN);
1329 if (!ptr)
1330 ptr = __vmalloc(size, GFP_NOFS, PAGE_KERNEL);
1330 ptr = __vmalloc(size, GFP_NOFS);
1331 return ptr;
1332}
1333
1334
1335static int gfs2_set_cookies(struct gfs2_sbd *sdp, struct buffer_head *bh,
1336 unsigned leaf_nr, struct gfs2_dirent **darr,
1337 unsigned entries)
1338{

--- 643 unchanged lines hidden (view full) ---

1982 error = gfs2_rindex_update(sdp);
1983 if (error)
1984 return error;
1985
1986 memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
1987
1988 ht = kzalloc(size, GFP_NOFS | __GFP_NOWARN);
1989 if (ht == NULL)
1331 return ptr;
1332}
1333
1334
1335static int gfs2_set_cookies(struct gfs2_sbd *sdp, struct buffer_head *bh,
1336 unsigned leaf_nr, struct gfs2_dirent **darr,
1337 unsigned entries)
1338{

--- 643 unchanged lines hidden (view full) ---

1982 error = gfs2_rindex_update(sdp);
1983 if (error)
1984 return error;
1985
1986 memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
1987
1988 ht = kzalloc(size, GFP_NOFS | __GFP_NOWARN);
1989 if (ht == NULL)
1990 ht = __vmalloc(size, GFP_NOFS | __GFP_NOWARN | __GFP_ZERO,
1991 PAGE_KERNEL);
1990 ht = __vmalloc(size, GFP_NOFS | __GFP_NOWARN | __GFP_ZERO);
1992 if (!ht)
1993 return -ENOMEM;
1994
1995 error = gfs2_quota_hold(dip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
1996 if (error)
1997 goto out;
1998
1999 /* Count the number of leaves */

--- 186 unchanged lines hidden ---
1991 if (!ht)
1992 return -ENOMEM;
1993
1994 error = gfs2_quota_hold(dip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
1995 if (error)
1996 goto out;
1997
1998 /* Count the number of leaves */

--- 186 unchanged lines hidden ---