Revision 7ce9d5d1f3c8736511daa413c64985a05b2feee3 authored by Eric Sandeen on 04 March 2009, 23:38:18 UTC, committed by Theodore Ts'o on 04 March 2009, 23:38:18 UTC
I was seeing fsck errors on inode bitmaps after a 4 thread dbench run on a 4 cpu machine: Inode bitmap differences: -50736 -(50752--50753) etc... I believe that this is because ext4_free_inode() uses atomic bitops, and although ext4_new_inode() *used* to also use atomic bitops for synchronization, commit 393418676a7602e1d7d3f6e560159c65c8cbd50e changed this to use the sb_bgl_lock, so that we could also synchronize against read_inode_bitmap and initialization of uninit inode tables. However, that change left ext4_free_inode using atomic bitops, which I think leaves no synchronization between setting & unsetting bits in the inode table. The below patch fixes it for me, although I wonder if we're getting at all heavy-handed with this spinlock... Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent fec6c6f
umc-dev.c
/*
* UWB Multi-interface Controller device management.
*
* Copyright (C) 2007 Cambridge Silicon Radio Ltd.
*
* This file is released under the GNU GPL v2.
*/
#include <linux/kernel.h>
#include <linux/uwb/umc.h>
static void umc_device_release(struct device *dev)
{
struct umc_dev *umc = to_umc_dev(dev);
kfree(umc);
}
/**
* umc_device_create - allocate a child UMC device
* @parent: parent of the new UMC device.
* @n: index of the new device.
*
* The new UMC device will have a bus ID of the parent with '-n'
* appended.
*/
struct umc_dev *umc_device_create(struct device *parent, int n)
{
struct umc_dev *umc;
umc = kzalloc(sizeof(struct umc_dev), GFP_KERNEL);
if (umc) {
dev_set_name(&umc->dev, "%s-%d", dev_name(parent), n);
umc->dev.parent = parent;
umc->dev.bus = &umc_bus_type;
umc->dev.release = umc_device_release;
umc->dev.dma_mask = parent->dma_mask;
}
return umc;
}
EXPORT_SYMBOL_GPL(umc_device_create);
/**
* umc_device_register - register a UMC device
* @umc: pointer to the UMC device
*
* The memory resource for the UMC device is acquired and the device
* registered with the system.
*/
int umc_device_register(struct umc_dev *umc)
{
int err;
err = request_resource(umc->resource.parent, &umc->resource);
if (err < 0) {
dev_err(&umc->dev, "can't allocate resource range "
"%016Lx to %016Lx: %d\n",
(unsigned long long)umc->resource.start,
(unsigned long long)umc->resource.end,
err);
goto error_request_resource;
}
err = device_register(&umc->dev);
if (err < 0)
goto error_device_register;
return 0;
error_device_register:
release_resource(&umc->resource);
error_request_resource:
return err;
}
EXPORT_SYMBOL_GPL(umc_device_register);
/**
* umc_device_unregister - unregister a UMC device
* @umc: pointer to the UMC device
*
* First we unregister the device, make sure the driver can do it's
* resource release thing and then we try to release any left over
* resources. We take a ref to the device, to make sure it doesn't
* dissapear under our feet.
*/
void umc_device_unregister(struct umc_dev *umc)
{
struct device *dev;
if (!umc)
return;
dev = get_device(&umc->dev);
device_unregister(&umc->dev);
release_resource(&umc->resource);
put_device(dev);
}
EXPORT_SYMBOL_GPL(umc_device_unregister);
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...