From 842a47162e25e65aa8377866e625d65e4f307708 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 21 Dec 2012 12:55:26 -0800 Subject: [PATCH] --- yaml --- r: 348173 b: refs/heads/master c: 10532fe7623dd63ef915be272247ec13f79afbb8 h: refs/heads/master i: 348171: dbf0e05ffbc719a285a6e5e3fae03888b3855bde v: v3 --- [refs] | 2 +- .../bindings/pinctrl/pinctrl-sirf.txt | 47 ------------------ trunk/MAINTAINERS | 10 ---- trunk/arch/arm/boot/dts/dbx5x0.dtsi | 4 +- trunk/arch/arm/mach-ux500/cpu-db8500.c | 3 +- trunk/arch/ia64/include/asm/unistd.h | 2 +- trunk/arch/ia64/include/uapi/asm/unistd.h | 1 - trunk/arch/ia64/kernel/entry.S | 1 - trunk/arch/powerpc/kernel/time.c | 5 ++ .../powerpc/platforms/40x/ppc40x_simple.c | 3 +- trunk/drivers/pinctrl/core.c | 2 +- trunk/drivers/pinctrl/pinctrl-at91.c | 2 +- trunk/drivers/pinctrl/pinctrl-imx53.c | 2 +- trunk/drivers/pinctrl/pinctrl-nomadik.c | 11 +---- trunk/drivers/pinctrl/pinctrl-sirf.c | 48 ------------------- trunk/drivers/w1/masters/mxc_w1.c | 2 +- trunk/fs/f2fs/data.c | 1 - trunk/fs/f2fs/dir.c | 16 +++---- trunk/fs/f2fs/f2fs.h | 2 +- trunk/fs/f2fs/file.c | 10 ++-- trunk/fs/f2fs/gc.c | 34 ++++++++----- trunk/fs/f2fs/hash.c | 18 +++---- trunk/fs/f2fs/inode.c | 1 - trunk/fs/f2fs/namei.c | 34 ++++++------- trunk/fs/f2fs/node.c | 37 ++++++++------ trunk/fs/f2fs/recovery.c | 10 ++-- trunk/fs/f2fs/segment.c | 46 +++++++++++++++--- trunk/fs/f2fs/segment.h | 15 +----- trunk/fs/f2fs/super.c | 15 +++--- trunk/fs/f2fs/xattr.c | 5 +- trunk/fs/gfs2/lock_dlm.c | 1 - trunk/fs/gfs2/rgrp.c | 35 ++++++-------- 32 files changed, 167 insertions(+), 258 deletions(-) delete mode 100644 trunk/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt diff --git a/[refs] b/[refs] index b7bf4390b946..afc139e97ad2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5f738967e89584f99c6a11c6bf09b16c50b6a03e +refs/heads/master: 10532fe7623dd63ef915be272247ec13f79afbb8 diff --git a/trunk/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt b/trunk/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt deleted file mode 100644 index c596a6ad3285..000000000000 --- a/trunk/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt +++ /dev/null @@ -1,47 +0,0 @@ -CSR SiRFprimaII pinmux controller - -Required properties: -- compatible : "sirf,prima2-pinctrl" -- reg : Address range of the pinctrl registers -- interrupts : Interrupts used by every GPIO group -- gpio-controller : Indicates this device is a GPIO controller -- interrupt-controller : Marks the device node as an interrupt controller -Optional properties: -- sirf,pullups : if n-th bit of m-th bank is set, set a pullup on GPIO-n of bank m -- sirf,pulldowns : if n-th bit of m-th bank is set, set a pulldown on GPIO-n of bank m - -Please refer to pinctrl-bindings.txt in this directory for details of the common -pinctrl bindings used by client devices. - -SiRFprimaII's pinmux nodes act as a container for an abitrary number of subnodes. -Each of these subnodes represents some desired configuration for a group of pins. - -Required subnode-properties: -- sirf,pins : An array of strings. Each string contains the name of a group. -- sirf,function: A string containing the name of the function to mux to the - group. - - Valid values for group and function names can be found from looking at the - group and function arrays in driver files: - drivers/pinctrl/pinctrl-sirf.c - -For example, pinctrl might have subnodes like the following: - uart2_pins_a: uart2@0 { - uart { - sirf,pins = "uart2grp"; - sirf,function = "uart2"; - }; - }; - uart2_noflow_pins_a: uart2@1 { - uart { - sirf,pins = "uart2_nostreamctrlgrp"; - sirf,function = "uart2_nostreamctrl"; - }; - }; - -For a specific board, if it wants to use uart2 without hardware flow control, -it can add the following to its board-specific .dts file. -uart2: uart@0xb0070000 { - pinctrl-names = "default"; - pinctrl-0 = <&uart2_noflow_pins_a>; -} diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 7a58a25a6e7c..fa309ab7ccbf 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -3273,16 +3273,6 @@ F: Documentation/filesystems/caching/ F: fs/fscache/ F: include/linux/fscache*.h -F2FS FILE SYSTEM -M: Jaegeuk Kim -L: linux-f2fs-devel@lists.sourceforge.net -W: http://en.wikipedia.org/wiki/F2FS -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git -S: Maintained -F: Documentation/filesystems/f2fs.txt -F: fs/f2fs/ -F: include/linux/f2fs_fs.h - FUJITSU FR-V (FRV) PORT M: David Howells S: Maintained diff --git a/trunk/arch/arm/boot/dts/dbx5x0.dtsi b/trunk/arch/arm/boot/dts/dbx5x0.dtsi index 63f2fbcfe819..2efd9c891bc9 100644 --- a/trunk/arch/arm/boot/dts/dbx5x0.dtsi +++ b/trunk/arch/arm/boot/dts/dbx5x0.dtsi @@ -170,9 +170,7 @@ gpio-bank = <8>; }; - pinctrl@80157000 { - // This is actually the PRCMU base address - reg = <0x80157000 0x2000>; + pinctrl { compatible = "stericsson,nmk_pinctrl"; }; diff --git a/trunk/arch/arm/mach-ux500/cpu-db8500.c b/trunk/arch/arm/mach-ux500/cpu-db8500.c index 5b286e06474c..db0bb75e2c76 100644 --- a/trunk/arch/arm/mach-ux500/cpu-db8500.c +++ b/trunk/arch/arm/mach-ux500/cpu-db8500.c @@ -285,8 +285,7 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL), OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL), /* Requires device name bindings. */ - OF_DEV_AUXDATA("stericsson,nmk_pinctrl", U8500_PRCMU_BASE, - "pinctrl-db8500", NULL), + OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL), /* Requires clock name and DMA bindings. */ OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000, "ux500-msp-i2s.0", &msp0_platform_data), diff --git a/trunk/arch/ia64/include/asm/unistd.h b/trunk/arch/ia64/include/asm/unistd.h index c3cc42a15af1..8b3ff2f5b861 100644 --- a/trunk/arch/ia64/include/asm/unistd.h +++ b/trunk/arch/ia64/include/asm/unistd.h @@ -11,7 +11,7 @@ -#define NR_syscalls 312 /* length of syscall table */ +#define NR_syscalls 311 /* length of syscall table */ /* * The following defines stop scripts/checksyscalls.sh from complaining about diff --git a/trunk/arch/ia64/include/uapi/asm/unistd.h b/trunk/arch/ia64/include/uapi/asm/unistd.h index 34fd6fe46da1..b706aa54df20 100644 --- a/trunk/arch/ia64/include/uapi/asm/unistd.h +++ b/trunk/arch/ia64/include/uapi/asm/unistd.h @@ -324,6 +324,5 @@ #define __NR_process_vm_readv 1332 #define __NR_process_vm_writev 1333 #define __NR_accept4 1334 -#define __NR_finit_module 1335 #endif /* _UAPI_ASM_IA64_UNISTD_H */ diff --git a/trunk/arch/ia64/kernel/entry.S b/trunk/arch/ia64/kernel/entry.S index 6bfd8429ee0f..e25b784a2b72 100644 --- a/trunk/arch/ia64/kernel/entry.S +++ b/trunk/arch/ia64/kernel/entry.S @@ -1785,7 +1785,6 @@ sys_call_table: data8 sys_process_vm_readv data8 sys_process_vm_writev data8 sys_accept4 - data8 sys_finit_module // 1335 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ diff --git a/trunk/arch/powerpc/kernel/time.c b/trunk/arch/powerpc/kernel/time.c index 6f6b1cccc916..b3b14352b05e 100644 --- a/trunk/arch/powerpc/kernel/time.c +++ b/trunk/arch/powerpc/kernel/time.c @@ -770,8 +770,13 @@ void update_vsyscall_old(struct timespec *wall_time, struct timespec *wtm, void update_vsyscall_tz(void) { + /* Make userspace gettimeofday spin until we're done. */ + ++vdso_data->tb_update_count; + smp_mb(); vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; vdso_data->tz_dsttime = sys_tz.tz_dsttime; + smp_mb(); + ++vdso_data->tb_update_count; } static void __init clocksource_init(void) diff --git a/trunk/arch/powerpc/platforms/40x/ppc40x_simple.c b/trunk/arch/powerpc/platforms/40x/ppc40x_simple.c index 8f3920e5a046..969dddcf3320 100644 --- a/trunk/arch/powerpc/platforms/40x/ppc40x_simple.c +++ b/trunk/arch/powerpc/platforms/40x/ppc40x_simple.c @@ -57,8 +57,7 @@ static const char * const board[] __initconst = { "amcc,makalu", "apm,klondike", "est,hotfoot", - "plathome,obs600", - NULL + "plathome,obs600" }; static int __init ppc40x_probe(void) diff --git a/trunk/drivers/pinctrl/core.c b/trunk/drivers/pinctrl/core.c index 59f5a965bdc4..5cdee8669ea3 100644 --- a/trunk/drivers/pinctrl/core.c +++ b/trunk/drivers/pinctrl/core.c @@ -700,7 +700,7 @@ static struct pinctrl *create_pinctrl(struct device *dev) } } - /* Add the pinctrl handle to the global list */ + /* Add the pinmux to the global list */ list_add_tail(&p->node, &pinctrl_list); return p; diff --git a/trunk/drivers/pinctrl/pinctrl-at91.c b/trunk/drivers/pinctrl/pinctrl-at91.c index bff54bfaff43..c5e757157183 100644 --- a/trunk/drivers/pinctrl/pinctrl-at91.c +++ b/trunk/drivers/pinctrl/pinctrl-at91.c @@ -265,7 +265,7 @@ static int at91_dt_node_to_map(struct pinctrl_dev *pctldev, /* create mux map */ parent = of_get_parent(np); if (!parent) { - devm_kfree(pctldev->dev, new_map); + kfree(new_map); return -EINVAL; } new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; diff --git a/trunk/drivers/pinctrl/pinctrl-imx53.c b/trunk/drivers/pinctrl/pinctrl-imx53.c index af571dc3dc63..ec4048691775 100644 --- a/trunk/drivers/pinctrl/pinctrl-imx53.c +++ b/trunk/drivers/pinctrl/pinctrl-imx53.c @@ -1371,7 +1371,7 @@ static struct imx_pin_reg imx53_pin_regs[] = { IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 0, 0x7F8, 1), /* MX53_PAD_GPIO_8__ESAI1_TX5_RX0 */ IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 1, 0x000, 0), /* MX53_PAD_GPIO_8__GPIO1_8 */ IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 2, 0x000, 0), /* MX53_PAD_GPIO_8__EPIT2_EPITO */ - IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 3, 0x760, 2), /* MX53_PAD_GPIO_8__CAN1_RXCAN */ + IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 3, 0x760, 3), /* MX53_PAD_GPIO_8__CAN1_RXCAN */ IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 4, 0x880, 5), /* MX53_PAD_GPIO_8__UART2_RXD_MUX */ IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 5, 0x000, 0), /* MX53_PAD_GPIO_8__FIRI_TXD */ IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 6, 0x000, 0), /* MX53_PAD_GPIO_8__SPDIF_SRCLK */ diff --git a/trunk/drivers/pinctrl/pinctrl-nomadik.c b/trunk/drivers/pinctrl/pinctrl-nomadik.c index 015b093287a4..ef66f98e9202 100644 --- a/trunk/drivers/pinctrl/pinctrl-nomadik.c +++ b/trunk/drivers/pinctrl/pinctrl-nomadik.c @@ -259,9 +259,6 @@ static void nmk_prcm_altcx_set_mode(struct nmk_pinctrl *npct, const struct prcm_gpiocr_altcx_pin_desc *pin_desc; const u16 *gpiocr_regs; - if (!npct->prcm_base) - return; - if (alt_num > PRCM_IDX_GPIOCR_ALTC_MAX) { dev_err(npct->dev, "PRCM GPIOCR: alternate-C%i is invalid\n", alt_num); @@ -685,9 +682,6 @@ static int nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio) const struct prcm_gpiocr_altcx_pin_desc *pin_desc; const u16 *gpiocr_regs; - if (!npct->prcm_base) - return NMK_GPIO_ALT_C; - for (i = 0; i < npct->soc->npins_altcx; i++) { if (npct->soc->altcx_pins[i].pin == gpio) break; @@ -1893,12 +1887,9 @@ static int __devinit nmk_pinctrl_probe(struct platform_device *pdev) "failed to ioremap PRCM registers\n"); return -ENOMEM; } - } else if (version == PINCTRL_NMK_STN8815) { + } else { dev_info(&pdev->dev, "No PRCM base, assume no ALT-Cx control is available\n"); - } else { - dev_err(&pdev->dev, "missing PRCM base address\n"); - return -EINVAL; } /* diff --git a/trunk/drivers/pinctrl/pinctrl-sirf.c b/trunk/drivers/pinctrl/pinctrl-sirf.c index 30e1a38293a0..a4f0c5e487d5 100644 --- a/trunk/drivers/pinctrl/pinctrl-sirf.c +++ b/trunk/drivers/pinctrl/pinctrl-sirf.c @@ -1663,44 +1663,6 @@ const struct irq_domain_ops sirfsoc_gpio_irq_simple_ops = { .xlate = irq_domain_xlate_twocell, }; -static void sirfsoc_gpio_set_pullup(const u32 *pullups) -{ - int i, n; - const unsigned long *p = (const unsigned long *)pullups; - - for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { - n = find_first_bit(p + i, BITS_PER_LONG); - while (n < BITS_PER_LONG) { - u32 offset = SIRFSOC_GPIO_CTRL(i, n); - u32 val = readl(sgpio_bank[i].chip.regs + offset); - val |= SIRFSOC_GPIO_CTL_PULL_MASK; - val |= SIRFSOC_GPIO_CTL_PULL_HIGH; - writel(val, sgpio_bank[i].chip.regs + offset); - - n = find_next_bit(p + i, BITS_PER_LONG, n + 1); - } - } -} - -static void sirfsoc_gpio_set_pulldown(const u32 *pulldowns) -{ - int i, n; - const unsigned long *p = (const unsigned long *)pulldowns; - - for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { - n = find_first_bit(p + i, BITS_PER_LONG); - while (n < BITS_PER_LONG) { - u32 offset = SIRFSOC_GPIO_CTRL(i, n); - u32 val = readl(sgpio_bank[i].chip.regs + offset); - val |= SIRFSOC_GPIO_CTL_PULL_MASK; - val &= ~SIRFSOC_GPIO_CTL_PULL_HIGH; - writel(val, sgpio_bank[i].chip.regs + offset); - - n = find_next_bit(p + i, BITS_PER_LONG, n + 1); - } - } -} - static int __devinit sirfsoc_gpio_probe(struct device_node *np) { int i, err = 0; @@ -1709,8 +1671,6 @@ static int __devinit sirfsoc_gpio_probe(struct device_node *np) struct platform_device *pdev; bool is_marco = false; - u32 pullups[SIRFSOC_GPIO_NO_OF_BANKS], pulldowns[SIRFSOC_GPIO_NO_OF_BANKS]; - pdev = of_find_device_by_node(np); if (!pdev) return -ENODEV; @@ -1766,14 +1726,6 @@ static int __devinit sirfsoc_gpio_probe(struct device_node *np) irq_set_handler_data(bank->parent_irq, bank); } - if (!of_property_read_u32_array(np, "sirf,pullups", pullups, - SIRFSOC_GPIO_NO_OF_BANKS)) - sirfsoc_gpio_set_pullup(pullups); - - if (!of_property_read_u32_array(np, "sirf,pulldowns", pulldowns, - SIRFSOC_GPIO_NO_OF_BANKS)) - sirfsoc_gpio_set_pulldown(pulldowns); - return 0; out: diff --git a/trunk/drivers/w1/masters/mxc_w1.c b/trunk/drivers/w1/masters/mxc_w1.c index d338b56ea2f0..708a25fc9961 100644 --- a/trunk/drivers/w1/masters/mxc_w1.c +++ b/trunk/drivers/w1/masters/mxc_w1.c @@ -191,7 +191,7 @@ static struct platform_driver mxc_w1_driver = { .name = "mxc_w1", }, .probe = mxc_w1_probe, - .remove = __devexit_p(mxc_w1_remove), + .remove = mxc_w1_remove, }; module_platform_driver(mxc_w1_driver); diff --git a/trunk/fs/f2fs/data.c b/trunk/fs/f2fs/data.c index 3aa5ce7cab83..655aeabc1dd4 100644 --- a/trunk/fs/f2fs/data.c +++ b/trunk/fs/f2fs/data.c @@ -16,7 +16,6 @@ #include #include #include -#include #include "f2fs.h" #include "node.h" diff --git a/trunk/fs/f2fs/dir.c b/trunk/fs/f2fs/dir.c index 951ed52748f6..b4e24f32b54e 100644 --- a/trunk/fs/f2fs/dir.c +++ b/trunk/fs/f2fs/dir.c @@ -11,7 +11,6 @@ #include #include #include "f2fs.h" -#include "node.h" #include "acl.h" static unsigned long dir_blocks(struct inode *inode) @@ -75,7 +74,7 @@ static unsigned long dir_block_index(unsigned int level, unsigned int idx) return bidx; } -static bool early_match_name(const char *name, size_t namelen, +static bool early_match_name(const char *name, int namelen, f2fs_hash_t namehash, struct f2fs_dir_entry *de) { if (le16_to_cpu(de->name_len) != namelen) @@ -88,7 +87,7 @@ static bool early_match_name(const char *name, size_t namelen, } static struct f2fs_dir_entry *find_in_block(struct page *dentry_page, - const char *name, size_t namelen, int *max_slots, + const char *name, int namelen, int *max_slots, f2fs_hash_t namehash, struct page **res_page) { struct f2fs_dir_entry *de; @@ -127,7 +126,7 @@ static struct f2fs_dir_entry *find_in_block(struct page *dentry_page, } static struct f2fs_dir_entry *find_in_level(struct inode *dir, - unsigned int level, const char *name, size_t namelen, + unsigned int level, const char *name, int namelen, f2fs_hash_t namehash, struct page **res_page) { int s = GET_DENTRY_SLOTS(namelen); @@ -182,7 +181,7 @@ struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir, struct qstr *child, struct page **res_page) { const char *name = child->name; - size_t namelen = child->len; + int namelen = child->len; unsigned long npages = dir_blocks(dir); struct f2fs_dir_entry *de = NULL; f2fs_hash_t name_hash; @@ -309,7 +308,6 @@ static int init_inode_metadata(struct inode *inode, struct dentry *dentry) ipage = get_node_page(F2FS_SB(dir->i_sb), inode->i_ino); if (IS_ERR(ipage)) return PTR_ERR(ipage); - set_cold_node(inode, ipage); init_dent_inode(dentry, ipage); f2fs_put_page(ipage, 1); } @@ -383,7 +381,7 @@ int f2fs_add_link(struct dentry *dentry, struct inode *inode) struct inode *dir = dentry->d_parent->d_inode; struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); const char *name = dentry->d_name.name; - size_t namelen = dentry->d_name.len; + int namelen = dentry->d_name.len; struct page *dentry_page = NULL; struct f2fs_dentry_block *dentry_blk = NULL; int slots = GET_DENTRY_SLOTS(namelen); @@ -542,13 +540,13 @@ int f2fs_make_empty(struct inode *inode, struct inode *parent) de = &dentry_blk->dentry[0]; de->name_len = cpu_to_le16(1); - de->hash_code = f2fs_dentry_hash(".", 1); + de->hash_code = 0; de->ino = cpu_to_le32(inode->i_ino); memcpy(dentry_blk->filename[0], ".", 1); set_de_type(de, inode); de = &dentry_blk->dentry[1]; - de->hash_code = f2fs_dentry_hash("..", 2); + de->hash_code = 0; de->name_len = cpu_to_le16(2); de->ino = cpu_to_le32(parent->i_ino); memcpy(dentry_blk->filename[1], "..", 2); diff --git a/trunk/fs/f2fs/f2fs.h b/trunk/fs/f2fs/f2fs.h index 13c6dfbb7183..a18d63db2fb6 100644 --- a/trunk/fs/f2fs/f2fs.h +++ b/trunk/fs/f2fs/f2fs.h @@ -881,7 +881,7 @@ int f2fs_sync_fs(struct super_block *, int); /* * hash.c */ -f2fs_hash_t f2fs_dentry_hash(const char *, size_t); +f2fs_hash_t f2fs_dentry_hash(const char *, int); /* * node.c diff --git a/trunk/fs/f2fs/file.c b/trunk/fs/f2fs/file.c index 7f9ea9271ebe..f9e085dfb1f0 100644 --- a/trunk/fs/f2fs/file.c +++ b/trunk/fs/f2fs/file.c @@ -160,17 +160,15 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) if (need_to_sync_dir(sbi, inode)) need_cp = true; + f2fs_write_inode(inode, NULL); + if (need_cp) { /* all the dirty node pages should be flushed for POR */ ret = f2fs_sync_fs(inode->i_sb, 1); clear_inode_flag(F2FS_I(inode), FI_NEED_CP); } else { - /* if there is no written node page, write its inode page */ - while (!sync_node_pages(sbi, inode->i_ino, &wbc)) { - ret = f2fs_write_inode(inode, NULL); - if (ret) - goto out; - } + while (sync_node_pages(sbi, inode->i_ino, &wbc) == 0) + f2fs_write_inode(inode, NULL); filemap_fdatawait_range(sbi->node_inode->i_mapping, 0, LONG_MAX); } diff --git a/trunk/fs/f2fs/gc.c b/trunk/fs/f2fs/gc.c index b0ec721e984a..644aa3808273 100644 --- a/trunk/fs/f2fs/gc.c +++ b/trunk/fs/f2fs/gc.c @@ -390,7 +390,9 @@ static int gc_node_segment(struct f2fs_sb_info *sbi, } err = check_valid_map(sbi, segno, off); - if (err == GC_NEXT) + if (err == GC_ERROR) + return err; + else if (err == GC_NEXT) continue; if (initial) { @@ -428,22 +430,28 @@ static int gc_node_segment(struct f2fs_sb_info *sbi, */ block_t start_bidx_of_node(unsigned int node_ofs) { - unsigned int indirect_blks = 2 * NIDS_PER_BLOCK + 4; - unsigned int bidx; + block_t start_bidx; + unsigned int bidx, indirect_blks; + int dec; - if (node_ofs == 0) - return 0; + indirect_blks = 2 * NIDS_PER_BLOCK + 4; - if (node_ofs <= 2) { + start_bidx = 1; + if (node_ofs == 0) { + start_bidx = 0; + } else if (node_ofs <= 2) { bidx = node_ofs - 1; } else if (node_ofs <= indirect_blks) { - int dec = (node_ofs - 4) / (NIDS_PER_BLOCK + 1); + dec = (node_ofs - 4) / (NIDS_PER_BLOCK + 1); bidx = node_ofs - 2 - dec; } else { - int dec = (node_ofs - indirect_blks - 3) / (NIDS_PER_BLOCK + 1); + dec = (node_ofs - indirect_blks - 3) / (NIDS_PER_BLOCK + 1); bidx = node_ofs - 5 - dec; } - return bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE; + + if (start_bidx) + start_bidx = bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE; + return start_bidx; } static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, @@ -548,7 +556,9 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, } err = check_valid_map(sbi, segno, off); - if (err == GC_NEXT) + if (err == GC_ERROR) + goto stop; + else if (err == GC_NEXT) continue; if (phase == 0) { @@ -558,7 +568,9 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, /* Get an inode by ino with checking validity */ err = check_dnode(sbi, entry, &dni, start_addr + off, &nofs); - if (err == GC_NEXT) + if (err == GC_ERROR) + goto stop; + else if (err == GC_NEXT) continue; if (phase == 1) { diff --git a/trunk/fs/f2fs/hash.c b/trunk/fs/f2fs/hash.c index 6eb8d269b53b..a60f04200f8b 100644 --- a/trunk/fs/f2fs/hash.c +++ b/trunk/fs/f2fs/hash.c @@ -42,7 +42,7 @@ static void TEA_transform(unsigned int buf[4], unsigned int const in[]) buf[1] += b1; } -static void str2hashbuf(const char *msg, size_t len, unsigned int *buf, int num) +static void str2hashbuf(const char *msg, int len, unsigned int *buf, int num) { unsigned pad, val; int i; @@ -69,17 +69,13 @@ static void str2hashbuf(const char *msg, size_t len, unsigned int *buf, int num) *buf++ = pad; } -f2fs_hash_t f2fs_dentry_hash(const char *name, size_t len) +f2fs_hash_t f2fs_dentry_hash(const char *name, int len) { - __u32 hash; + __u32 hash, minor_hash; f2fs_hash_t f2fs_hash; const char *p; __u32 in[8], buf[4]; - if ((len <= 2) && (name[0] == '.') && - (name[1] == '.' || name[1] == '\0')) - return 0; - /* Initialize the default seed for the hash checksum functions */ buf[0] = 0x67452301; buf[1] = 0xefcdab89; @@ -87,15 +83,15 @@ f2fs_hash_t f2fs_dentry_hash(const char *name, size_t len) buf[3] = 0x10325476; p = name; - while (1) { + while (len > 0) { str2hashbuf(p, len, in, 4); TEA_transform(buf, in); - p += 16; - if (len <= 16) - break; len -= 16; + p += 16; } hash = buf[0]; + minor_hash = buf[1]; + f2fs_hash = cpu_to_le32(hash & ~F2FS_HASH_COL_BIT); return f2fs_hash; } diff --git a/trunk/fs/f2fs/inode.c b/trunk/fs/f2fs/inode.c index bf20b4d03214..df5fb381ebf1 100644 --- a/trunk/fs/f2fs/inode.c +++ b/trunk/fs/f2fs/inode.c @@ -203,7 +203,6 @@ void update_inode(struct inode *inode, struct page *node_page) ri->i_flags = cpu_to_le32(F2FS_I(inode)->i_flags); ri->i_pino = cpu_to_le32(F2FS_I(inode)->i_pino); ri->i_generation = cpu_to_le32(inode->i_generation); - set_cold_node(inode, node_page); set_page_dirty(node_page); } diff --git a/trunk/fs/f2fs/namei.c b/trunk/fs/f2fs/namei.c index 1a49b881bac0..89b7675dc377 100644 --- a/trunk/fs/f2fs/namei.c +++ b/trunk/fs/f2fs/namei.c @@ -77,8 +77,8 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) static int is_multimedia_file(const unsigned char *s, const char *sub) { - size_t slen = strlen(s); - size_t sublen = strlen(sub); + int slen = strlen(s); + int sublen = strlen(sub); int ret; if (sublen > slen) @@ -123,8 +123,6 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, nid_t ino = 0; int err; - f2fs_balance_fs(sbi); - inode = f2fs_new_inode(dir, mode); if (IS_ERR(inode)) return PTR_ERR(inode); @@ -146,6 +144,8 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, if (!sbi->por_doing) d_instantiate(dentry, inode); unlock_new_inode(inode); + + f2fs_balance_fs(sbi); return 0; out: clear_nlink(inode); @@ -163,8 +163,6 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir, struct f2fs_sb_info *sbi = F2FS_SB(sb); int err; - f2fs_balance_fs(sbi); - inode->i_ctime = CURRENT_TIME; atomic_inc(&inode->i_count); @@ -174,6 +172,8 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir, goto out; d_instantiate(dentry, inode); + + f2fs_balance_fs(sbi); return 0; out: clear_inode_flag(F2FS_I(inode), FI_INC_LINK); @@ -223,8 +223,6 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) struct page *page; int err = -ENOENT; - f2fs_balance_fs(sbi); - de = f2fs_find_entry(dir, &dentry->d_name, &page); if (!de) goto fail; @@ -240,6 +238,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) /* In order to evict this inode, we set it dirty */ mark_inode_dirty(inode); + f2fs_balance_fs(sbi); fail: return err; } @@ -250,11 +249,9 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry, struct super_block *sb = dir->i_sb; struct f2fs_sb_info *sbi = F2FS_SB(sb); struct inode *inode; - size_t symlen = strlen(symname) + 1; + unsigned symlen = strlen(symname) + 1; int err; - f2fs_balance_fs(sbi); - inode = f2fs_new_inode(dir, S_IFLNK | S_IRWXUGO); if (IS_ERR(inode)) return PTR_ERR(inode); @@ -271,6 +268,9 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry, d_instantiate(dentry, inode); unlock_new_inode(inode); + + f2fs_balance_fs(sbi); + return err; out: clear_nlink(inode); @@ -286,8 +286,6 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) struct inode *inode; int err; - f2fs_balance_fs(sbi); - inode = f2fs_new_inode(dir, S_IFDIR | mode); if (IS_ERR(inode)) return PTR_ERR(inode); @@ -307,6 +305,7 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) d_instantiate(dentry, inode); unlock_new_inode(inode); + f2fs_balance_fs(sbi); return 0; out_fail: @@ -337,8 +336,6 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry, if (!new_valid_dev(rdev)) return -EINVAL; - f2fs_balance_fs(sbi); - inode = f2fs_new_inode(dir, mode); if (IS_ERR(inode)) return PTR_ERR(inode); @@ -353,6 +350,9 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry, alloc_nid_done(sbi, inode->i_ino); d_instantiate(dentry, inode); unlock_new_inode(inode); + + f2fs_balance_fs(sbi); + return 0; out: clear_nlink(inode); @@ -376,8 +376,6 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, struct f2fs_dir_entry *new_entry; int err = -ENOENT; - f2fs_balance_fs(sbi); - old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page); if (!old_entry) goto out; @@ -443,6 +441,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, } mutex_unlock_op(sbi, RENAME); + + f2fs_balance_fs(sbi); return 0; out_dir: diff --git a/trunk/fs/f2fs/node.c b/trunk/fs/f2fs/node.c index 5066bfd256c9..19870361497e 100644 --- a/trunk/fs/f2fs/node.c +++ b/trunk/fs/f2fs/node.c @@ -484,14 +484,12 @@ static void truncate_node(struct dnode_of_data *dn) struct node_info ni; get_node_info(sbi, dn->nid, &ni); - if (dn->inode->i_blocks == 0) { - BUG_ON(ni.blk_addr != NULL_ADDR); - goto invalidate; - } BUG_ON(ni.blk_addr == NULL_ADDR); + if (ni.blk_addr != NULL_ADDR) + invalidate_blocks(sbi, ni.blk_addr); + /* Deallocate node address */ - invalidate_blocks(sbi, ni.blk_addr); dec_valid_node_count(sbi, dn->inode, 1); set_node_addr(sbi, &ni, NULL_ADDR); @@ -501,7 +499,7 @@ static void truncate_node(struct dnode_of_data *dn) } else { sync_inode_page(dn); } -invalidate: + clear_node_page_dirty(dn->node_page); F2FS_SET_SB_DIRT(sbi); @@ -770,12 +768,20 @@ int remove_inode_page(struct inode *inode) dn.inode_page_locked = 1; truncate_node(&dn); } + if (inode->i_blocks == 1) { + /* inernally call f2fs_put_page() */ + set_new_dnode(&dn, inode, page, page, ino); + truncate_node(&dn); + } else if (inode->i_blocks == 0) { + struct node_info ni; + get_node_info(sbi, inode->i_ino, &ni); - /* 0 is possible, after f2fs_new_inode() is failed */ - BUG_ON(inode->i_blocks != 0 && inode->i_blocks != 1); - set_new_dnode(&dn, inode, page, page, ino); - truncate_node(&dn); - + /* called after f2fs_new_inode() is failed */ + BUG_ON(ni.blk_addr != NULL_ADDR); + f2fs_put_page(page, 1); + } else { + BUG(); + } mutex_unlock_op(sbi, NODE_TRUNC); return 0; } @@ -828,18 +834,17 @@ struct page *new_node_page(struct dnode_of_data *dn, unsigned int ofs) goto fail; } set_node_addr(sbi, &new_ni, NEW_ADDR); - set_cold_node(dn->inode, page); dn->node_page = page; sync_inode_page(dn); set_page_dirty(page); + set_cold_node(dn->inode, page); if (ofs == 0) inc_valid_inode_count(sbi); return page; fail: - clear_node_page_dirty(page); f2fs_put_page(page, 1); return ERR_PTR(err); } @@ -1088,6 +1093,7 @@ static int f2fs_write_node_page(struct page *page, { struct f2fs_sb_info *sbi = F2FS_SB(page->mapping->host->i_sb); nid_t nid; + unsigned int nofs; block_t new_addr; struct node_info ni; @@ -1104,6 +1110,7 @@ static int f2fs_write_node_page(struct page *page, /* get old block addr of this node page */ nid = nid_of_node(page); + nofs = ofs_of_node(page); BUG_ON(page->index != nid); get_node_info(sbi, nid, &ni); @@ -1564,7 +1571,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi) nid_t nid; struct f2fs_nat_entry raw_ne; int offset = -1; - block_t new_blkaddr; + block_t old_blkaddr, new_blkaddr; ne = list_entry(cur, struct nat_entry, list); nid = nat_get_nid(ne); @@ -1578,6 +1585,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi) offset = lookup_journal_in_cursum(sum, NAT_JOURNAL, nid, 1); if (offset >= 0) { raw_ne = nat_in_journal(sum, offset); + old_blkaddr = le32_to_cpu(raw_ne.block_addr); goto flush_now; } to_nat_page: @@ -1599,6 +1607,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi) BUG_ON(!nat_blk); raw_ne = nat_blk->entries[nid - start_nid]; + old_blkaddr = le32_to_cpu(raw_ne.block_addr); flush_now: new_blkaddr = nat_get_blkaddr(ne); diff --git a/trunk/fs/f2fs/recovery.c b/trunk/fs/f2fs/recovery.c index b571fee677d5..b07e9b6ef376 100644 --- a/trunk/fs/f2fs/recovery.c +++ b/trunk/fs/f2fs/recovery.c @@ -144,15 +144,14 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head) goto out; } + INIT_LIST_HEAD(&entry->list); + list_add_tail(&entry->list, head); + entry->inode = f2fs_iget(sbi->sb, ino_of_node(page)); if (IS_ERR(entry->inode)) { err = PTR_ERR(entry->inode); - kmem_cache_free(fsync_entry_slab, entry); goto out; } - - INIT_LIST_HEAD(&entry->list); - list_add_tail(&entry->list, head); entry->blkaddr = blkaddr; } if (IS_INODE(page)) { @@ -229,9 +228,6 @@ static void check_index_in_prev_nodes(struct f2fs_sb_info *sbi, /* Deallocate previous index in the node page */ inode = f2fs_iget_nowait(sbi->sb, ino); - if (IS_ERR(inode)) - return; - truncate_hole(inode, bidx, bidx + 1); iput(inode); } diff --git a/trunk/fs/f2fs/segment.c b/trunk/fs/f2fs/segment.c index de6240922b0a..1b26e4ea1016 100644 --- a/trunk/fs/f2fs/segment.c +++ b/trunk/fs/f2fs/segment.c @@ -12,23 +12,54 @@ #include #include #include -#include #include #include "f2fs.h" #include "segment.h" #include "node.h" +static int need_to_flush(struct f2fs_sb_info *sbi) +{ + unsigned int pages_per_sec = (1 << sbi->log_blocks_per_seg) * + sbi->segs_per_sec; + int node_secs = ((get_pages(sbi, F2FS_DIRTY_NODES) + pages_per_sec - 1) + >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; + int dent_secs = ((get_pages(sbi, F2FS_DIRTY_DENTS) + pages_per_sec - 1) + >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; + + if (sbi->por_doing) + return 0; + + if (free_sections(sbi) <= (node_secs + 2 * dent_secs + + reserved_sections(sbi))) + return 1; + return 0; +} + /* * This function balances dirty node and dentry pages. * In addition, it controls garbage collection. */ void f2fs_balance_fs(struct f2fs_sb_info *sbi) { + struct writeback_control wbc = { + .sync_mode = WB_SYNC_ALL, + .nr_to_write = LONG_MAX, + .for_reclaim = 0, + }; + + if (sbi->por_doing) + return; + /* - * We should do GC or end up with checkpoint, if there are so many dirty - * dir/node pages without enough free segments. + * We should do checkpoint when there are so many dirty node pages + * with enough free segments. After then, we should do GC. */ + if (need_to_flush(sbi)) { + sync_dirty_dir_inodes(sbi); + sync_node_pages(sbi, 0, &wbc); + } + if (has_not_enough_free_secs(sbi)) { mutex_lock(&sbi->gc_mutex); f2fs_gc(sbi, 1); @@ -600,6 +631,7 @@ static void f2fs_end_io_write(struct bio *bio, int err) if (page->mapping) set_bit(AS_EIO, &page->mapping->flags); set_ckpt_flags(p->sbi->ckpt, CP_ERROR_FLAG); + set_page_dirty(page); } end_page_writeback(page); dec_page_count(p->sbi, F2FS_WRITEBACK); @@ -759,10 +791,11 @@ static int __get_segment_type(struct page *page, enum page_type p_type) return __get_segment_type_2(page, p_type); case 4: return __get_segment_type_4(page, p_type); + case 6: + return __get_segment_type_6(page, p_type); + default: + BUG(); } - /* NR_CURSEG_TYPE(6) logs by default */ - BUG_ON(sbi->active_logs != NR_CURSEG_TYPE); - return __get_segment_type_6(page, p_type); } static void do_write_page(struct f2fs_sb_info *sbi, struct page *page, @@ -1575,6 +1608,7 @@ static int build_dirty_segmap(struct f2fs_sb_info *sbi) for (i = 0; i < NR_DIRTY_TYPE; i++) { dirty_i->dirty_segmap[i] = kzalloc(bitmap_size, GFP_KERNEL); + dirty_i->nr_dirty[i] = 0; if (!dirty_i->dirty_segmap[i]) return -ENOMEM; } diff --git a/trunk/fs/f2fs/segment.h b/trunk/fs/f2fs/segment.h index 66a288a52fd3..0948405af6f5 100644 --- a/trunk/fs/f2fs/segment.h +++ b/trunk/fs/f2fs/segment.h @@ -459,20 +459,7 @@ static inline int get_ssr_segment(struct f2fs_sb_info *sbi, int type) static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi) { - unsigned int pages_per_sec = (1 << sbi->log_blocks_per_seg) * - sbi->segs_per_sec; - int node_secs = ((get_pages(sbi, F2FS_DIRTY_NODES) + pages_per_sec - 1) - >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; - int dent_secs = ((get_pages(sbi, F2FS_DIRTY_DENTS) + pages_per_sec - 1) - >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; - - if (sbi->por_doing) - return false; - - if (free_sections(sbi) <= (node_secs + 2 * dent_secs + - reserved_sections(sbi))) - return true; - return false; + return free_sections(sbi) <= reserved_sections(sbi); } static inline int utilization(struct f2fs_sb_info *sbi) diff --git a/trunk/fs/f2fs/super.c b/trunk/fs/f2fs/super.c index 08a94c814bdc..13867322cf5a 100644 --- a/trunk/fs/f2fs/super.c +++ b/trunk/fs/f2fs/super.c @@ -119,6 +119,7 @@ static void f2fs_put_super(struct super_block *sb) int f2fs_sync_fs(struct super_block *sb, int sync) { struct f2fs_sb_info *sbi = F2FS_SB(sb); + int ret = 0; if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES)) return 0; @@ -126,7 +127,7 @@ int f2fs_sync_fs(struct super_block *sb, int sync) if (sync) write_checkpoint(sbi, false, false); - return 0; + return ret; } static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) @@ -147,8 +148,8 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) buf->f_bfree = buf->f_blocks - valid_user_blocks(sbi) - ovp_count; buf->f_bavail = user_block_count - valid_user_blocks(sbi); - buf->f_files = sbi->total_node_count; - buf->f_ffree = sbi->total_node_count - valid_inode_count(sbi); + buf->f_files = valid_inode_count(sbi); + buf->f_ffree = sbi->total_node_count - valid_node_count(sbi); buf->f_namelen = F2FS_MAX_NAME_LEN; buf->f_fsid.val[0] = (u32)id; @@ -301,7 +302,7 @@ static int parse_options(struct f2fs_sb_info *sbi, char *options) case Opt_active_logs: if (args->from && match_int(args, &arg)) return -EINVAL; - if (arg != 2 && arg != 4 && arg != NR_CURSEG_TYPE) + if (arg != 2 && arg != 4 && arg != 6) return -EINVAL; sbi->active_logs = arg; break; @@ -527,7 +528,8 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) /* if there are nt orphan nodes free them */ err = -EINVAL; - if (recover_orphan_inodes(sbi)) + if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG) && + recover_orphan_inodes(sbi)) goto free_node_inode; /* read root inode and dentry */ @@ -546,7 +548,8 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) } /* recover fsynced data */ - if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) + if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG) && + !test_opt(sbi, DISABLE_ROLL_FORWARD)) recover_fsync_data(sbi); /* After POR, we can run background GC thread */ diff --git a/trunk/fs/f2fs/xattr.c b/trunk/fs/f2fs/xattr.c index 940136a3d3a6..7d52e8dc0c59 100644 --- a/trunk/fs/f2fs/xattr.c +++ b/trunk/fs/f2fs/xattr.c @@ -208,7 +208,7 @@ int f2fs_getxattr(struct inode *inode, int name_index, const char *name, struct page *page; void *base_addr; int error = 0, found = 0; - size_t value_len, name_len; + int value_len, name_len; if (name == NULL) return -EINVAL; @@ -304,8 +304,7 @@ int f2fs_setxattr(struct inode *inode, int name_index, const char *name, struct f2fs_xattr_entry *here, *last; struct page *page; void *base_addr; - int error, found, free, newsize; - size_t name_len; + int error, found, free, name_len, newsize; char *pval; if (name == NULL) diff --git a/trunk/fs/gfs2/lock_dlm.c b/trunk/fs/gfs2/lock_dlm.c index b906ed17a839..8dad6b093716 100644 --- a/trunk/fs/gfs2/lock_dlm.c +++ b/trunk/fs/gfs2/lock_dlm.c @@ -241,7 +241,6 @@ static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags, static void gfs2_reverse_hex(char *c, u64 value) { - *c = '0'; while (value) { *c-- = hex_asc[value & 0x0f]; value >>= 4; diff --git a/trunk/fs/gfs2/rgrp.c b/trunk/fs/gfs2/rgrp.c index b7eff078fe90..37ee061d899e 100644 --- a/trunk/fs/gfs2/rgrp.c +++ b/trunk/fs/gfs2/rgrp.c @@ -350,14 +350,10 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len) BUG_ON(len < chunk_size); len -= chunk_size; block = gfs2_rbm_to_block(&rbm); - if (gfs2_rbm_from_block(&rbm, block + chunk_size)) { - n_unaligned = 0; + gfs2_rbm_from_block(&rbm, block + chunk_size); + n_unaligned = 3; + if (ptr) break; - } - if (ptr) { - n_unaligned = 3; - break; - } n_unaligned = len & 3; } @@ -561,20 +557,22 @@ void gfs2_free_clones(struct gfs2_rgrpd *rgd) */ int gfs2_rs_alloc(struct gfs2_inode *ip) { - int error = 0; + struct gfs2_blkreserv *res; - down_write(&ip->i_rw_mutex); if (ip->i_res) - goto out; + return 0; - ip->i_res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS); - if (!ip->i_res) { - error = -ENOMEM; - goto out; - } + res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS); + if (!res) + return -ENOMEM; - RB_CLEAR_NODE(&ip->i_res->rs_node); -out: + RB_CLEAR_NODE(&res->rs_node); + + down_write(&ip->i_rw_mutex); + if (ip->i_res) + kmem_cache_free(gfs2_rsrv_cachep, res); + else + ip->i_res = res; up_write(&ip->i_rw_mutex); return 0; } @@ -1426,9 +1424,6 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip, rs->rs_free = extlen; rs->rs_inum = ip->i_no_addr; rs_insert(ip); - } else { - if (goal == rgd->rd_last_alloc + rgd->rd_data0) - rgd->rd_last_alloc = 0; } }