Merge branch 's5p-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Mar 2011 22:08:48 +0000 (15:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Mar 2011 22:08:48 +0000 (15:08 -0700)
* 's5p-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung:
  ARM: Suspend: Fix dependency of ARCH_SUSPEND_POSSIBLE
  ARM: SAMSUNG: Fix CPU idmask
  ARM: EXYNOS4: Fix addruart macro
  ARM: EXYNOS4: Fix smsc9215 irq polarity on SMDKC210
  ARM: EXYNOS4: Fix smsc9215 irq polarity on SMDKV310
  ARM: EXYNOS4: Fix build warning on regarding SATA_AHCI_PLATFORM
  ARM: S5PV210: Remove duplicated inclusion
  ARM: S5PV210: Fix security engine interrupt names
  ARM: S5P64X0: Fix iodesc array size for S5P6450

58 files changed:
arch/score/Kconfig
arch/score/include/asm/irqflags.h
arch/score/kernel/irq.c
arch/tile/Kconfig
arch/tile/kernel/irq.c
arch/x86/crypto/aesni-intel_asm.S
arch/x86/crypto/aesni-intel_glue.c
drivers/acpi/video.c
drivers/block/drbd/drbd_bitmap.c
drivers/dma/ipu/ipu_irq.c
drivers/mfd/Kconfig
fs/nfs/namespace.c
fs/nfs/pagelist.c
fs/nfs/write.c
fs/ocfs2/acl.c
fs/ocfs2/alloc.c
fs/ocfs2/aops.c
fs/ocfs2/buffer_head_io.c
fs/ocfs2/cluster/heartbeat.c
fs/ocfs2/cluster/masklog.c
fs/ocfs2/cluster/masklog.h
fs/ocfs2/cluster/tcp.c
fs/ocfs2/dcache.c
fs/ocfs2/dir.c
fs/ocfs2/dlm/dlmconvert.c
fs/ocfs2/dlm/dlmdomain.c
fs/ocfs2/dlm/dlmlock.c
fs/ocfs2/dlm/dlmmaster.c
fs/ocfs2/dlm/dlmrecovery.c
fs/ocfs2/dlm/dlmunlock.c
fs/ocfs2/dlmglue.c
fs/ocfs2/export.c
fs/ocfs2/extent_map.c
fs/ocfs2/file.c
fs/ocfs2/heartbeat.c
fs/ocfs2/inode.c
fs/ocfs2/ioctl.c
fs/ocfs2/journal.c
fs/ocfs2/localalloc.c
fs/ocfs2/locks.c
fs/ocfs2/mmap.c
fs/ocfs2/namei.c
fs/ocfs2/ocfs2.h
fs/ocfs2/ocfs2_trace.h [new file with mode: 0644]
fs/ocfs2/quota_global.c
fs/ocfs2/quota_local.c
fs/ocfs2/refcounttree.c
fs/ocfs2/reservations.c
fs/ocfs2/resize.c
fs/ocfs2/slot_map.c
fs/ocfs2/suballoc.c
fs/ocfs2/super.c
fs/ocfs2/symlink.c
fs/ocfs2/sysfile.c
fs/ocfs2/uptodate.c
fs/ocfs2/xattr.c
include/linux/nfs_page.h
net/sunrpc/sched.c

index 27b2295f41f378e341acd86e23582fb19d80de2e..4278bbc032ce46b0a472b5f418606ae9844acea7 100644 (file)
@@ -3,6 +3,8 @@ menu "Machine selection"
 config SCORE
        def_bool y
        select HAVE_GENERIC_HARDIRQS
+       select GENERIC_HARDIRQS_NO_DEPRECATED
+       select GENERIC_IRQ_SHOW
 
 choice
        prompt "System type"
index 5c7563891e288e9b972e9ecc38b8a1b1dd361ee0..37c6ac9dd6e846cd7cf2adf988296884ecadaf4a 100644 (file)
@@ -29,7 +29,7 @@ static inline unsigned long arch_local_save_flags(void)
 
 static inline unsigned long arch_local_irq_save(void)
 {
-       unsigned long flags
+       unsigned long flags;
 
        asm volatile(
                "       mfcr    r8, cr0         \n"
index 47647dde09caef3eae17a8a58db399e0649a5367..d4196732c65e9ed478e5992cc3426a3cde31a634 100644 (file)
@@ -52,9 +52,9 @@ asmlinkage void do_IRQ(int irq)
        irq_exit();
 }
 
-static void score_mask(unsigned int irq_nr)
+static void score_mask(struct irq_data *d)
 {
-       unsigned int irq_source = 63 - irq_nr;
+       unsigned int irq_source = 63 - d->irq;
 
        if (irq_source < 32)
                __raw_writel((__raw_readl(SCORE_PIC + INT_MASKL) | \
@@ -64,9 +64,9 @@ static void score_mask(unsigned int irq_nr)
                        (1 << (irq_source - 32))), SCORE_PIC + INT_MASKH);
 }
 
-static void score_unmask(unsigned int irq_nr)
+static void score_unmask(struct irq_data *d)
 {
-       unsigned int irq_source = 63 - irq_nr;
+       unsigned int irq_source = 63 - d->irq;
 
        if (irq_source < 32)
                __raw_writel((__raw_readl(SCORE_PIC + INT_MASKL) & \
@@ -78,9 +78,9 @@ static void score_unmask(unsigned int irq_nr)
 
 struct irq_chip score_irq_chip = {
        .name           = "Score7-level",
-       .mask           = score_mask,
-       .mask_ack       = score_mask,
-       .unmask         = score_unmask,
+       .irq_mask       = score_mask,
+       .irq_mask_ack   = score_mask,
+       .irq_unmask     = score_unmask,
 };
 
 /*
@@ -92,7 +92,7 @@ void __init init_IRQ(void)
        unsigned long target_addr;
 
        for (index = 0; index < NR_IRQS; ++index)
-               set_irq_chip_and_handler(index, &score_irq_chip,
+               irq_set_chip_and_handler(index, &score_irq_chip,
                                         handle_level_irq);
 
        for (target_addr = IRQ_VECTOR_BASE_ADDR;
@@ -109,40 +109,3 @@ void __init init_IRQ(void)
                : : "r" (EXCEPTION_VECTOR_BASE_ADDR | \
                        VECTOR_ADDRESS_OFFSET_MODE16));
 }
-
-/*
- * Generic, controller-independent functions:
- */
-int show_interrupts(struct seq_file *p, void *v)
-{
-       int i = *(loff_t *)v, cpu;
-       struct irqaction *action;
-       unsigned long flags;
-
-       if (i == 0) {
-               seq_puts(p, "           ");
-               for_each_online_cpu(cpu)
-                       seq_printf(p, "CPU%d       ", cpu);
-               seq_putc(p, '\n');
-       }
-
-       if (i < NR_IRQS) {
-               spin_lock_irqsave(&irq_desc[i].lock, flags);
-               action = irq_desc[i].action;
-               if (!action)
-                       goto unlock;
-
-               seq_printf(p, "%3d: ", i);
-               seq_printf(p, "%10u ", kstat_irqs(i));
-               seq_printf(p, " %8s", irq_desc[i].chip->name ? : "-");
-               seq_printf(p, "  %s", action->name);
-               for (action = action->next; action; action = action->next)
-                       seq_printf(p, ", %s", action->name);
-
-               seq_putc(p, '\n');
-unlock:
-               spin_unlock_irqrestore(&irq_desc[i].lock, flags);
-       }
-
-       return 0;
-}
index f3b78701c2197d332dc8718c67fa28af5ea86853..5e34a9fee9b392ede27092c2fd14fd13a42b041f 100644 (file)
@@ -12,6 +12,7 @@ config TILE
        select GENERIC_IRQ_PROBE
        select GENERIC_PENDING_IRQ if SMP
        select GENERIC_HARDIRQS_NO_DEPRECATED
+       select GENERIC_IRQ_SHOW
 
 # FIXME: investigate whether we need/want these options.
 #      select HAVE_IOREMAP_PROT
index 0baa7580121fb720246215b86378472f570c68be..aa0134db2dd683e4f2bde38823bcabc931f7d8ef 100644 (file)
@@ -241,14 +241,14 @@ void tile_irq_activate(unsigned int irq, int tile_irq_type)
        irq_flow_handler_t handle = handle_level_irq;
        if (tile_irq_type == TILE_IRQ_PERCPU)
                handle = handle_percpu_irq;
-       set_irq_chip_and_handler(irq, &tile_irq_chip, handle);
+       irq_set_chip_and_handler(irq, &tile_irq_chip, handle);
 
        /*
         * Flag interrupts that are hardware-cleared so that ack()
         * won't clear them.
         */
        if (tile_irq_type == TILE_IRQ_HW_CLEAR)
-               set_irq_chip_data(irq, (void *)IS_HW_CLEARED);
+               irq_set_chip_data(irq, (void *)IS_HW_CLEARED);
 }
 EXPORT_SYMBOL(tile_irq_activate);
 
@@ -262,47 +262,6 @@ void ack_bad_irq(unsigned int irq)
  * Generic, controller-independent functions:
  */
 
-int show_interrupts(struct seq_file *p, void *v)
-{
-       int i = *(loff_t *) v, j;
-       struct irqaction *action;
-       unsigned long flags;
-
-       if (i == 0) {
-               seq_printf(p, "           ");
-               for (j = 0; j < NR_CPUS; j++)
-                       if (cpu_online(j))
-                               seq_printf(p, "CPU%-8d", j);
-               seq_putc(p, '\n');
-       }
-
-       if (i < NR_IRQS) {
-               struct irq_desc *desc = irq_to_desc(i);
-
-               raw_spin_lock_irqsave(&desc->lock, flags);
-               action = desc->action;
-               if (!action)
-                       goto skip;
-               seq_printf(p, "%3d: ", i);
-#ifndef CONFIG_SMP
-               seq_printf(p, "%10u ", kstat_irqs(i));
-#else
-               for_each_online_cpu(j)
-                       seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
-#endif
-               seq_printf(p, " %14s", get_irq_desc_chip(desc)->name);
-               seq_printf(p, "  %s", action->name);
-
-               for (action = action->next; action; action = action->next)
-                       seq_printf(p, ", %s", action->name);
-
-               seq_putc(p, '\n');
-skip:
-               raw_spin_unlock_irqrestore(&desc->lock, flags);
-       }
-       return 0;
-}
-
 #if CHIP_HAS_IPI()
 int create_irq(void)
 {
index adcf794b22e208f8fa88847b06b466e3e1c88c75..be6d9e365a800a8569fb4915fccbfc50b0793a09 100644 (file)
@@ -1612,6 +1612,7 @@ _zero_cipher_left_encrypt:
         movdqa SHUF_MASK(%rip), %xmm10
        PSHUFB_XMM %xmm10, %xmm0
 
+
        ENCRYPT_SINGLE_BLOCK    %xmm0, %xmm1        # Encrypt(K, Yn)
        sub $16, %r11
        add %r13, %r11
@@ -1634,7 +1635,9 @@ _zero_cipher_left_encrypt:
        # GHASH computation for the last <16 byte block
        sub     %r13, %r11
        add     $16, %r11
-       PSHUFB_XMM %xmm10, %xmm1
+
+       movdqa SHUF_MASK(%rip), %xmm10
+       PSHUFB_XMM %xmm10, %xmm0
 
        # shuffle xmm0 back to output as ciphertext
 
index e0e6340c8dad35be4b4c922b96c44300ea301879..2577613fb32b04ea65893f5a838bac0f4b317496 100644 (file)
@@ -828,9 +828,15 @@ static int rfc4106_init(struct crypto_tfm *tfm)
        struct cryptd_aead *cryptd_tfm;
        struct aesni_rfc4106_gcm_ctx *ctx = (struct aesni_rfc4106_gcm_ctx *)
                PTR_ALIGN((u8 *)crypto_tfm_ctx(tfm), AESNI_ALIGN);
+       struct crypto_aead *cryptd_child;
+       struct aesni_rfc4106_gcm_ctx *child_ctx;
        cryptd_tfm = cryptd_alloc_aead("__driver-gcm-aes-aesni", 0, 0);
        if (IS_ERR(cryptd_tfm))
                return PTR_ERR(cryptd_tfm);
+
+       cryptd_child = cryptd_aead_child(cryptd_tfm);
+       child_ctx = aesni_rfc4106_gcm_ctx_get(cryptd_child);
+       memcpy(child_ctx, ctx, sizeof(*ctx));
        ctx->cryptd_tfm = cryptd_tfm;
        tfm->crt_aead.reqsize = sizeof(struct aead_request)
                + crypto_aead_reqsize(&cryptd_tfm->base);
@@ -923,6 +929,9 @@ static int rfc4106_set_key(struct crypto_aead *parent, const u8 *key,
        int ret = 0;
        struct crypto_tfm *tfm = crypto_aead_tfm(parent);
        struct aesni_rfc4106_gcm_ctx *ctx = aesni_rfc4106_gcm_ctx_get(parent);
+       struct crypto_aead *cryptd_child = cryptd_aead_child(ctx->cryptd_tfm);
+       struct aesni_rfc4106_gcm_ctx *child_ctx =
+                                 aesni_rfc4106_gcm_ctx_get(cryptd_child);
        u8 *new_key_mem = NULL;
 
        if (key_len < 4) {
@@ -966,6 +975,7 @@ static int rfc4106_set_key(struct crypto_aead *parent, const u8 *key,
                goto exit;
        }
        ret = rfc4106_set_hash_subkey(ctx->hash_subkey, key, key_len);
+       memcpy(child_ctx, ctx, sizeof(*ctx));
 exit:
        kfree(new_key_mem);
        return ret;
@@ -997,7 +1007,6 @@ static int rfc4106_encrypt(struct aead_request *req)
        int ret;
        struct crypto_aead *tfm = crypto_aead_reqtfm(req);
        struct aesni_rfc4106_gcm_ctx *ctx = aesni_rfc4106_gcm_ctx_get(tfm);
-       struct crypto_aead *cryptd_child = cryptd_aead_child(ctx->cryptd_tfm);
 
        if (!irq_fpu_usable()) {
                struct aead_request *cryptd_req =
@@ -1006,6 +1015,7 @@ static int rfc4106_encrypt(struct aead_request *req)
                aead_request_set_tfm(cryptd_req, &ctx->cryptd_tfm->base);
                return crypto_aead_encrypt(cryptd_req);
        } else {
+               struct crypto_aead *cryptd_child = cryptd_aead_child(ctx->cryptd_tfm);
                kernel_fpu_begin();
                ret = cryptd_child->base.crt_aead.encrypt(req);
                kernel_fpu_end();
@@ -1018,7 +1028,6 @@ static int rfc4106_decrypt(struct aead_request *req)
        int ret;
        struct crypto_aead *tfm = crypto_aead_reqtfm(req);
        struct aesni_rfc4106_gcm_ctx *ctx = aesni_rfc4106_gcm_ctx_get(tfm);
-       struct crypto_aead *cryptd_child = cryptd_aead_child(ctx->cryptd_tfm);
 
        if (!irq_fpu_usable()) {
                struct aead_request *cryptd_req =
@@ -1027,6 +1036,7 @@ static int rfc4106_decrypt(struct aead_request *req)
                aead_request_set_tfm(cryptd_req, &ctx->cryptd_tfm->base);
                return crypto_aead_decrypt(cryptd_req);
        } else {
+               struct crypto_aead *cryptd_child = cryptd_aead_child(ctx->cryptd_tfm);
                kernel_fpu_begin();
                ret = cryptd_child->base.crt_aead.decrypt(req);
                kernel_fpu_end();
index a18e497f1c3ca92722fd5f8bc8e36bb774d7b982..31e9e10f657eb6dda1ad9c58171ff38a523a1c34 100644 (file)
@@ -824,11 +824,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
                device->backlight->props.brightness =
                                acpi_video_get_brightness(device->backlight);
 
-               result = sysfs_create_link(&device->backlight->dev.kobj,
-                                          &device->dev->dev.kobj, "device");
-               if (result)
-                       printk(KERN_ERR PREFIX "Create sysfs link\n");
-
                device->cooling_dev = thermal_cooling_device_register("LCD",
                                        device->dev, &video_cooling_ops);
                if (IS_ERR(device->cooling_dev)) {
@@ -1381,7 +1376,6 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
                       "Cant remove video notify handler\n");
        }
        if (device->backlight) {
-               sysfs_remove_link(&device->backlight->dev.kobj, "device");
                backlight_device_unregister(device->backlight);
                device->backlight = NULL;
        }
index f0ae63d2df65531447d23a50c8cf4185f724e1bf..76210ba401ac4d3e8871c4eac99336aa67d899cd 100644 (file)
@@ -29,8 +29,6 @@
 #include <linux/slab.h>
 #include <asm/kmap_types.h>
 
-#include <asm-generic/bitops/le.h>
-
 #include "drbd_int.h"
 
 
@@ -1184,10 +1182,10 @@ static unsigned long __bm_find_next(struct drbd_conf *mdev, unsigned long bm_fo,
                        p_addr = __bm_map_pidx(b, bm_bit_to_page_idx(b, bm_fo), km);
 
                        if (find_zero_bit)
-                               i = generic_find_next_zero_le_bit(p_addr,
+                               i = find_next_zero_bit_le(p_addr,
                                                PAGE_SIZE*8, bm_fo & BITS_PER_PAGE_MASK);
                        else
-                               i = generic_find_next_le_bit(p_addr,
+                               i = find_next_bit_le(p_addr,
                                                PAGE_SIZE*8, bm_fo & BITS_PER_PAGE_MASK);
 
                        __bm_unmap(p_addr, km);
@@ -1287,9 +1285,9 @@ static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
                        last_page_nr = page_nr;
                }
                if (val)
-                       c += (0 == generic___test_and_set_le_bit(bitnr & BITS_PER_PAGE_MASK, p_addr));
+                       c += (0 == __test_and_set_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr));
                else
-                       c -= (0 != generic___test_and_clear_le_bit(bitnr & BITS_PER_PAGE_MASK, p_addr));
+                       c -= (0 != __test_and_clear_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr));
        }
        if (p_addr)
                __bm_unmap(p_addr, km);
@@ -1438,7 +1436,7 @@ int drbd_bm_test_bit(struct drbd_conf *mdev, const unsigned long bitnr)
                bm_print_lock_info(mdev);
        if (bitnr < b->bm_bits) {
                p_addr = bm_map_pidx(b, bm_bit_to_page_idx(b, bitnr));
-               i = generic_test_le_bit(bitnr & BITS_PER_PAGE_MASK, p_addr) ? 1 : 0;
+               i = test_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr) ? 1 : 0;
                bm_unmap(p_addr);
        } else if (bitnr == b->bm_bits) {
                i = -1;
@@ -1482,7 +1480,7 @@ int drbd_bm_count_bits(struct drbd_conf *mdev, const unsigned long s, const unsi
                ERR_IF (bitnr >= b->bm_bits) {
                        dev_err(DEV, "bitnr=%lu bm_bits=%lu\n", bitnr, b->bm_bits);
                } else {
-                       c += (0 != generic_test_le_bit(bitnr - (page_nr << (PAGE_SHIFT+3)), p_addr));
+                       c += (0 != test_bit_le(bitnr - (page_nr << (PAGE_SHIFT+3)), p_addr));
                }
        }
        if (p_addr)
index dd8ebc75b667ad0089a1152fe7dd416a8ad786f6..ab8a4eff072ae1d06559c8590b1f87641880cfb0 100644 (file)
@@ -94,9 +94,9 @@ static struct ipu_irq_map *src2map(unsigned int src)
        return NULL;
 }
 
-static void ipu_irq_unmask(unsigned int irq)
+static void ipu_irq_unmask(struct irq_data *d)
 {
-       struct ipu_irq_map *map = get_irq_chip_data(irq);
+       struct ipu_irq_map *map = irq_data_get_irq_chip_data(d);
        struct ipu_irq_bank *bank;
        uint32_t reg;
        unsigned long lock_flags;
@@ -106,7 +106,7 @@ static void ipu_irq_unmask(unsigned int irq)
        bank = map->bank;
        if (!bank) {
                spin_unlock_irqrestore(&bank_lock, lock_flags);
-               pr_err("IPU: %s(%u) - unmapped!\n", __func__, irq);
+               pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
                return;
        }
 
@@ -117,9 +117,9 @@ static void ipu_irq_unmask(unsigned int irq)
        spin_unlock_irqrestore(&bank_lock, lock_flags);
 }
 
-static void ipu_irq_mask(unsigned int irq)
+static void ipu_irq_mask(struct irq_data *d)
 {
-       struct ipu_irq_map *map = get_irq_chip_data(irq);
+       struct ipu_irq_map *map = irq_data_get_irq_chip_data(d);
        struct ipu_irq_bank *bank;
        uint32_t reg;
        unsigned long lock_flags;
@@ -129,7 +129,7 @@ static void ipu_irq_mask(unsigned int irq)
        bank = map->bank;
        if (!bank) {
                spin_unlock_irqrestore(&bank_lock, lock_flags);
-               pr_err("IPU: %s(%u) - unmapped!\n", __func__, irq);
+               pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
                return;
        }
 
@@ -140,9 +140,9 @@ static void ipu_irq_mask(unsigned int irq)
        spin_unlock_irqrestore(&bank_lock, lock_flags);
 }
 
-static void ipu_irq_ack(unsigned int irq)
+static void ipu_irq_ack(struct irq_data *d)
 {
-       struct ipu_irq_map *map = get_irq_chip_data(irq);
+       struct ipu_irq_map *map = irq_data_get_irq_chip_data(d);
        struct ipu_irq_bank *bank;
        unsigned long lock_flags;
 
@@ -151,7 +151,7 @@ static void ipu_irq_ack(unsigned int irq)
        bank = map->bank;
        if (!bank) {
                spin_unlock_irqrestore(&bank_lock, lock_flags);
-               pr_err("IPU: %s(%u) - unmapped!\n", __func__, irq);
+               pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
                return;
        }
 
@@ -167,7 +167,7 @@ static void ipu_irq_ack(unsigned int irq)
  */
 bool ipu_irq_status(unsigned int irq)
 {
-       struct ipu_irq_map *map = get_irq_chip_data(irq);
+       struct ipu_irq_map *map = irq_get_chip_data(irq);
        struct ipu_irq_bank *bank;
        unsigned long lock_flags;
        bool ret;
@@ -269,7 +269,7 @@ int ipu_irq_unmap(unsigned int source)
 /* Chained IRQ handler for IPU error interrupt */
 static void ipu_irq_err(unsigned int irq, struct irq_desc *desc)
 {
-       struct ipu *ipu = get_irq_data(irq);
+       struct ipu *ipu = irq_get_handler_data(irq);
        u32 status;
        int i, line;
 
@@ -310,7 +310,7 @@ static void ipu_irq_err(unsigned int irq, struct irq_desc *desc)
 /* Chained IRQ handler for IPU function interrupt */
 static void ipu_irq_fn(unsigned int irq, struct irq_desc *desc)
 {
-       struct ipu *ipu = get_irq_data(irq);
+       struct ipu *ipu = irq_desc_get_handler_data(desc);
        u32 status;
        int i, line;
 
@@ -345,10 +345,10 @@ static void ipu_irq_fn(unsigned int irq, struct irq_desc *desc)
 }
 
 static struct irq_chip ipu_irq_chip = {
-       .name   = "ipu_irq",
-       .ack    = ipu_irq_ack,
-       .mask   = ipu_irq_mask,
-       .unmask = ipu_irq_unmask,
+       .name           = "ipu_irq",
+       .irq_ack        = ipu_irq_ack,
+       .irq_mask       = ipu_irq_mask,
+       .irq_unmask     = ipu_irq_unmask,
 };
 
 /* Install the IRQ handler */
@@ -366,26 +366,26 @@ int __init ipu_irq_attach_irq(struct ipu *ipu, struct platform_device *dev)
                int ret;
 
                irq = irq_base + i;
-               ret = set_irq_chip(irq, &ipu_irq_chip);
+               ret = irq_set_chip(irq, &ipu_irq_chip);
                if (ret < 0)
                        return ret;
-               ret = set_irq_chip_data(irq, irq_map + i);
+               ret = irq_set_chip_data(irq, irq_map + i);
                if (ret < 0)
                        return ret;
                irq_map[i].ipu = ipu;
                irq_map[i].irq = irq;
                irq_map[i].source = -EINVAL;
-               set_irq_handler(irq, handle_level_irq);
+               irq_set_handler(irq, handle_level_irq);
 #ifdef CONFIG_ARM
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
 #endif
        }
 
-       set_irq_data(ipu->irq_fn, ipu);
-       set_irq_chained_handler(ipu->irq_fn, ipu_irq_fn);
+       irq_set_handler_data(ipu->irq_fn, ipu);
+       irq_set_chained_handler(ipu->irq_fn, ipu_irq_fn);
 
-       set_irq_data(ipu->irq_err, ipu);
-       set_irq_chained_handler(ipu->irq_err, ipu_irq_err);
+       irq_set_handler_data(ipu->irq_err, ipu);
+       irq_set_chained_handler(ipu->irq_err, ipu_irq_err);
 
        return 0;
 }
@@ -397,17 +397,17 @@ void ipu_irq_detach_irq(struct ipu *ipu, struct platform_device *dev)
 
        irq_base = pdata->irq_base;
 
-       set_irq_chained_handler(ipu->irq_fn, NULL);
-       set_irq_data(ipu->irq_fn, NULL);
+       irq_set_chained_handler(ipu->irq_fn, NULL);
+       irq_set_handler_data(ipu->irq_fn, NULL);
 
-       set_irq_chained_handler(ipu->irq_err, NULL);
-       set_irq_data(ipu->irq_err, NULL);
+       irq_set_chained_handler(ipu->irq_err, NULL);
+       irq_set_handler_data(ipu->irq_err, NULL);
 
        for (irq = irq_base; irq < irq_base + CONFIG_MX3_IPU_IRQS; irq++) {
 #ifdef CONFIG_ARM
                set_irq_flags(irq, 0);
 #endif
-               set_irq_chip(irq, NULL);
-               set_irq_chip_data(irq, NULL);
+               irq_set_chip(irq, NULL);
+               irq_set_chip_data(irq, NULL);
        }
 }
index e986f91fff9c43b323a2cac525f1a982ccbf0728..9a46d64996a9f823732775683068618f77a918b9 100644 (file)
@@ -592,7 +592,7 @@ config AB3550_CORE
 config MFD_CS5535
        tristate "Support for CS5535 and CS5536 southbridge core functions"
        select MFD_CORE
-       depends on PCI
+       depends on PCI && X86
        ---help---
          This is the core driver for CS5535/CS5536 MFD functions.  This is
           necessary for using the board's GPIO and MFGPT functionality.
index ad92bf731ff570a560919ef4eb22b3eb50f0027e..9166fcb66da219f4b9d2a8dc4445b5b945627b16 100644 (file)
@@ -192,13 +192,15 @@ static rpc_authflavor_t nfs_lookup_with_sec(struct nfs_server *server, struct de
        auth   = rpcauth_create(flavor, clone);
        if (!auth) {
                flavor = -EIO;
-               goto out;
+               goto out_shutdown;
        }
        err = server->nfs_client->rpc_ops->lookup(clone, parent->d_inode,
                                                  &path->dentry->d_name,
                                                  fh, fattr);
        if (err < 0)
                flavor = err;
+out_shutdown:
+       rpc_shutdown_client(clone);
 out:
        return flavor;
 }
index 87a593c2b055503e727c2cda93a396ecb2681fb5..c80add6e2213ab6d4f301a2ca06134b4a4f5581c 100644 (file)
@@ -135,14 +135,14 @@ void nfs_clear_page_tag_locked(struct nfs_page *req)
                nfs_unlock_request(req);
 }
 
-/**
+/*
  * nfs_clear_request - Free up all resources allocated to the request
  * @req:
  *
  * Release page and open context resources associated with a read/write
  * request after it has completed.
  */
-void nfs_clear_request(struct nfs_page *req)
+static void nfs_clear_request(struct nfs_page *req)
 {
        struct page *page = req->wb_page;
        struct nfs_open_context *ctx = req->wb_context;
index 85d75254328ebd1c822187e51a3f5b5e9fc320b7..af0c6279a4a7c131cd9c2a80e0764ba8ea50a6c9 100644 (file)
@@ -389,11 +389,8 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
        spin_lock(&inode->i_lock);
        error = radix_tree_insert(&nfsi->nfs_page_tree, req->wb_index, req);
        BUG_ON(error);
-       if (!nfsi->npages) {
-               igrab(inode);
-               if (nfs_have_delegation(inode, FMODE_WRITE))
-                       nfsi->change_attr++;
-       }
+       if (!nfsi->npages && nfs_have_delegation(inode, FMODE_WRITE))
+               nfsi->change_attr++;
        set_bit(PG_MAPPED, &req->wb_flags);
        SetPagePrivate(req->wb_page);
        set_page_private(req->wb_page, (unsigned long)req);
@@ -423,11 +420,7 @@ static void nfs_inode_remove_request(struct nfs_page *req)
        clear_bit(PG_MAPPED, &req->wb_flags);
        radix_tree_delete(&nfsi->nfs_page_tree, req->wb_index);
        nfsi->npages--;
-       if (!nfsi->npages) {
-               spin_unlock(&inode->i_lock);
-               iput(inode);
-       } else
-               spin_unlock(&inode->i_lock);
+       spin_unlock(&inode->i_lock);
        nfs_release_request(req);
 }
 
index 90f2729b7a5bc031e778fad1cf4b665409394247..e913ad130fdd2cf9eafa0e73e343bad5974583e9 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 
-#define MLOG_MASK_PREFIX ML_INODE
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
index e4984e259cb6b9eec82ed22ae376e51fad986029..b27a0d86f8c584fd9f15aff29a4ceb3032d8910a 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/swap.h>
 #include <linux/quotaops.h>
 
-#define MLOG_MASK_PREFIX ML_DISK_ALLOC
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -50,6 +49,7 @@
 #include "uptodate.h"
 #include "xattr.h"
 #include "refcounttree.h"
+#include "ocfs2_trace.h"
 
 #include "buffer_head_io.h"
 
@@ -886,8 +886,7 @@ static int ocfs2_validate_extent_block(struct super_block *sb,
        struct ocfs2_extent_block *eb =
                (struct ocfs2_extent_block *)bh->b_data;
 
-       mlog(0, "Validating extent block %llu\n",
-            (unsigned long long)bh->b_blocknr);
+       trace_ocfs2_validate_extent_block((unsigned long long)bh->b_blocknr);
 
        BUG_ON(!buffer_uptodate(bh));
 
@@ -965,8 +964,6 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb,
        struct buffer_head *eb_bh = NULL;
        u64 last_eb_blk = 0;
 
-       mlog_entry_void();
-
        el = et->et_root_el;
        last_eb_blk = ocfs2_et_get_last_eb_blk(et);
 
@@ -987,7 +984,7 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb,
 bail:
        brelse(eb_bh);
 
-       mlog_exit(retval);
+       trace_ocfs2_num_free_extents(retval);
        return retval;
 }
 
@@ -1010,8 +1007,6 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle,
                OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci));
        struct ocfs2_extent_block *eb;
 
-       mlog_entry_void();
-
        count = 0;
        while (count < wanted) {
                status = ocfs2_claim_metadata(handle,
@@ -1074,8 +1069,8 @@ bail:
                        brelse(bhs[i]);
                        bhs[i] = NULL;
                }
+               mlog_errno(status);
        }
-       mlog_exit(status);
        return status;
 }
 
@@ -1173,8 +1168,6 @@ static int ocfs2_add_branch(handle_t *handle,
        struct ocfs2_extent_list  *el;
        u32 new_cpos, root_end;
 
-       mlog_entry_void();
-
        BUG_ON(!last_eb_bh || !*last_eb_bh);
 
        if (eb_bh) {
@@ -1200,8 +1193,11 @@ static int ocfs2_add_branch(handle_t *handle,
         * from new_cpos).
         */
        if (root_end > new_cpos) {
-               mlog(0, "adjust the cluster end from %u to %u\n",
-                    root_end, new_cpos);
+               trace_ocfs2_adjust_rightmost_branch(
+                       (unsigned long long)
+                       ocfs2_metadata_cache_owner(et->et_ci),
+                       root_end, new_cpos);
+
                status = ocfs2_adjust_rightmost_branch(handle, et);
                if (status) {
                        mlog_errno(status);
@@ -1332,7 +1328,6 @@ bail:
                kfree(new_eb_bhs);
        }
 
-       mlog_exit(status);
        return status;
 }
 
@@ -1353,8 +1348,6 @@ static int ocfs2_shift_tree_depth(handle_t *handle,
        struct ocfs2_extent_list  *root_el;
        struct ocfs2_extent_list  *eb_el;
 
-       mlog_entry_void();
-
        status = ocfs2_create_new_meta_bhs(handle, et, 1, meta_ac,
                                           &new_eb_bh);
        if (status < 0) {
@@ -1415,7 +1408,6 @@ static int ocfs2_shift_tree_depth(handle_t *handle,
 bail:
        brelse(new_eb_bh);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -1446,8 +1438,6 @@ static int ocfs2_find_branch_target(struct ocfs2_extent_tree *et,
        struct buffer_head *bh = NULL;
        struct buffer_head *lowest_bh = NULL;
 
-       mlog_entry_void();
-
        *target_bh = NULL;
 
        el = et->et_root_el;
@@ -1503,7 +1493,6 @@ static int ocfs2_find_branch_target(struct ocfs2_extent_tree *et,
 bail:
        brelse(bh);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -1540,7 +1529,10 @@ static int ocfs2_grow_tree(handle_t *handle, struct ocfs2_extent_tree *et,
         * another tree level */
        if (shift) {
                BUG_ON(bh);
-               mlog(0, "need to shift tree depth (current = %d)\n", depth);
+               trace_ocfs2_grow_tree(
+                       (unsigned long long)
+                       ocfs2_metadata_cache_owner(et->et_ci),
+                       depth);
 
                /* ocfs2_shift_tree_depth will return us a buffer with
                 * the new extent block (so we can pass that to
@@ -1570,7 +1562,6 @@ static int ocfs2_grow_tree(handle_t *handle, struct ocfs2_extent_tree *et,
 
        /* call ocfs2_add_branch to add the final part of the tree with
         * the new data. */
-       mlog(0, "add branch. bh = %p\n", bh);
        ret = ocfs2_add_branch(handle, et, bh, last_eb_bh,
                               meta_ac);
        if (ret < 0) {
@@ -1645,8 +1636,9 @@ static void ocfs2_rotate_leaf(struct ocfs2_extent_list *el,
        }
        insert_index = i;
 
-       mlog(0, "ins %u: index %d, has_empty %d, next_free %d, count %d\n",
-            insert_cpos, insert_index, has_empty, next_free, le16_to_cpu(el->l_count));
+       trace_ocfs2_rotate_leaf(insert_cpos, insert_index,
+                               has_empty, next_free,
+                               le16_to_cpu(el->l_count));
 
        BUG_ON(insert_index < 0);
        BUG_ON(insert_index >= le16_to_cpu(el->l_count));
@@ -2059,7 +2051,7 @@ static void ocfs2_complete_edge_insert(handle_t *handle,
        left_el = path_leaf_el(left_path);
        right_el = path_leaf_el(right_path);
        for(i = left_path->p_tree_depth - 1; i > subtree_index; i--) {
-               mlog(0, "Adjust records at index %u\n", i);
+               trace_ocfs2_complete_edge_insert(i);
 
                /*
                 * One nice property of knowing that all of these
@@ -2389,7 +2381,9 @@ static int ocfs2_rotate_tree_right(handle_t *handle,
                goto out;
        }
 
-       mlog(0, "Insert: %u, first left path cpos: %u\n", insert_cpos, cpos);
+       trace_ocfs2_rotate_tree_right(
+               (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
+               insert_cpos, cpos);
 
        /*
         * What we want to do here is:
@@ -2418,8 +2412,10 @@ static int ocfs2_rotate_tree_right(handle_t *handle,
         * rotating subtrees.
         */
        while (cpos && insert_cpos <= cpos) {
-               mlog(0, "Rotating a tree: ins. cpos: %u, left path cpos: %u\n",
-                    insert_cpos, cpos);
+               trace_ocfs2_rotate_tree_right(
+                       (unsigned long long)
+                       ocfs2_metadata_cache_owner(et->et_ci),
+                       insert_cpos, cpos);
 
                ret = ocfs2_find_path(et->et_ci, left_path, cpos);
                if (ret) {
@@ -2461,10 +2457,10 @@ static int ocfs2_rotate_tree_right(handle_t *handle,
 
                start = ocfs2_find_subtree_root(et, left_path, right_path);
 
-               mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n",
-                    start,
-                    (unsigned long long) right_path->p_node[start].bh->b_blocknr,
-                    right_path->p_tree_depth);
+               trace_ocfs2_rotate_subtree(start,
+                       (unsigned long long)
+                       right_path->p_node[start].bh->b_blocknr,
+                       right_path->p_tree_depth);
 
                ret = ocfs2_extend_rotate_transaction(handle, start,
                                                      orig_credits, right_path);
@@ -2964,8 +2960,7 @@ static int __ocfs2_rotate_tree_left(handle_t *handle,
                subtree_root = ocfs2_find_subtree_root(et, left_path,
                                                       right_path);
 
-               mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n",
-                    subtree_root,
+               trace_ocfs2_rotate_subtree(subtree_root,
                     (unsigned long long)
                     right_path->p_node[subtree_root].bh->b_blocknr,
                     right_path->p_tree_depth);
@@ -3989,9 +3984,11 @@ static int ocfs2_append_rec_to_path(handle_t *handle,
                        goto out;
                }
 
-               mlog(0, "Append may need a left path update. cpos: %u, "
-                    "left_cpos: %u\n", le32_to_cpu(insert_rec->e_cpos),
-                    left_cpos);
+               trace_ocfs2_append_rec_to_path(
+                       (unsigned long long)
+                       ocfs2_metadata_cache_owner(et->et_ci),
+                       le32_to_cpu(insert_rec->e_cpos),
+                       left_cpos);
 
                /*
                 * No need to worry if the append is already in the
@@ -4562,7 +4559,7 @@ static int ocfs2_figure_insert_type(struct ocfs2_extent_tree *et,
                                              ocfs2_et_get_last_eb_blk(et),
                                              &bh);
                if (ret) {
-                       mlog_exit(ret);
+                       mlog_errno(ret);
                        goto out;
                }
                eb = (struct ocfs2_extent_block *) bh->b_data;
@@ -4678,9 +4675,9 @@ int ocfs2_insert_extent(handle_t *handle,
        struct ocfs2_insert_type insert = {0, };
        struct ocfs2_extent_rec rec;
 
-       mlog(0, "add %u clusters at position %u to owner %llu\n",
-            new_clusters, cpos,
-            (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci));
+       trace_ocfs2_insert_extent_start(
+               (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
+               cpos, new_clusters);
 
        memset(&rec, 0, sizeof(rec));
        rec.e_cpos = cpu_to_le32(cpos);
@@ -4700,11 +4697,9 @@ int ocfs2_insert_extent(handle_t *handle,
                goto bail;
        }
 
-       mlog(0, "Insert.appending: %u, Insert.Contig: %u, "
-            "Insert.contig_index: %d, Insert.free_records: %d, "
-            "Insert.tree_depth: %d\n",
-            insert.ins_appending, insert.ins_contig, insert.ins_contig_index,
-            free_records, insert.ins_tree_depth);
+       trace_ocfs2_insert_extent(insert.ins_appending, insert.ins_contig,
+                                 insert.ins_contig_index, free_records,
+                                 insert.ins_tree_depth);
 
        if (insert.ins_contig == CONTIG_NONE && free_records == 0) {
                status = ocfs2_grow_tree(handle, et,
@@ -4726,7 +4721,6 @@ int ocfs2_insert_extent(handle_t *handle,
 bail:
        brelse(last_eb_bh);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -4746,7 +4740,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
                                struct ocfs2_alloc_context *meta_ac,
                                enum ocfs2_alloc_restarted *reason_ret)
 {
-       int status = 0;
+       int status = 0, err = 0;
        int free_extents;
        enum ocfs2_alloc_restarted reason = RESTART_NONE;
        u32 bit_off, num_bits;
@@ -4773,14 +4767,14 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
         * 2) we are so fragmented, we've needed to add metadata too
         *    many times. */
        if (!free_extents && !meta_ac) {
-               mlog(0, "we haven't reserved any metadata!\n");
+               err = -1;
                status = -EAGAIN;
                reason = RESTART_META;
                goto leave;
        } else if ((!free_extents)
                   && (ocfs2_alloc_context_bits_left(meta_ac)
                       < ocfs2_extend_meta_needed(et->et_root_el))) {
-               mlog(0, "filesystem is really fragmented...\n");
+               err = -2;
                status = -EAGAIN;
                reason = RESTART_META;
                goto leave;
@@ -4805,9 +4799,9 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
        }
 
        block = ocfs2_clusters_to_blocks(osb->sb, bit_off);
-       mlog(0, "Allocating %u clusters at block %u for owner %llu\n",
-            num_bits, bit_off,
-            (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci));
+       trace_ocfs2_add_clusters_in_btree(
+            (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
+            bit_off, num_bits);
        status = ocfs2_insert_extent(handle, et, *logical_offset, block,
                                     num_bits, flags, meta_ac);
        if (status < 0) {
@@ -4821,16 +4815,15 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
        *logical_offset += num_bits;
 
        if (clusters_to_add) {
-               mlog(0, "need to alloc once more, wanted = %u\n",
-                    clusters_to_add);
+               err = clusters_to_add;
                status = -EAGAIN;
                reason = RESTART_TRANS;
        }
 
 leave:
-       mlog_exit(status);
        if (reason_ret)
                *reason_ret = reason;
+       trace_ocfs2_add_clusters_in_btree_ret(status, reason, err);
        return status;
 }
 
@@ -5039,7 +5032,7 @@ int ocfs2_split_extent(handle_t *handle,
                                              ocfs2_et_get_last_eb_blk(et),
                                              &last_eb_bh);
                if (ret) {
-                       mlog_exit(ret);
+                       mlog_errno(ret);
                        goto out;
                }
 
@@ -5056,9 +5049,9 @@ int ocfs2_split_extent(handle_t *handle,
 
        ctxt.c_has_empty_extent = ocfs2_is_empty_extent(&el->l_recs[0]);
 
-       mlog(0, "index: %d, contig: %u, has_empty: %u, split_covers: %u\n",
-            split_index, ctxt.c_contig_type, ctxt.c_has_empty_extent,
-            ctxt.c_split_covers_rec);
+       trace_ocfs2_split_extent(split_index, ctxt.c_contig_type,
+                                ctxt.c_has_empty_extent,
+                                ctxt.c_split_covers_rec);
 
        if (ctxt.c_contig_type == CONTIG_NONE) {
                if (ctxt.c_split_covers_rec)
@@ -5192,8 +5185,9 @@ int ocfs2_mark_extent_written(struct inode *inode,
 {
        int ret;
 
-       mlog(0, "Inode %lu cpos %u, len %u, phys clusters %u\n",
-            inode->i_ino, cpos, len, phys);
+       trace_ocfs2_mark_extent_written(
+               (unsigned long long)OCFS2_I(inode)->ip_blkno,
+               cpos, len, phys);
 
        if (!ocfs2_writes_unwritten_extents(OCFS2_SB(inode->i_sb))) {
                ocfs2_error(inode->i_sb, "Inode %llu has unwritten extents "
@@ -5512,11 +5506,10 @@ int ocfs2_remove_extent(handle_t *handle,
 
        BUG_ON(cpos < le32_to_cpu(rec->e_cpos) || trunc_range > rec_range);
 
-       mlog(0, "Owner %llu, remove (cpos %u, len %u). Existing index %d "
-            "(cpos %u, len %u)\n",
-            (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
-            cpos, len, index,
-            le32_to_cpu(rec->e_cpos), ocfs2_rec_clusters(el, rec));
+       trace_ocfs2_remove_extent(
+               (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
+               cpos, len, index, le32_to_cpu(rec->e_cpos),
+               ocfs2_rec_clusters(el, rec));
 
        if (le32_to_cpu(rec->e_cpos) == cpos || rec_range == trunc_range) {
                ret = ocfs2_truncate_rec(handle, et, path, index, dealloc,
@@ -5795,9 +5788,6 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
        struct ocfs2_dinode *di;
        struct ocfs2_truncate_log *tl;
 
-       mlog_entry("start_blk = %llu, num_clusters = %u\n",
-                  (unsigned long long)start_blk, num_clusters);
-
        BUG_ON(mutex_trylock(&tl_inode->i_mutex));
 
        start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk);
@@ -5834,10 +5824,9 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
                goto bail;
        }
 
-       mlog(0, "Log truncate of %u clusters starting at cluster %u to "
-            "%llu (index = %d)\n", num_clusters, start_cluster,
-            (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, index);
-
+       trace_ocfs2_truncate_log_append(
+               (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, index,
+               start_cluster, num_clusters);
        if (ocfs2_truncate_log_can_coalesce(tl, start_cluster)) {
                /*
                 * Move index back to the record we are coalescing with.
@@ -5846,9 +5835,10 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
                index--;
 
                num_clusters += le32_to_cpu(tl->tl_recs[index].t_clusters);
-               mlog(0, "Coalesce with index %u (start = %u, clusters = %u)\n",
-                    index, le32_to_cpu(tl->tl_recs[index].t_start),
-                    num_clusters);
+               trace_ocfs2_truncate_log_append(
+                       (unsigned long long)OCFS2_I(tl_inode)->ip_blkno,
+                       index, le32_to_cpu(tl->tl_recs[index].t_start),
+                       num_clusters);
        } else {
                tl->tl_recs[index].t_start = cpu_to_le32(start_cluster);
                tl->tl_used = cpu_to_le16(index + 1);
@@ -5859,7 +5849,6 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
 
        osb->truncated_clusters += num_clusters;
 bail:
-       mlog_exit(status);
        return status;
 }
 
@@ -5878,8 +5867,6 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
        struct inode *tl_inode = osb->osb_tl_inode;
        struct buffer_head *tl_bh = osb->osb_tl_bh;
 
-       mlog_entry_void();
-
        di = (struct ocfs2_dinode *) tl_bh->b_data;
        tl = &di->id2.i_dealloc;
        i = le16_to_cpu(tl->tl_used) - 1;
@@ -5915,8 +5902,9 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
                /* if start_blk is not set, we ignore the record as
                 * invalid. */
                if (start_blk) {
-                       mlog(0, "free record %d, start = %u, clusters = %u\n",
-                            i, le32_to_cpu(rec.t_start), num_clusters);
+                       trace_ocfs2_replay_truncate_records(
+                               (unsigned long long)OCFS2_I(tl_inode)->ip_blkno,
+                               i, le32_to_cpu(rec.t_start), num_clusters);
 
                        status = ocfs2_free_clusters(handle, data_alloc_inode,
                                                     data_alloc_bh, start_blk,
@@ -5932,7 +5920,6 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
        osb->truncated_clusters = 0;
 
 bail:
-       mlog_exit(status);
        return status;
 }
 
@@ -5949,8 +5936,6 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
        struct ocfs2_dinode *di;
        struct ocfs2_truncate_log *tl;
 
-       mlog_entry_void();
-
        BUG_ON(mutex_trylock(&tl_inode->i_mutex));
 
        di = (struct ocfs2_dinode *) tl_bh->b_data;
@@ -5962,8 +5947,9 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
 
        tl = &di->id2.i_dealloc;
        num_to_flush = le16_to_cpu(tl->tl_used);
-       mlog(0, "Flush %u records from truncate log #%llu\n",
-            num_to_flush, (unsigned long long)OCFS2_I(tl_inode)->ip_blkno);
+       trace_ocfs2_flush_truncate_log(
+               (unsigned long long)OCFS2_I(tl_inode)->ip_blkno,
+               num_to_flush);
        if (!num_to_flush) {
                status = 0;
                goto out;
@@ -6009,7 +5995,6 @@ out_mutex:
        iput(data_alloc_inode);
 
 out:
-       mlog_exit(status);
        return status;
 }
 
@@ -6032,15 +6017,11 @@ static void ocfs2_truncate_log_worker(struct work_struct *work)
                container_of(work, struct ocfs2_super,
                             osb_truncate_log_wq.work);
 
-       mlog_entry_void();
-
        status = ocfs2_flush_truncate_log(osb);
        if (status < 0)
                mlog_errno(status);
        else
                ocfs2_init_steal_slots(osb);
-
-       mlog_exit(status);
 }
 
 #define OCFS2_TRUNCATE_LOG_FLUSH_INTERVAL (2 * HZ)
@@ -6086,7 +6067,6 @@ static int ocfs2_get_truncate_log_info(struct ocfs2_super *osb,
        *tl_inode = inode;
        *tl_bh    = bh;
 bail:
-       mlog_exit(status);
        return status;
 }
 
@@ -6106,7 +6086,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
 
        *tl_copy = NULL;
 
-       mlog(0, "recover truncate log from slot %d\n", slot_num);
+       trace_ocfs2_begin_truncate_log_recovery(slot_num);
 
        status = ocfs2_get_truncate_log_info(osb, slot_num, &tl_inode, &tl_bh);
        if (status < 0) {
@@ -6123,8 +6103,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
 
        tl = &di->id2.i_dealloc;
        if (le16_to_cpu(tl->tl_used)) {
-               mlog(0, "We'll have %u logs to recover\n",
-                    le16_to_cpu(tl->tl_used));
+               trace_ocfs2_truncate_log_recovery_num(le16_to_cpu(tl->tl_used));
 
                *tl_copy = kmalloc(tl_bh->b_size, GFP_KERNEL);
                if (!(*tl_copy)) {
@@ -6157,9 +6136,9 @@ bail:
        if (status < 0 && (*tl_copy)) {
                kfree(*tl_copy);
                *tl_copy = NULL;
+               mlog_errno(status);
        }
 
-       mlog_exit(status);
        return status;
 }
 
@@ -6174,8 +6153,6 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb,
        struct inode *tl_inode = osb->osb_tl_inode;
        struct ocfs2_truncate_log *tl;
 
-       mlog_entry_void();
-
        if (OCFS2_I(tl_inode)->ip_blkno == le64_to_cpu(tl_copy->i_blkno)) {
                mlog(ML_ERROR, "Asked to recover my own truncate log!\n");
                return -EINVAL;
@@ -6183,8 +6160,9 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb,
 
        tl = &tl_copy->id2.i_dealloc;
        num_recs = le16_to_cpu(tl->tl_used);
-       mlog(0, "cleanup %u records from %llu\n", num_recs,
-            (unsigned long long)le64_to_cpu(tl_copy->i_blkno));
+       trace_ocfs2_complete_truncate_log_recovery(
+               (unsigned long long)le64_to_cpu(tl_copy->i_blkno),
+               num_recs);
 
        mutex_lock(&tl_inode->i_mutex);
        for(i = 0; i < num_recs; i++) {
@@ -6219,7 +6197,6 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb,
 bail_up:
        mutex_unlock(&tl_inode->i_mutex);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -6228,8 +6205,6 @@ void ocfs2_truncate_log_shutdown(struct ocfs2_super *osb)
        int status;
        struct inode *tl_inode = osb->osb_tl_inode;
 
-       mlog_entry_void();
-
        if (tl_inode) {
                cancel_delayed_work(&osb->osb_truncate_log_wq);
                flush_workqueue(ocfs2_wq);
@@ -6241,8 +6216,6 @@ void ocfs2_truncate_log_shutdown(struct ocfs2_super *osb)
                brelse(osb->osb_tl_bh);
                iput(osb->osb_tl_inode);
        }
-
-       mlog_exit_void();
 }
 
 int ocfs2_truncate_log_init(struct ocfs2_super *osb)
@@ -6251,8 +6224,6 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb)
        struct inode *tl_inode = NULL;
        struct buffer_head *tl_bh = NULL;
 
-       mlog_entry_void();
-
        status = ocfs2_get_truncate_log_info(osb,
                                             osb->slot_num,
                                             &tl_inode,
@@ -6268,7 +6239,6 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb)
        osb->osb_tl_bh    = tl_bh;
        osb->osb_tl_inode = tl_inode;
 
-       mlog_exit(status);
        return status;
 }
 
@@ -6350,8 +6320,8 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb,
                else
                        bg_blkno = ocfs2_which_suballoc_group(head->free_blk,
                                                              head->free_bit);
-               mlog(0, "Free bit: (bit %u, blkno %llu)\n",
-                    head->free_bit, (unsigned long long)head->free_blk);
+               trace_ocfs2_free_cached_blocks(
+                    (unsigned long long)head->free_blk, head->free_bit);
 
                ret = ocfs2_free_suballoc_bits(handle, inode, di_bh,
                                               head->free_bit, bg_blkno, 1);
@@ -6404,8 +6374,7 @@ int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt,
                return ret;
        }
 
-       mlog(0, "Insert clusters: (bit %u, blk %llu)\n",
-            bit, (unsigned long long)blkno);
+       trace_ocfs2_cache_cluster_dealloc((unsigned long long)blkno, bit);
 
        item->free_blk = blkno;
        item->free_bit = bit;
@@ -6480,8 +6449,8 @@ int ocfs2_run_deallocs(struct ocfs2_super *osb,
                fl = ctxt->c_first_suballocator;
 
                if (fl->f_first) {
-                       mlog(0, "Free items: (type %u, slot %d)\n",
-                            fl->f_inode_type, fl->f_slot);
+                       trace_ocfs2_run_deallocs(fl->f_inode_type,
+                                                fl->f_slot);
                        ret2 = ocfs2_free_cached_blocks(osb,
                                                        fl->f_inode_type,
                                                        fl->f_slot,
@@ -6558,8 +6527,9 @@ int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt,
                goto out;
        }
 
-       mlog(0, "Insert: (type %d, slot %u, bit %u, blk %llu)\n",
-            type, slot, bit, (unsigned long long)blkno);
+       trace_ocfs2_cache_block_dealloc(type, slot,
+                                       (unsigned long long)suballoc,
+                                       (unsigned long long)blkno, bit);
 
        item->free_bg = suballoc;
        item->free_blk = blkno;
@@ -7005,8 +6975,6 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
        struct ocfs2_extent_tree et;
        struct ocfs2_cached_dealloc_ctxt dealloc;
 
-       mlog_entry_void();
-
        ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh);
        ocfs2_init_dealloc_ctxt(&dealloc);
 
@@ -7041,8 +7009,11 @@ start:
                goto bail;
        }
 
-       mlog(0, "inode->ip_clusters = %u, tree_depth = %u\n",
-            OCFS2_I(inode)->ip_clusters, path->p_tree_depth);
+       trace_ocfs2_commit_truncate(
+               (unsigned long long)OCFS2_I(inode)->ip_blkno,
+               new_highest_cpos,
+               OCFS2_I(inode)->ip_clusters,
+               path->p_tree_depth);
 
        /*
         * By now, el will point to the extent list on the bottom most
@@ -7136,7 +7107,6 @@ bail:
 
        ocfs2_free_path(path);
 
-       mlog_exit(status);
        return status;
 }
 
index daea0359e9740263a525cec5c7f645e456d9a909..ac97bca282d25ebb5943c41ac05fef385d93abf1 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/mpage.h>
 #include <linux/quotaops.h>
 
-#define MLOG_MASK_PREFIX ML_FILE_IO
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -45,6 +44,7 @@
 #include "super.h"
 #include "symlink.h"
 #include "refcounttree.h"
+#include "ocfs2_trace.h"
 
 #include "buffer_head_io.h"
 
@@ -59,8 +59,9 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        void *kaddr;
 
-       mlog_entry("(0x%p, %llu, 0x%p, %d)\n", inode,
-                  (unsigned long long)iblock, bh_result, create);
+       trace_ocfs2_symlink_get_block(
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       (unsigned long long)iblock, bh_result, create);
 
        BUG_ON(ocfs2_inode_is_fast_symlink(inode));
 
@@ -123,7 +124,6 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
 bail:
        brelse(bh);
 
-       mlog_exit(err);
        return err;
 }
 
@@ -136,8 +136,8 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock,
        u64 p_blkno, count, past_eof;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 
-       mlog_entry("(0x%p, %llu, 0x%p, %d)\n", inode,
-                  (unsigned long long)iblock, bh_result, create);
+       trace_ocfs2_get_block((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                             (unsigned long long)iblock, bh_result, create);
 
        if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE)
                mlog(ML_NOTICE, "get_block on system inode 0x%p (%lu)\n",
@@ -199,8 +199,9 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock,
        }
 
        past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode));
-       mlog(0, "Inode %lu, past_eof = %llu\n", inode->i_ino,
-            (unsigned long long)past_eof);
+
+       trace_ocfs2_get_block_end((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                                 (unsigned long long)past_eof);
        if (create && (iblock >= past_eof))
                set_buffer_new(bh_result);
 
@@ -208,7 +209,6 @@ bail:
        if (err < 0)
                err = -EIO;
 
-       mlog_exit(err);
        return err;
 }
 
@@ -278,7 +278,8 @@ static int ocfs2_readpage(struct file *file, struct page *page)
        loff_t start = (loff_t)page->index << PAGE_CACHE_SHIFT;
        int ret, unlock = 1;
 
-       mlog_entry("(0x%p, %lu)\n", file, (page ? page->index : 0));
+       trace_ocfs2_readpage((unsigned long long)oi->ip_blkno,
+                            (page ? page->index : 0));
 
        ret = ocfs2_inode_lock_with_page(inode, NULL, 0, page);
        if (ret != 0) {
@@ -323,7 +324,6 @@ out_inode_unlock:
 out:
        if (unlock)
                unlock_page(page);
-       mlog_exit(ret);
        return ret;
 }
 
@@ -396,15 +396,11 @@ out_unlock:
  */
 static int ocfs2_writepage(struct page *page, struct writeback_control *wbc)
 {
-       int ret;
-
-       mlog_entry("(0x%p)\n", page);
-
-       ret = block_write_full_page(page, ocfs2_get_block, wbc);
+       trace_ocfs2_writepage(
+               (unsigned long long)OCFS2_I(page->mapping->host)->ip_blkno,
+               page->index);
 
-       mlog_exit(ret);
-
-       return ret;
+       return block_write_full_page(page, ocfs2_get_block, wbc);
 }
 
 /* Taken from ext3. We don't necessarily need the full blown
@@ -450,7 +446,8 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block)
        int err = 0;
        struct inode *inode = mapping->host;
 
-       mlog_entry("(block = %llu)\n", (unsigned long long)block);
+       trace_ocfs2_bmap((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                        (unsigned long long)block);
 
        /* We don't need to lock journal system files, since they aren't
         * accessed concurrently from multiple nodes.
@@ -484,8 +481,6 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block)
 bail:
        status = err ? 0 : p_blkno;
 
-       mlog_exit((int)status);
-
        return status;
 }
 
@@ -616,9 +611,6 @@ static ssize_t ocfs2_direct_IO(int rw,
 {
        struct file *file = iocb->ki_filp;
        struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
-       int ret;
-
-       mlog_entry_void();
 
        /*
         * Fallback to buffered I/O if we see an inode without
@@ -631,13 +623,10 @@ static ssize_t ocfs2_direct_IO(int rw,
        if (i_size_read(inode) <= offset)
                return 0;
 
-       ret = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
-                                  iov, offset, nr_segs,
-                                  ocfs2_direct_IO_get_blocks,
-                                  ocfs2_dio_end_io, NULL, 0);
-
-       mlog_exit(ret);
-       return ret;
+       return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
+                                   iov, offset, nr_segs,
+                                   ocfs2_direct_IO_get_blocks,
+                                   ocfs2_dio_end_io, NULL, 0);
 }
 
 static void ocfs2_figure_cluster_boundaries(struct ocfs2_super *osb,
@@ -1026,6 +1015,12 @@ static int ocfs2_prepare_page_for_write(struct inode *inode, u64 *p_blkno,
        ocfs2_figure_cluster_boundaries(OCFS2_SB(inode->i_sb), cpos,
                                        &cluster_start, &cluster_end);
 
+       /* treat the write as new if the a hole/lseek spanned across
+        * the page boundary.
+        */
+       new = new | ((i_size_read(inode) <= page_offset(page)) &&
+                       (page_offset(page) <= user_pos));
+
        if (page == wc->w_target_page) {
                map_from = user_pos & (PAGE_CACHE_SIZE - 1);
                map_to = map_from + user_len;
@@ -1534,9 +1529,9 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping,
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
        struct ocfs2_dinode *di = NULL;
 
-       mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n",
-            (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos,
-            oi->ip_dyn_features);
+       trace_ocfs2_try_to_write_inline_data((unsigned long long)oi->ip_blkno,
+                                            len, (unsigned long long)pos,
+                                            oi->ip_dyn_features);
 
        /*
         * Handle inodes which already have inline data 1st.
@@ -1739,6 +1734,13 @@ try_again:
 
        di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
 
+       trace_ocfs2_write_begin_nolock(
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       (long long)i_size_read(inode),
+                       le32_to_cpu(di->i_clusters),
+                       pos, len, flags, mmap_page,
+                       clusters_to_alloc, extents_to_split);
+
        /*
         * We set w_target_from, w_target_to here so that
         * ocfs2_write_end() knows which range in the target page to
@@ -1751,12 +1753,6 @@ try_again:
                 * ocfs2_lock_allocators(). It greatly over-estimates
                 * the work to be done.
                 */
-               mlog(0, "extend inode %llu, i_size = %lld, di->i_clusters = %u,"
-                    " clusters_to_add = %u, extents_to_split = %u\n",
-                    (unsigned long long)OCFS2_I(inode)->ip_blkno,
-                    (long long)i_size_read(inode), le32_to_cpu(di->i_clusters),
-                    clusters_to_alloc, extents_to_split);
-
                ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode),
                                              wc->w_di_bh);
                ret = ocfs2_lock_allocators(inode, &et,
@@ -1938,8 +1934,8 @@ static void ocfs2_write_end_inline(struct inode *inode, loff_t pos,
        memcpy(di->id2.i_data.id_data + pos, kaddr + pos, *copied);
        kunmap_atomic(kaddr, KM_USER0);
 
-       mlog(0, "Data written to inode at offset %llu. "
-            "id_count = %u, copied = %u, i_dyn_features = 0x%x\n",
+       trace_ocfs2_write_end_inline(
+            (unsigned long long)OCFS2_I(inode)->ip_blkno,
             (unsigned long long)pos, *copied,
             le16_to_cpu(di->id2.i_data.id_count),
             le16_to_cpu(di->i_dyn_features));
index f9d5d3ffc75a9011b0a63a76a97184853ee7f063..5d18ad10c27fc044ae240a5c147c8f3e0b146ae5 100644 (file)
@@ -35,8 +35,8 @@
 #include "inode.h"
 #include "journal.h"
 #include "uptodate.h"
-
 #include "buffer_head_io.h"
+#include "ocfs2_trace.h"
 
 /*
  * Bits on bh->b_state used by ocfs2.
@@ -55,8 +55,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
 {
        int ret = 0;
 
-       mlog_entry("(bh->b_blocknr = %llu, ci=%p)\n",
-                  (unsigned long long)bh->b_blocknr, ci);
+       trace_ocfs2_write_block((unsigned long long)bh->b_blocknr, ci);
 
        BUG_ON(bh->b_blocknr < OCFS2_SUPER_BLOCK_BLKNO);
        BUG_ON(buffer_jbd(bh));
@@ -66,6 +65,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
         * can get modified during recovery even if read-only. */
        if (ocfs2_is_hard_readonly(osb)) {
                ret = -EROFS;
+               mlog_errno(ret);
                goto out;
        }
 
@@ -91,11 +91,11 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
                 * uptodate. */
                ret = -EIO;
                put_bh(bh);
+               mlog_errno(ret);
        }
 
        ocfs2_metadata_cache_io_unlock(ci);
 out:
-       mlog_exit(ret);
        return ret;
 }
 
@@ -106,10 +106,10 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,
        unsigned int i;
        struct buffer_head *bh;
 
-       if (!nr) {
-               mlog(ML_BH_IO, "No buffers will be read!\n");
+       trace_ocfs2_read_blocks_sync((unsigned long long)block, nr);
+
+       if (!nr)
                goto bail;
-       }
 
        for (i = 0 ; i < nr ; i++) {
                if (bhs[i] == NULL) {
@@ -123,10 +123,8 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,
                bh = bhs[i];
 
                if (buffer_jbd(bh)) {
-                       mlog(ML_BH_IO,
-                            "trying to sync read a jbd "
-                            "managed bh (blocknr = %llu), skipping\n",
-                            (unsigned long long)bh->b_blocknr);
+                       trace_ocfs2_read_blocks_sync_jbd(
+                                       (unsigned long long)bh->b_blocknr);
                        continue;
                }
 
@@ -186,8 +184,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
        struct buffer_head *bh;
        struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
 
-       mlog_entry("(ci=%p, block=(%llu), nr=(%d), flags=%d)\n",
-                  ci, (unsigned long long)block, nr, flags);
+       trace_ocfs2_read_blocks_begin(ci, (unsigned long long)block, nr, flags);
 
        BUG_ON(!ci);
        BUG_ON((flags & OCFS2_BH_READAHEAD) &&
@@ -207,7 +204,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
        }
 
        if (nr == 0) {
-               mlog(ML_BH_IO, "No buffers will be read!\n");
                status = 0;
                goto bail;
        }
@@ -251,8 +247,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
                 */
 
                if (!ignore_cache && !ocfs2_buffer_uptodate(ci, bh)) {
-                       mlog(ML_UPTODATE,
-                            "bh (%llu), owner %llu not uptodate\n",
+                       trace_ocfs2_read_blocks_from_disk(
                             (unsigned long long)bh->b_blocknr,
                             (unsigned long long)ocfs2_metadata_cache_owner(ci));
                        /* We're using ignore_cache here to say
@@ -260,11 +255,10 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
                        ignore_cache = 1;
                }
 
+               trace_ocfs2_read_blocks_bh((unsigned long long)bh->b_blocknr,
+                       ignore_cache, buffer_jbd(bh), buffer_dirty(bh));
+
                if (buffer_jbd(bh)) {
-                       if (ignore_cache)
-                               mlog(ML_BH_IO, "trying to sync read a jbd "
-                                              "managed bh (blocknr = %llu)\n",
-                                    (unsigned long long)bh->b_blocknr);
                        continue;
                }
 
@@ -272,9 +266,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
                        if (buffer_dirty(bh)) {
                                /* This should probably be a BUG, or
                                 * at least return an error. */
-                               mlog(ML_BH_IO, "asking me to sync read a dirty "
-                                              "buffer! (blocknr = %llu)\n",
-                                    (unsigned long long)bh->b_blocknr);
                                continue;
                        }
 
@@ -367,14 +358,11 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
        }
        ocfs2_metadata_cache_io_unlock(ci);
 
-       mlog(ML_BH_IO, "block=(%llu), nr=(%d), cached=%s, flags=0x%x\n",
-            (unsigned long long)block, nr,
-            ((flags & OCFS2_BH_IGNORE_CACHE) || ignore_cache) ? "no" : "yes",
-            flags);
+       trace_ocfs2_read_blocks_end((unsigned long long)block, nr,
+                                   flags, ignore_cache);
 
 bail:
 
-       mlog_exit(status);
        return status;
 }
 
@@ -408,13 +396,12 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
        int ret = 0;
        struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
 
-       mlog_entry_void();
-
        BUG_ON(buffer_jbd(bh));
        ocfs2_check_super_or_backup(osb->sb, bh->b_blocknr);
 
        if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) {
                ret = -EROFS;
+               mlog_errno(ret);
                goto out;
        }
 
@@ -434,9 +421,9 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
        if (!buffer_uptodate(bh)) {
                ret = -EIO;
                put_bh(bh);
+               mlog_errno(ret);
        }
 
 out:
-       mlog_exit(ret);
        return ret;
 }
index 1adab287bd24c814ceb042be381744b3c3fc3e7c..2461eb3272edfab9c6c4949cb435252181938b72 100644 (file)
@@ -1654,8 +1654,6 @@ static int o2hb_populate_slot_data(struct o2hb_region *reg)
        struct o2hb_disk_slot *slot;
        struct o2hb_disk_heartbeat_block *hb_block;
 
-       mlog_entry_void();
-
        ret = o2hb_read_slots(reg, reg->hr_blocks);
        if (ret) {
                mlog_errno(ret);
@@ -1677,7 +1675,6 @@ static int o2hb_populate_slot_data(struct o2hb_region *reg)
        }
 
 out:
-       mlog_exit(ret);
        return ret;
 }
 
index 6c61771469af24ef9e2610e93e65092768b59691..07ac24fd92520f604f6d3cfeff4cd4bd2c6ad85c 100644 (file)
@@ -30,7 +30,7 @@
 
 struct mlog_bits mlog_and_bits = MLOG_BITS_RHS(MLOG_INITIAL_AND_MASK);
 EXPORT_SYMBOL_GPL(mlog_and_bits);
-struct mlog_bits mlog_not_bits = MLOG_BITS_RHS(MLOG_INITIAL_NOT_MASK);
+struct mlog_bits mlog_not_bits = MLOG_BITS_RHS(0);
 EXPORT_SYMBOL_GPL(mlog_not_bits);
 
 static ssize_t mlog_mask_show(u64 mask, char *buf)
@@ -80,8 +80,6 @@ struct mlog_attribute {
 }
 
 static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
-       define_mask(ENTRY),
-       define_mask(EXIT),
        define_mask(TCP),
        define_mask(MSG),
        define_mask(SOCKET),
@@ -93,27 +91,11 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
        define_mask(DLM_THREAD),
        define_mask(DLM_MASTER),
        define_mask(DLM_RECOVERY),
-       define_mask(AIO),
-       define_mask(JOURNAL),
-       define_mask(DISK_ALLOC),
-       define_mask(SUPER),
-       define_mask(FILE_IO),
-       define_mask(EXTENT_MAP),
        define_mask(DLM_GLUE),
-       define_mask(BH_IO),
-       define_mask(UPTODATE),
-       define_mask(NAMEI),
-       define_mask(INODE),
        define_mask(VOTE),
-       define_mask(DCACHE),
        define_mask(CONN),
        define_mask(QUORUM),
-       define_mask(EXPORT),
-       define_mask(XATTR),
-       define_mask(QUOTA),
-       define_mask(REFCOUNT),
        define_mask(BASTS),
-       define_mask(RESERVATIONS),
        define_mask(CLUSTER),
        define_mask(ERROR),
        define_mask(NOTICE),
index 34d6544357d9718699af25e25aecc48a1f26c9c0..baa2b9ef7eef90094dbd3ef8d76f6a6e1df64224 100644 (file)
 
 /* bits that are frequently given and infrequently matched in the low word */
 /* NOTE: If you add a flag, you need to also update masklog.c! */
-#define ML_ENTRY       0x0000000000000001ULL /* func call entry */
-#define ML_EXIT                0x0000000000000002ULL /* func call exit */
-#define ML_TCP         0x0000000000000004ULL /* net cluster/tcp.c */
-#define ML_MSG         0x0000000000000008ULL /* net network messages */
-#define ML_SOCKET      0x0000000000000010ULL /* net socket lifetime */
-#define ML_HEARTBEAT   0x0000000000000020ULL /* hb all heartbeat tracking */
-#define ML_HB_BIO      0x0000000000000040ULL /* hb io tracing */
-#define ML_DLMFS       0x0000000000000080ULL /* dlm user dlmfs */
-#define ML_DLM         0x0000000000000100ULL /* dlm general debugging */
-#define ML_DLM_DOMAIN  0x0000000000000200ULL /* dlm domain debugging */
-#define ML_DLM_THREAD  0x0000000000000400ULL /* dlm domain thread */
-#define ML_DLM_MASTER  0x0000000000000800ULL /* dlm master functions */
-#define ML_DLM_RECOVERY        0x0000000000001000ULL /* dlm master functions */
-#define ML_AIO         0x0000000000002000ULL /* ocfs2 aio read and write */
-#define ML_JOURNAL     0x0000000000004000ULL /* ocfs2 journalling functions */
-#define ML_DISK_ALLOC  0x0000000000008000ULL /* ocfs2 disk allocation */
-#define ML_SUPER       0x0000000000010000ULL /* ocfs2 mount / umount */
-#define ML_FILE_IO     0x0000000000020000ULL /* ocfs2 file I/O */
-#define ML_EXTENT_MAP  0x0000000000040000ULL /* ocfs2 extent map caching */
-#define ML_DLM_GLUE    0x0000000000080000ULL /* ocfs2 dlm glue layer */
-#define ML_BH_IO       0x0000000000100000ULL /* ocfs2 buffer I/O */
-#define ML_UPTODATE    0x0000000000200000ULL /* ocfs2 caching sequence #'s */
-#define ML_NAMEI       0x0000000000400000ULL /* ocfs2 directory / namespace */
-#define ML_INODE       0x0000000000800000ULL /* ocfs2 inode manipulation */
-#define ML_VOTE                0x0000000001000000ULL /* ocfs2 node messaging  */
-#define ML_DCACHE      0x0000000002000000ULL /* ocfs2 dcache operations */
-#define ML_CONN                0x0000000004000000ULL /* net connection management */
-#define ML_QUORUM      0x0000000008000000ULL /* net connection quorum */
-#define ML_EXPORT      0x0000000010000000ULL /* ocfs2 export operations */
-#define ML_XATTR       0x0000000020000000ULL /* ocfs2 extended attributes */
-#define ML_QUOTA       0x0000000040000000ULL /* ocfs2 quota operations */
-#define ML_REFCOUNT    0x0000000080000000ULL /* refcount tree operations */
-#define ML_BASTS       0x0000000100000000ULL /* dlmglue asts and basts */
-#define ML_RESERVATIONS        0x0000000200000000ULL /* ocfs2 alloc reservations */
-#define ML_CLUSTER     0x0000000400000000ULL /* cluster stack */
+#define ML_TCP         0x0000000000000001ULL /* net cluster/tcp.c */
+#define ML_MSG         0x0000000000000002ULL /* net network messages */
+#define ML_SOCKET      0x0000000000000004ULL /* net socket lifetime */
+#define ML_HEARTBEAT   0x0000000000000008ULL /* hb all heartbeat tracking */
+#define ML_HB_BIO      0x0000000000000010ULL /* hb io tracing */
+#define ML_DLMFS       0x0000000000000020ULL /* dlm user dlmfs */
+#define ML_DLM         0x0000000000000040ULL /* dlm general debugging */
+#define ML_DLM_DOMAIN  0x0000000000000080ULL /* dlm domain debugging */
+#define ML_DLM_THREAD  0x0000000000000100ULL /* dlm domain thread */
+#define ML_DLM_MASTER  0x0000000000000200ULL /* dlm master functions */
+#define ML_DLM_RECOVERY        0x0000000000000400ULL /* dlm master functions */
+#define ML_DLM_GLUE    0x0000000000000800ULL /* ocfs2 dlm glue layer */
+#define ML_VOTE                0x0000000000001000ULL /* ocfs2 node messaging  */
+#define ML_CONN                0x0000000000002000ULL /* net connection management */
+#define ML_QUORUM      0x0000000000004000ULL /* net connection quorum */
+#define ML_BASTS       0x0000000000008000ULL /* dlmglue asts and basts */
+#define ML_CLUSTER     0x0000000000010000ULL /* cluster stack */
 
 /* bits that are infrequently given and frequently matched in the high word */
 #define ML_ERROR       0x1000000000000000ULL /* sent to KERN_ERR */
 #define ML_KTHREAD     0x4000000000000000ULL /* kernel thread activity */
 
 #define MLOG_INITIAL_AND_MASK (ML_ERROR|ML_NOTICE)
-#define MLOG_INITIAL_NOT_MASK (ML_ENTRY|ML_EXIT)
 #ifndef MLOG_MASK_PREFIX
 #define MLOG_MASK_PREFIX 0
 #endif
@@ -222,58 +203,6 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
                mlog(ML_ERROR, "status = %lld\n", (long long)_st);      \
 } while (0)
 
-#if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
-#define mlog_entry(fmt, args...) do {                                  \
-       mlog(ML_ENTRY, "ENTRY:" fmt , ##args);                          \
-} while (0)
-
-#define mlog_entry_void() do {                                         \
-       mlog(ML_ENTRY, "ENTRY:\n");                                     \
-} while (0)
-
-/*
- * We disable this for sparse.
- */
-#if !defined(__CHECKER__)
-#define mlog_exit(st) do {                                                  \
-       if (__builtin_types_compatible_p(typeof(st), unsigned long))         \
-               mlog(ML_EXIT, "EXIT: %lu\n", (unsigned long) (st));          \
-       else if (__builtin_types_compatible_p(typeof(st), signed long))      \
-               mlog(ML_EXIT, "EXIT: %ld\n", (signed long) (st));            \
-       else if (__builtin_types_compatible_p(typeof(st), unsigned int)      \
-                || __builtin_types_compatible_p(typeof(st), unsigned short) \
-                || __builtin_types_compatible_p(typeof(st), unsigned char)) \
-               mlog(ML_EXIT, "EXIT: %u\n", (unsigned int) (st));            \
-       else if (__builtin_types_compatible_p(typeof(st), signed int)        \
-                || __builtin_types_compatible_p(typeof(st), signed short)   \
-                || __builtin_types_compatible_p(typeof(st), signed char))   \
-               mlog(ML_EXIT, "EXIT: %d\n", (signed int) (st));              \
-       else if (__builtin_types_compatible_p(typeof(st), long long))        \
-               mlog(ML_EXIT, "EXIT: %lld\n", (long long) (st));             \
-       else                                                                 \
-               mlog(ML_EXIT, "EXIT: %llu\n", (unsigned long long) (st));    \
-} while (0)
-#else
-#define mlog_exit(st) do {                                                  \
-       mlog(ML_EXIT, "EXIT: %lld\n", (long long) (st));                     \
-} while (0)
-#endif
-
-#define mlog_exit_ptr(ptr) do {                                                \
-       mlog(ML_EXIT, "EXIT: %p\n", ptr);                               \
-} while (0)
-
-#define mlog_exit_void() do {                                          \
-       mlog(ML_EXIT, "EXIT\n");                                        \
-} while (0)
-#else
-#define mlog_entry(...)  do { } while (0)
-#define mlog_entry_void(...)  do { } while (0)
-#define mlog_exit(...)  do { } while (0)
-#define mlog_exit_ptr(...)  do { } while (0)
-#define mlog_exit_void(...)  do { } while (0)
-#endif  /* defined(CONFIG_OCFS2_DEBUG_MASKLOG) */
-
 #define mlog_bug_on_msg(cond, fmt, args...) do {                       \
        if (cond) {                                                     \
                mlog(ML_ERROR, "bug expression: " #cond "\n");          \
index 3b11cb1e38fce990a5e2042fd75ebd0f7a3fbbaf..ee04ff5ee60334106fca7ce4c94bd23f86b05f31 100644 (file)
@@ -210,10 +210,6 @@ static inline void o2net_set_func_stop_time(struct o2net_sock_container *sc)
        sc->sc_tv_func_stop = ktime_get();
 }
 
-static ktime_t o2net_get_func_run_time(struct o2net_sock_container *sc)
-{
-       return ktime_sub(sc->sc_tv_func_stop, sc->sc_tv_func_start);
-}
 #else  /* CONFIG_DEBUG_FS */
 # define o2net_init_nst(a, b, c, d, e)
 # define o2net_set_nst_sock_time(a)
@@ -227,10 +223,14 @@ static ktime_t o2net_get_func_run_time(struct o2net_sock_container *sc)
 # define o2net_set_advance_stop_time(a)
 # define o2net_set_func_start_time(a)
 # define o2net_set_func_stop_time(a)
-# define o2net_get_func_run_time(a)            (ktime_t)0
 #endif /* CONFIG_DEBUG_FS */
 
 #ifdef CONFIG_OCFS2_FS_STATS
+static ktime_t o2net_get_func_run_time(struct o2net_sock_container *sc)
+{
+       return ktime_sub(sc->sc_tv_func_stop, sc->sc_tv_func_start);
+}
+
 static void o2net_update_send_stats(struct o2net_send_tracking *nst,
                                    struct o2net_sock_container *sc)
 {
index 7eb90403fc8af0521b7d3df89d37956ccad054a4..e5ba348183321d133ab7f75c715b305dbed28a07 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/slab.h>
 #include <linux/namei.h>
 
-#define MLOG_MASK_PREFIX ML_DCACHE
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -39,6 +38,7 @@
 #include "file.h"
 #include "inode.h"
 #include "super.h"
+#include "ocfs2_trace.h"
 
 void ocfs2_dentry_attach_gen(struct dentry *dentry)
 {
@@ -62,8 +62,8 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry,
        inode = dentry->d_inode;
        osb = OCFS2_SB(dentry->d_sb);
 
-       mlog_entry("(0x%p, '%.*s')\n", dentry,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_dentry_revalidate(dentry, dentry->d_name.len,
+                                     dentry->d_name.name);
 
        /* For a negative dentry -
         * check the generation number of the parent and compare with the
@@ -73,9 +73,10 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry,
                unsigned long gen = (unsigned long) dentry->d_fsdata;
                unsigned long pgen =
                        OCFS2_I(dentry->d_parent->d_inode)->ip_dir_lock_gen;
-               mlog(0, "negative dentry: %.*s parent gen: %lu "
-                       "dentry gen: %lu\n",
-                       dentry->d_name.len, dentry->d_name.name, pgen, gen);
+
+               trace_ocfs2_dentry_revalidate_negative(dentry->d_name.len,
+                                                      dentry->d_name.name,
+                                                      pgen, gen);
                if (gen != pgen)
                        goto bail;
                goto valid;
@@ -90,8 +91,8 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry,
        /* did we or someone else delete this inode? */
        if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_DELETED) {
                spin_unlock(&OCFS2_I(inode)->ip_lock);
-               mlog(0, "inode (%llu) deleted, returning false\n",
-                    (unsigned long long)OCFS2_I(inode)->ip_blkno);
+               trace_ocfs2_dentry_revalidate_delete(
+                               (unsigned long long)OCFS2_I(inode)->ip_blkno);
                goto bail;
        }
        spin_unlock(&OCFS2_I(inode)->ip_lock);
@@ -101,10 +102,9 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry,
         * inode nlink hits zero, it never goes back.
         */
        if (inode->i_nlink == 0) {
-               mlog(0, "Inode %llu orphaned, returning false "
-                    "dir = %d\n",
-                    (unsigned long long)OCFS2_I(inode)->ip_blkno,
-                    S_ISDIR(inode->i_mode));
+               trace_ocfs2_dentry_revalidate_orphaned(
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       S_ISDIR(inode->i_mode));
                goto bail;
        }
 
@@ -113,9 +113,8 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry,
         * redo it.
         */
        if (!dentry->d_fsdata) {
-               mlog(0, "Inode %llu doesn't have dentry lock, "
-                    "returning false\n",
-                    (unsigned long long)OCFS2_I(inode)->ip_blkno);
+               trace_ocfs2_dentry_revalidate_nofsdata(
+                               (unsigned long long)OCFS2_I(inode)->ip_blkno);
                goto bail;
        }
 
@@ -123,8 +122,7 @@ valid:
        ret = 1;
 
 bail:
-       mlog_exit(ret);
-
+       trace_ocfs2_dentry_revalidate_ret(ret);
        return ret;
 }
 
@@ -181,8 +179,8 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode,
 
                spin_lock(&dentry->d_lock);
                if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) {
-                       mlog(0, "dentry found: %.*s\n",
-                            dentry->d_name.len, dentry->d_name.name);
+                       trace_ocfs2_find_local_alias(dentry->d_name.len,
+                                                    dentry->d_name.name);
 
                        dget_dlock(dentry);
                        spin_unlock(&dentry->d_lock);
@@ -240,9 +238,8 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry,
        struct dentry *alias;
        struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
 
-       mlog(0, "Attach \"%.*s\", parent %llu, fsdata: %p\n",
-            dentry->d_name.len, dentry->d_name.name,
-            (unsigned long long)parent_blkno, dl);
+       trace_ocfs2_dentry_attach_lock(dentry->d_name.len, dentry->d_name.name,
+                                      (unsigned long long)parent_blkno, dl);
 
        /*
         * Negative dentry. We ignore these for now.
@@ -292,7 +289,9 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry,
                                (unsigned long long)parent_blkno,
                                (unsigned long long)dl->dl_parent_blkno);
 
-               mlog(0, "Found: %s\n", dl->dl_lockres.l_name);
+               trace_ocfs2_dentry_attach_lock_found(dl->dl_lockres.l_name,
+                               (unsigned long long)parent_blkno,
+                               (unsigned long long)OCFS2_I(inode)->ip_blkno);
 
                goto out_attach;
        }
index f97b6f1c61dd47392d0052acb64d218b1d9cdd76..9fe5b8fd658f0a3db09f1919512a0479a241ecca 100644 (file)
@@ -43,7 +43,6 @@
 #include <linux/quotaops.h>
 #include <linux/sort.h>
 
-#define MLOG_MASK_PREFIX ML_NAMEI
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -61,6 +60,7 @@
 #include "super.h"
 #include "sysfile.h"
 #include "uptodate.h"
+#include "ocfs2_trace.h"
 
 #include "buffer_head_io.h"
 
@@ -322,21 +322,23 @@ static int ocfs2_check_dir_entry(struct inode * dir,
        const char *error_msg = NULL;
        const int rlen = le16_to_cpu(de->rec_len);
 
-       if (rlen < OCFS2_DIR_REC_LEN(1))
+       if (unlikely(rlen < OCFS2_DIR_REC_LEN(1)))
                error_msg = "rec_len is smaller than minimal";
-       else if (rlen % 4 != 0)
+       else if (unlikely(rlen % 4 != 0))
                error_msg = "rec_len % 4 != 0";
-       else if (rlen < OCFS2_DIR_REC_LEN(de->name_len))
+       else if (unlikely(rlen < OCFS2_DIR_REC_LEN(de->name_len)))
                error_msg = "rec_len is too small for name_len";
-       else if (((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize)
+       else if (unlikely(
+                ((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize))
                error_msg = "directory entry across blocks";
 
-       if (error_msg != NULL)
+       if (unlikely(error_msg != NULL))
                mlog(ML_ERROR, "bad entry in directory #%llu: %s - "
                     "offset=%lu, inode=%llu, rec_len=%d, name_len=%d\n",
                     (unsigned long long)OCFS2_I(dir)->ip_blkno, error_msg,
                     offset, (unsigned long long)le64_to_cpu(de->inode), rlen,
                     de->name_len);
+
        return error_msg == NULL ? 1 : 0;
 }
 
@@ -367,8 +369,6 @@ static inline int ocfs2_search_dirblock(struct buffer_head *bh,
        int de_len;
        int ret = 0;
 
-       mlog_entry_void();
-
        de_buf = first_de;
        dlimit = de_buf + bytes;
 
@@ -402,7 +402,7 @@ static inline int ocfs2_search_dirblock(struct buffer_head *bh,
        }
 
 bail:
-       mlog_exit(ret);
+       trace_ocfs2_search_dirblock(ret);
        return ret;
 }
 
@@ -447,8 +447,7 @@ static int ocfs2_validate_dir_block(struct super_block *sb,
         * We don't validate dirents here, that's handled
         * in-place when the code walks them.
         */
-       mlog(0, "Validating dirblock %llu\n",
-            (unsigned long long)bh->b_blocknr);
+       trace_ocfs2_validate_dir_block((unsigned long long)bh->b_blocknr);
 
        BUG_ON(!buffer_uptodate(bh));
 
@@ -706,8 +705,6 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
        int num = 0;
        int nblocks, i, err;
 
-       mlog_entry_void();
-
        sb = dir->i_sb;
 
        nblocks = i_size_read(dir) >> sb->s_blocksize_bits;
@@ -788,7 +785,7 @@ cleanup_and_exit:
        for (; ra_ptr < ra_max; ra_ptr++)
                brelse(bh_use[ra_ptr]);
 
-       mlog_exit_ptr(ret);
+       trace_ocfs2_find_entry_el(ret);
        return ret;
 }
 
@@ -950,11 +947,9 @@ static int ocfs2_dx_dir_search(const char *name, int namelen,
                goto out;
        }
 
-       mlog(0, "Dir %llu: name: \"%.*s\", lookup of hash: %u.0x%x "
-            "returns: %llu\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno,
-            namelen, name, hinfo->major_hash, hinfo->minor_hash,
-            (unsigned long long)phys);
+       trace_ocfs2_dx_dir_search((unsigned long long)OCFS2_I(dir)->ip_blkno,
+                                 namelen, name, hinfo->major_hash,
+                                 hinfo->minor_hash, (unsigned long long)phys);
 
        ret = ocfs2_read_dx_leaf(dir, phys, &dx_leaf_bh);
        if (ret) {
@@ -964,9 +959,9 @@ static int ocfs2_dx_dir_search(const char *name, int namelen,
 
        dx_leaf = (struct ocfs2_dx_leaf *) dx_leaf_bh->b_data;
 
-       mlog(0, "leaf info: num_used: %d, count: %d\n",
-            le16_to_cpu(dx_leaf->dl_list.de_num_used),
-            le16_to_cpu(dx_leaf->dl_list.de_count));
+       trace_ocfs2_dx_dir_search_leaf_info(
+                       le16_to_cpu(dx_leaf->dl_list.de_num_used),
+                       le16_to_cpu(dx_leaf->dl_list.de_count));
 
        entry_list = &dx_leaf->dl_list;
 
@@ -1166,8 +1161,6 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
        int i, status = -ENOENT;
        ocfs2_journal_access_func access = ocfs2_journal_access_db;
 
-       mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", handle, dir, de_del, bh);
-
        if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
                access = ocfs2_journal_access_di;
 
@@ -1202,7 +1195,6 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
                de = (struct ocfs2_dir_entry *)((char *)de + le16_to_cpu(de->rec_len));
        }
 bail:
-       mlog_exit(status);
        return status;
 }
 
@@ -1348,8 +1340,8 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir,
                }
        }
 
-       mlog(0, "Dir %llu: delete entry at index: %d\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno, index);
+       trace_ocfs2_delete_entry_dx((unsigned long long)OCFS2_I(dir)->ip_blkno,
+                                   index);
 
        ret = __ocfs2_delete_entry(handle, dir, lookup->dl_entry,
                                   leaf_bh, leaf_bh->b_data, leaf_bh->b_size);
@@ -1632,8 +1624,6 @@ int __ocfs2_add_entry(handle_t *handle,
        struct buffer_head *insert_bh = lookup->dl_leaf_bh;
        char *data_start = insert_bh->b_data;
 
-       mlog_entry_void();
-
        if (!namelen)
                return -EINVAL;
 
@@ -1765,8 +1755,9 @@ int __ocfs2_add_entry(handle_t *handle,
         * from ever getting here. */
        retval = -ENOSPC;
 bail:
+       if (retval)
+               mlog_errno(retval);
 
-       mlog_exit(retval);
        return retval;
 }
 
@@ -2028,8 +2019,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
        struct inode *inode = filp->f_path.dentry->d_inode;
        int lock_level = 0;
 
-       mlog_entry("dirino=%llu\n",
-                  (unsigned long long)OCFS2_I(inode)->ip_blkno);
+       trace_ocfs2_readdir((unsigned long long)OCFS2_I(inode)->ip_blkno);
 
        error = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level);
        if (lock_level && error >= 0) {
@@ -2051,9 +2041,10 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
                                      dirent, filldir, NULL);
 
        ocfs2_inode_unlock(inode, lock_level);
+       if (error)
+               mlog_errno(error);
 
 bail_nolock:
-       mlog_exit(error);
 
        return error;
 }
@@ -2069,8 +2060,8 @@ int ocfs2_find_files_on_disk(const char *name,
 {
        int status = -ENOENT;
 
-       mlog(0, "name=%.*s, blkno=%p, inode=%llu\n", namelen, name, blkno,
-            (unsigned long long)OCFS2_I(inode)->ip_blkno);
+       trace_ocfs2_find_files_on_disk(namelen, name, blkno,
+                               (unsigned long long)OCFS2_I(inode)->ip_blkno);
 
        status = ocfs2_find_entry(name, namelen, inode, lookup);
        if (status)
@@ -2114,8 +2105,8 @@ int ocfs2_check_dir_for_entry(struct inode *dir,
        int ret;
        struct ocfs2_dir_lookup_result lookup = { NULL, };
 
-       mlog_entry("dir %llu, name '%.*s'\n",
-                  (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name);
+       trace_ocfs2_check_dir_for_entry(
+               (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name);
 
        ret = -EEXIST;
        if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0)
@@ -2125,7 +2116,8 @@ int ocfs2_check_dir_for_entry(struct inode *dir,
 bail:
        ocfs2_free_dir_lookup_result(&lookup);
 
-       mlog_exit(ret);
+       if (ret)
+               mlog_errno(ret);
        return ret;
 }
 
@@ -2324,8 +2316,6 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
        struct buffer_head *new_bh = NULL;
        struct ocfs2_dir_entry *de;
 
-       mlog_entry_void();
-
        if (ocfs2_new_dir_wants_trailer(inode))
                size = ocfs2_dir_trailer_blk_off(parent->i_sb);
 
@@ -2380,7 +2370,6 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
 bail:
        brelse(new_bh);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -2409,9 +2398,9 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
                goto out;
        }
 
-       mlog(0, "Dir %llu, attach new index block: %llu\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno,
-            (unsigned long long)dr_blkno);
+       trace_ocfs2_dx_dir_attach_index(
+                               (unsigned long long)OCFS2_I(dir)->ip_blkno,
+                               (unsigned long long)dr_blkno);
 
        dx_root_bh = sb_getblk(osb->sb, dr_blkno);
        if (dx_root_bh == NULL) {
@@ -2511,11 +2500,10 @@ static int ocfs2_dx_dir_format_cluster(struct ocfs2_super *osb,
                dx_leaf->dl_list.de_count =
                        cpu_to_le16(ocfs2_dx_entries_per_leaf(osb->sb));
 
-               mlog(0,
-                    "Dir %llu, format dx_leaf: %llu, entry count: %u\n",
-                    (unsigned long long)OCFS2_I(dir)->ip_blkno,
-                    (unsigned long long)bh->b_blocknr,
-                    le16_to_cpu(dx_leaf->dl_list.de_count));
+               trace_ocfs2_dx_dir_format_cluster(
+                               (unsigned long long)OCFS2_I(dir)->ip_blkno,
+                               (unsigned long long)bh->b_blocknr,
+                               le16_to_cpu(dx_leaf->dl_list.de_count));
 
                ocfs2_journal_dirty(handle, bh);
        }
@@ -2759,12 +2747,11 @@ static void ocfs2_dx_dir_index_root_block(struct inode *dir,
 
                ocfs2_dx_dir_name_hash(dir, de->name, de->name_len, &hinfo);
 
-               mlog(0,
-                    "dir: %llu, major: 0x%x minor: 0x%x, index: %u, name: %.*s\n",
-                    (unsigned long long)dir->i_ino, hinfo.major_hash,
-                    hinfo.minor_hash,
-                    le16_to_cpu(dx_root->dr_entries.de_num_used),
-                    de->name_len, de->name);
+               trace_ocfs2_dx_dir_index_root_block(
+                               (unsigned long long)dir->i_ino,
+                               hinfo.major_hash, hinfo.minor_hash,
+                               de->name_len, de->name,
+                               le16_to_cpu(dx_root->dr_entries.de_num_used));
 
                ocfs2_dx_entry_list_insert(&dx_root->dr_entries, &hinfo,
                                           dirent_blk);
@@ -3235,7 +3222,6 @@ static int ocfs2_do_extend_dir(struct super_block *sb,
 bail:
        if (did_quota && status < 0)
                dquot_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1));
-       mlog_exit(status);
        return status;
 }
 
@@ -3270,8 +3256,6 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
        struct ocfs2_extent_tree et;
        struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh;
 
-       mlog_entry_void();
-
        if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
                /*
                 * This would be a code error as an inline directory should
@@ -3320,8 +3304,8 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
        down_write(&OCFS2_I(dir)->ip_alloc_sem);
        drop_alloc_sem = 1;
        dir_i_size = i_size_read(dir);
-       mlog(0, "extending dir %llu (i_size = %lld)\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno, dir_i_size);
+       trace_ocfs2_extend_dir((unsigned long long)OCFS2_I(dir)->ip_blkno,
+                              dir_i_size);
 
        /* dir->i_size is always block aligned. */
        spin_lock(&OCFS2_I(dir)->ip_lock);
@@ -3436,7 +3420,6 @@ bail:
 
        brelse(new_bh);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -3583,8 +3566,9 @@ next:
        status = 0;
 bail:
        brelse(bh);
+       if (status)
+               mlog_errno(status);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -3815,9 +3799,9 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
        struct ocfs2_dx_root_block *dx_root;
        struct ocfs2_dx_leaf *tmp_dx_leaf = NULL;
 
-       mlog(0, "DX Dir: %llu, rebalance leaf leaf_blkno: %llu insert: %u\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno,
-            (unsigned long long)leaf_blkno, insert_hash);
+       trace_ocfs2_dx_dir_rebalance((unsigned long long)OCFS2_I(dir)->ip_blkno,
+                                    (unsigned long long)leaf_blkno,
+                                    insert_hash);
 
        ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh);
 
@@ -3897,8 +3881,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
                goto  out_commit;
        }
 
-       mlog(0, "Split leaf (%u) at %u, insert major hash is %u\n",
-            leaf_cpos, split_hash, insert_hash);
+       trace_ocfs2_dx_dir_rebalance_split(leaf_cpos, split_hash, insert_hash);
 
        /*
         * We have to carefully order operations here. There are items
@@ -4355,8 +4338,8 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb,
        unsigned int blocks_wanted = 1;
        struct buffer_head *bh = NULL;
 
-       mlog(0, "getting ready to insert namelen %d into dir %llu\n",
-            namelen, (unsigned long long)OCFS2_I(dir)->ip_blkno);
+       trace_ocfs2_prepare_dir_for_insert(
+               (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen);
 
        if (!namelen) {
                ret = -EINVAL;
index 9f30491e5e88a36ff3ec9a07f0869e7d9d88592d..29a886d1e82c84dd7338380b0ed65a0becd1e3bb 100644 (file)
@@ -128,8 +128,8 @@ static enum dlm_status __dlmconvert_master(struct dlm_ctxt *dlm,
 
        assert_spin_locked(&res->spinlock);
 
-       mlog_entry("type=%d, convert_type=%d, new convert_type=%d\n",
-                  lock->ml.type, lock->ml.convert_type, type);
+       mlog(0, "type=%d, convert_type=%d, new convert_type=%d\n",
+            lock->ml.type, lock->ml.convert_type, type);
 
        spin_lock(&lock->spinlock);
 
@@ -353,7 +353,7 @@ static enum dlm_status dlm_send_remote_convert_request(struct dlm_ctxt *dlm,
        struct kvec vec[2];
        size_t veclen = 1;
 
-       mlog_entry("%.*s\n", res->lockname.len, res->lockname.name);
+       mlog(0, "%.*s\n", res->lockname.len, res->lockname.name);
 
        memset(&convert, 0, sizeof(struct dlm_convert_lock));
        convert.node_idx = dlm->node_num;
index 7e38a072d720275ecd6b89a5f5113d9bde11c308..7540a492eaba0188d624a08f73688eee04838288 100644 (file)
@@ -188,7 +188,7 @@ struct dlm_lock_resource * __dlm_lookup_lockres_full(struct dlm_ctxt *dlm,
        struct hlist_head *bucket;
        struct hlist_node *list;
 
-       mlog_entry("%.*s\n", len, name);
+       mlog(0, "%.*s\n", len, name);
 
        assert_spin_locked(&dlm->spinlock);
 
@@ -222,7 +222,7 @@ struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
 {
        struct dlm_lock_resource *res = NULL;
 
-       mlog_entry("%.*s\n", len, name);
+       mlog(0, "%.*s\n", len, name);
 
        assert_spin_locked(&dlm->spinlock);
 
@@ -531,7 +531,7 @@ static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data,
        unsigned int node;
        struct dlm_exit_domain *exit_msg = (struct dlm_exit_domain *) msg->buf;
 
-       mlog_entry("%p %u %p", msg, len, data);
+       mlog(0, "%p %u %p", msg, len, data);
 
        if (!dlm_grab(dlm))
                return 0;
@@ -926,9 +926,10 @@ static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data,
 }
 
 static int dlm_match_regions(struct dlm_ctxt *dlm,
-                            struct dlm_query_region *qr)
+                            struct dlm_query_region *qr,
+                            char *local, int locallen)
 {
-       char *local = NULL, *remote = qr->qr_regions;
+       char *remote = qr->qr_regions;
        char *l, *r;
        int localnr, i, j, foundit;
        int status = 0;
@@ -957,13 +958,8 @@ static int dlm_match_regions(struct dlm_ctxt *dlm,
                r += O2HB_MAX_REGION_NAME_LEN;
        }
 
-       local = kmalloc(sizeof(qr->qr_regions), GFP_ATOMIC);
-       if (!local) {
-               status = -ENOMEM;
-               goto bail;
-       }
-
-       localnr = o2hb_get_all_regions(local, O2NM_MAX_REGIONS);
+       localnr = min(O2NM_MAX_REGIONS, locallen/O2HB_MAX_REGION_NAME_LEN);
+       localnr = o2hb_get_all_regions(local, (u8)localnr);
 
        /* compare local regions with remote */
        l = local;
@@ -1012,8 +1008,6 @@ static int dlm_match_regions(struct dlm_ctxt *dlm,
        }
 
 bail:
-       kfree(local);
-
        return status;
 }
 
@@ -1075,6 +1069,7 @@ static int dlm_query_region_handler(struct o2net_msg *msg, u32 len,
 {
        struct dlm_query_region *qr;
        struct dlm_ctxt *dlm = NULL;
+       char *local = NULL;
        int status = 0;
        int locked = 0;
 
@@ -1083,6 +1078,13 @@ static int dlm_query_region_handler(struct o2net_msg *msg, u32 len,
        mlog(0, "Node %u queries hb regions on domain %s\n", qr->qr_node,
             qr->qr_domain);
 
+       /* buffer used in dlm_mast_regions() */
+       local = kmalloc(sizeof(qr->qr_regions), GFP_KERNEL);
+       if (!local) {
+               status = -ENOMEM;
+               goto bail;
+       }
+
        status = -EINVAL;
 
        spin_lock(&dlm_domain_lock);
@@ -1112,13 +1114,15 @@ static int dlm_query_region_handler(struct o2net_msg *msg, u32 len,
                goto bail;
        }
 
-       status = dlm_match_regions(dlm, qr);
+       status = dlm_match_regions(dlm, qr, local, sizeof(qr->qr_regions));
 
 bail:
        if (locked)
                spin_unlock(&dlm->spinlock);
        spin_unlock(&dlm_domain_lock);
 
+       kfree(local);
+
        return status;
 }
 
@@ -1553,7 +1557,7 @@ static int dlm_try_to_join_domain(struct dlm_ctxt *dlm)
        struct domain_join_ctxt *ctxt;
        enum dlm_query_join_response_code response = JOIN_DISALLOW;
 
-       mlog_entry("%p", dlm);
+       mlog(0, "%p", dlm);
 
        ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
        if (!ctxt) {
index 7009292aac5ad4dd2ddd6f0511af0820e64c4b22..8d39e0fd66f7379b8fb08ac40502efa0d4a51cc6 100644 (file)
@@ -128,7 +128,7 @@ static enum dlm_status dlmlock_master(struct dlm_ctxt *dlm,
        int call_ast = 0, kick_thread = 0;
        enum dlm_status status = DLM_NORMAL;
 
-       mlog_entry("type=%d\n", lock->ml.type);
+       mlog(0, "type=%d\n", lock->ml.type);
 
        spin_lock(&res->spinlock);
        /* if called from dlm_create_lock_handler, need to
@@ -227,8 +227,8 @@ static enum dlm_status dlmlock_remote(struct dlm_ctxt *dlm,
        enum dlm_status status = DLM_DENIED;
        int lockres_changed = 1;
 
-       mlog_entry("type=%d\n", lock->ml.type);
-       mlog(0, "lockres %.*s, flags = 0x%x\n", res->lockname.len,
+       mlog(0, "type=%d, lockres %.*s, flags = 0x%x\n",
+            lock->ml.type, res->lockname.len,
             res->lockname.name, flags);
 
        spin_lock(&res->spinlock);
@@ -308,8 +308,6 @@ static enum dlm_status dlm_send_remote_lock_request(struct dlm_ctxt *dlm,
        int tmpret, status = 0;
        enum dlm_status ret;
 
-       mlog_entry_void();
-
        memset(&create, 0, sizeof(create));
        create.node_idx = dlm->node_num;
        create.requested_type = lock->ml.type;
@@ -477,8 +475,6 @@ int dlm_create_lock_handler(struct o2net_msg *msg, u32 len, void *data,
 
        BUG_ON(!dlm);
 
-       mlog_entry_void();
-
        if (!dlm_grab(dlm))
                return DLM_REJECTED;
 
index 59f0f6bdfc62110141ca7ad413dc51abadd4b3c8..9d67610dfc74fc77854e668fef72baa72034d684 100644 (file)
@@ -426,8 +426,6 @@ static void dlm_mle_release(struct kref *kref)
        struct dlm_master_list_entry *mle;
        struct dlm_ctxt *dlm;
 
-       mlog_entry_void();
-
        mle = container_of(kref, struct dlm_master_list_entry, mle_refs);
        dlm = mle->dlm;
 
@@ -3120,8 +3118,6 @@ static int dlm_add_migration_mle(struct dlm_ctxt *dlm,
 
        *oldmle = NULL;
 
-       mlog_entry_void();
-
        assert_spin_locked(&dlm->spinlock);
        assert_spin_locked(&dlm->master_lock);
 
@@ -3261,7 +3257,7 @@ void dlm_clean_master_list(struct dlm_ctxt *dlm, u8 dead_node)
        struct hlist_node *list;
        unsigned int i;
 
-       mlog_entry("dlm=%s, dead node=%u\n", dlm->name, dead_node);
+       mlog(0, "dlm=%s, dead node=%u\n", dlm->name, dead_node);
 top:
        assert_spin_locked(&dlm->spinlock);
 
index aaaffbcbe9163f0ea7376301bc854d85a0bd5b66..f1beb6fc254d1720ae10b10a0a7ea904703c7d0d 100644 (file)
@@ -727,7 +727,6 @@ static int dlm_remaster_locks(struct dlm_ctxt *dlm, u8 dead_node)
        if (destroy)
                dlm_destroy_recovery_area(dlm, dead_node);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -1496,9 +1495,9 @@ leave:
                        kfree(buf);
                if (item)
                        kfree(item);
+               mlog_errno(ret);
        }
 
-       mlog_exit(ret);
        return ret;
 }
 
@@ -1567,7 +1566,6 @@ leave:
                dlm_lockres_put(res);
        }
        kfree(data);
-       mlog_exit(ret);
 }
 
 
@@ -1986,7 +1984,6 @@ leave:
                        dlm_lock_put(newlock);
        }
 
-       mlog_exit(ret);
        return ret;
 }
 
@@ -2083,8 +2080,6 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm,
        struct hlist_head *bucket;
        struct dlm_lock_resource *res, *next;
 
-       mlog_entry_void();
-
        assert_spin_locked(&dlm->spinlock);
 
        list_for_each_entry_safe(res, next, &dlm->reco.resources, recovering) {
@@ -2607,8 +2602,6 @@ static int dlm_send_begin_reco_message(struct dlm_ctxt *dlm, u8 dead_node)
        int nodenum;
        int status;
 
-       mlog_entry("%u\n", dead_node);
-
        mlog(0, "%s: dead node is %u\n", dlm->name, dead_node);
 
        spin_lock(&dlm->spinlock);
index 817287c6a6db65fe412062ecfaba3c379312791d..850aa7e875377b76eaae054b675367aea157c13c 100644 (file)
@@ -317,7 +317,7 @@ static enum dlm_status dlm_send_remote_unlock_request(struct dlm_ctxt *dlm,
        struct kvec vec[2];
        size_t veclen = 1;
 
-       mlog_entry("%.*s\n", res->lockname.len, res->lockname.name);
+       mlog(0, "%.*s\n", res->lockname.len, res->lockname.name);
 
        if (owner == dlm->node_num) {
                /* ended up trying to contact ourself.  this means
@@ -588,8 +588,6 @@ enum dlm_status dlmunlock(struct dlm_ctxt *dlm, struct dlm_lockstatus *lksb,
        struct dlm_lock *lock = NULL;
        int call_ast, is_master;
 
-       mlog_entry_void();
-
        if (!lksb) {
                dlm_error(DLM_BADARGS);
                return DLM_BADARGS;
index e8d94d722ecb8b6dc7aad1ceaa749c99d51cf8a6..7642d7ca73e523f3bc29b7b8a5d767e8f7c7cb83 100644 (file)
@@ -64,7 +64,7 @@ struct ocfs2_mask_waiter {
        unsigned long           mw_mask;
        unsigned long           mw_goal;
 #ifdef CONFIG_OCFS2_FS_STATS
-       unsigned long long      mw_lock_start;
+       ktime_t                 mw_lock_start;
 #endif
 };
 
@@ -397,8 +397,6 @@ static void ocfs2_build_lock_name(enum ocfs2_lock_type type,
 {
        int len;
 
-       mlog_entry_void();
-
        BUG_ON(type >= OCFS2_NUM_LOCK_TYPES);
 
        len = snprintf(name, OCFS2_LOCK_ID_MAX_LEN, "%c%s%016llx%08x",
@@ -408,8 +406,6 @@ static void ocfs2_build_lock_name(enum ocfs2_lock_type type,
        BUG_ON(len != (OCFS2_LOCK_ID_MAX_LEN - 1));
 
        mlog(0, "built lock resource with name: %s\n", name);
-
-       mlog_exit_void();
 }
 
 static DEFINE_SPINLOCK(ocfs2_dlm_tracking_lock);
@@ -435,44 +431,41 @@ static void ocfs2_remove_lockres_tracking(struct ocfs2_lock_res *res)
 #ifdef CONFIG_OCFS2_FS_STATS
 static void ocfs2_init_lock_stats(struct ocfs2_lock_res *res)
 {
-       res->l_lock_num_prmode = 0;
-       res->l_lock_num_prmode_failed = 0;
-       res->l_lock_total_prmode = 0;
-       res->l_lock_max_prmode = 0;
-       res->l_lock_num_exmode = 0;
-       res->l_lock_num_exmode_failed = 0;
-       res->l_lock_total_exmode = 0;
-       res->l_lock_max_exmode = 0;
        res->l_lock_refresh = 0;
+       memset(&res->l_lock_prmode, 0, sizeof(struct ocfs2_lock_stats));
+       memset(&res->l_lock_exmode, 0, sizeof(struct ocfs2_lock_stats));
 }
 
 static void ocfs2_update_lock_stats(struct ocfs2_lock_res *res, int level,
                                    struct ocfs2_mask_waiter *mw, int ret)
 {
-       unsigned long long *num, *sum;
-       unsigned int *max, *failed;
-       struct timespec ts = current_kernel_time();
-       unsigned long long time = timespec_to_ns(&ts) - mw->mw_lock_start;
-
-       if (level == LKM_PRMODE) {
-               num = &res->l_lock_num_prmode;
-               sum = &res->l_lock_total_prmode;
-               max = &res->l_lock_max_prmode;
-               failed = &res->l_lock_num_prmode_failed;
-       } else if (level == LKM_EXMODE) {
-               num = &res->l_lock_num_exmode;
-               sum = &res->l_lock_total_exmode;
-               max = &res->l_lock_max_exmode;
-               failed = &res->l_lock_num_exmode_failed;
-       } else
+       u32 usec;
+       ktime_t kt;
+       struct ocfs2_lock_stats *stats;
+
+       if (level == LKM_PRMODE)
+               stats = &res->l_lock_prmode;
+       else if (level == LKM_EXMODE)
+               stats = &res->l_lock_exmode;
+       else
                return;
 
-       (*num)++;
-       (*sum) += time;
-       if (time > *max)
-               *max = time;
+       kt = ktime_sub(ktime_get(), mw->mw_lock_start);
+       usec = ktime_to_us(kt);
+
+       stats->ls_gets++;
+       stats->ls_total += ktime_to_ns(kt);
+       /* overflow */
+       if (unlikely(stats->ls_gets) == 0) {
+               stats->ls_gets++;
+               stats->ls_total = ktime_to_ns(kt);
+       }
+
+       if (stats->ls_max < usec)
+               stats->ls_max = usec;
+
        if (ret)
-               (*failed)++;
+               stats->ls_fail++;
 }
 
 static inline void ocfs2_track_lock_refresh(struct ocfs2_lock_res *lockres)
@@ -482,8 +475,7 @@ static inline void ocfs2_track_lock_refresh(struct ocfs2_lock_res *lockres)
 
 static inline void ocfs2_init_start_time(struct ocfs2_mask_waiter *mw)
 {
-       struct timespec ts = current_kernel_time();
-       mw->mw_lock_start = timespec_to_ns(&ts);
+       mw->mw_lock_start = ktime_get();
 }
 #else
 static inline void ocfs2_init_lock_stats(struct ocfs2_lock_res *res)
@@ -729,8 +721,6 @@ void ocfs2_refcount_lock_res_init(struct ocfs2_lock_res *lockres,
 
 void ocfs2_lock_res_free(struct ocfs2_lock_res *res)
 {
-       mlog_entry_void();
-
        if (!(res->l_flags & OCFS2_LOCK_INITIALIZED))
                return;
 
@@ -756,14 +746,11 @@ void ocfs2_lock_res_free(struct ocfs2_lock_res *res)
        memset(&res->l_lksb, 0, sizeof(res->l_lksb));
 
        res->l_flags = 0UL;
-       mlog_exit_void();
 }
 
 static inline void ocfs2_inc_holders(struct ocfs2_lock_res *lockres,
                                     int level)
 {
-       mlog_entry_void();
-
        BUG_ON(!lockres);
 
        switch(level) {
@@ -776,15 +763,11 @@ static inline void ocfs2_inc_holders(struct ocfs2_lock_res *lockres,
        default:
                BUG();
        }
-
-       mlog_exit_void();
 }
 
 static inline void ocfs2_dec_holders(struct ocfs2_lock_res *lockres,
                                     int level)
 {
-       mlog_entry_void();
-
        BUG_ON(!lockres);
 
        switch(level) {
@@ -799,7 +782,6 @@ static inline void ocfs2_dec_holders(struct ocfs2_lock_res *lockres,
        default:
                BUG();
        }
-       mlog_exit_void();
 }
 
 /* WARNING: This function lives in a world where the only three lock
@@ -846,8 +828,6 @@ static void lockres_clear_flags(struct ocfs2_lock_res *lockres,
 
 static inline void ocfs2_generic_handle_downconvert_action(struct ocfs2_lock_res *lockres)
 {
-       mlog_entry_void();
-
        BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY));
        BUG_ON(!(lockres->l_flags & OCFS2_LOCK_ATTACHED));
        BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED));
@@ -860,14 +840,10 @@ static inline void ocfs2_generic_handle_downconvert_action(struct ocfs2_lock_res
                lockres_clear_flags(lockres, OCFS2_LOCK_BLOCKED);
        }
        lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
-
-       mlog_exit_void();
 }
 
 static inline void ocfs2_generic_handle_convert_action(struct ocfs2_lock_res *lockres)
 {
-       mlog_entry_void();
-
        BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY));
        BUG_ON(!(lockres->l_flags & OCFS2_LOCK_ATTACHED));
 
@@ -889,14 +865,10 @@ static inline void ocfs2_generic_handle_convert_action(struct ocfs2_lock_res *lo
        lockres_or_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING);
 
        lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
-
-       mlog_exit_void();
 }
 
 static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *lockres)
 {
-       mlog_entry_void();
-
        BUG_ON((!(lockres->l_flags & OCFS2_LOCK_BUSY)));
        BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED);
 
@@ -908,15 +880,12 @@ static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *loc
        lockres->l_level = lockres->l_requested;
        lockres_or_flags(lockres, OCFS2_LOCK_ATTACHED);
        lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
-
-       mlog_exit_void();
 }
 
 static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres,
                                     int level)
 {
        int needs_downconvert = 0;
-       mlog_entry_void();
 
        assert_spin_locked(&lockres->l_lock);
 
@@ -938,8 +907,7 @@ static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres,
 
        if (needs_downconvert)
                lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED);
-
-       mlog_exit(needs_downconvert);
+       mlog(0, "needs_downconvert = %d\n", needs_downconvert);
        return needs_downconvert;
 }
 
@@ -1151,8 +1119,6 @@ static void ocfs2_unlock_ast(struct ocfs2_dlm_lksb *lksb, int error)
        struct ocfs2_lock_res *lockres = ocfs2_lksb_to_lock_res(lksb);
        unsigned long flags;
 
-       mlog_entry_void();
-
        mlog(ML_BASTS, "UNLOCK AST fired for lockres %s, action = %d\n",
             lockres->l_name, lockres->l_unlock_action);
 
@@ -1162,7 +1128,6 @@ static void ocfs2_unlock_ast(struct ocfs2_dlm_lksb *lksb, int error)
                     "unlock_action %d\n", error, lockres->l_name,
                     lockres->l_unlock_action);
                spin_unlock_irqrestore(&lockres->l_lock, flags);
-               mlog_exit_void();
                return;
        }
 
@@ -1186,8 +1151,6 @@ static void ocfs2_unlock_ast(struct ocfs2_dlm_lksb *lksb, int error)
        lockres->l_unlock_action = OCFS2_UNLOCK_INVALID;
        wake_up(&lockres->l_event);
        spin_unlock_irqrestore(&lockres->l_lock, flags);
-
-       mlog_exit_void();
 }
 
 /*
@@ -1233,7 +1196,6 @@ static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres,
 {
        unsigned long flags;
 
-       mlog_entry_void();
        spin_lock_irqsave(&lockres->l_lock, flags);
        lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
        lockres_clear_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING);
@@ -1244,7 +1206,6 @@ static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres,
        spin_unlock_irqrestore(&lockres->l_lock, flags);
 
        wake_up(&lockres->l_event);
-       mlog_exit_void();
 }
 
 /* Note: If we detect another process working on the lock (i.e.,
@@ -1260,8 +1221,6 @@ static int ocfs2_lock_create(struct ocfs2_super *osb,
        unsigned long flags;
        unsigned int gen;
 
-       mlog_entry_void();
-
        mlog(0, "lock %s, level = %d, flags = %u\n", lockres->l_name, level,
             dlm_flags);
 
@@ -1293,7 +1252,6 @@ static int ocfs2_lock_create(struct ocfs2_super *osb,
        mlog(0, "lock %s, return from ocfs2_dlm_lock\n", lockres->l_name);
 
 bail:
-       mlog_exit(ret);
        return ret;
 }
 
@@ -1416,8 +1374,6 @@ static int __ocfs2_cluster_lock(struct ocfs2_super *osb,
        unsigned int gen;
        int noqueue_attempted = 0;
 
-       mlog_entry_void();
-
        ocfs2_init_mask_waiter(&mw);
 
        if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB)
@@ -1583,7 +1539,6 @@ out:
                                caller_ip);
        }
 #endif
-       mlog_exit(ret);
        return ret;
 }
 
@@ -1605,7 +1560,6 @@ static void __ocfs2_cluster_unlock(struct ocfs2_super *osb,
 {
        unsigned long flags;
 
-       mlog_entry_void();
        spin_lock_irqsave(&lockres->l_lock, flags);
        ocfs2_dec_holders(lockres, level);
        ocfs2_downconvert_on_unlock(osb, lockres);
@@ -1614,7 +1568,6 @@ static void __ocfs2_cluster_unlock(struct ocfs2_super *osb,
        if (lockres->l_lockdep_map.key != NULL)
                rwsem_release(&lockres->l_lockdep_map, 1, caller_ip);
 #endif
-       mlog_exit_void();
 }
 
 static int ocfs2_create_new_lock(struct ocfs2_super *osb,
@@ -1648,8 +1601,6 @@ int ocfs2_create_new_inode_locks(struct inode *inode)
        BUG_ON(!inode);
        BUG_ON(!ocfs2_inode_is_new(inode));
 
-       mlog_entry_void();
-
        mlog(0, "Inode %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno);
 
        /* NOTE: That we don't increment any of the holder counts, nor
@@ -1683,7 +1634,6 @@ int ocfs2_create_new_inode_locks(struct inode *inode)
        }
 
 bail:
-       mlog_exit(ret);
        return ret;
 }
 
@@ -1695,16 +1645,12 @@ int ocfs2_rw_lock(struct inode *inode, int write)
 
        BUG_ON(!inode);
 
-       mlog_entry_void();
-
        mlog(0, "inode %llu take %s RW lock\n",
             (unsigned long long)OCFS2_I(inode)->ip_blkno,
             write ? "EXMODE" : "PRMODE");
 
-       if (ocfs2_mount_local(osb)) {
-               mlog_exit(0);
+       if (ocfs2_mount_local(osb))
                return 0;
-       }
 
        lockres = &OCFS2_I(inode)->ip_rw_lockres;
 
@@ -1715,7 +1661,6 @@ int ocfs2_rw_lock(struct inode *inode, int write)
        if (status < 0)
                mlog_errno(status);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -1725,16 +1670,12 @@ void ocfs2_rw_unlock(struct inode *inode, int write)
        struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 
-       mlog_entry_void();
-
        mlog(0, "inode %llu drop %s RW lock\n",
             (unsigned long long)OCFS2_I(inode)->ip_blkno,
             write ? "EXMODE" : "PRMODE");
 
        if (!ocfs2_mount_local(osb))
                ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
-
-       mlog_exit_void();
 }
 
 /*
@@ -1748,8 +1689,6 @@ int ocfs2_open_lock(struct inode *inode)
 
        BUG_ON(!inode);
 
-       mlog_entry_void();
-
        mlog(0, "inode %llu take PRMODE open lock\n",
             (unsigned long long)OCFS2_I(inode)->ip_blkno);
 
@@ -1764,7 +1703,6 @@ int ocfs2_open_lock(struct inode *inode)
                mlog_errno(status);
 
 out:
-       mlog_exit(status);
        return status;
 }
 
@@ -1776,8 +1714,6 @@ int ocfs2_try_open_lock(struct inode *inode, int write)
 
        BUG_ON(!inode);
 
-       mlog_entry_void();
-
        mlog(0, "inode %llu try to take %s open lock\n",
             (unsigned long long)OCFS2_I(inode)->ip_blkno,
             write ? "EXMODE" : "PRMODE");
@@ -1799,7 +1735,6 @@ int ocfs2_try_open_lock(struct inode *inode, int write)
                                    level, DLM_LKF_NOQUEUE, 0);
 
 out:
-       mlog_exit(status);
        return status;
 }
 
@@ -1811,8 +1746,6 @@ void ocfs2_open_unlock(struct inode *inode)
        struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_open_lockres;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 
-       mlog_entry_void();
-
        mlog(0, "inode %llu drop open lock\n",
             (unsigned long long)OCFS2_I(inode)->ip_blkno);
 
@@ -1827,7 +1760,7 @@ void ocfs2_open_unlock(struct inode *inode)
                                     DLM_LOCK_EX);
 
 out:
-       mlog_exit_void();
+       return;
 }
 
 static int ocfs2_flock_handle_signal(struct ocfs2_lock_res *lockres,
@@ -2043,8 +1976,6 @@ static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb,
 {
        int kick = 0;
 
-       mlog_entry_void();
-
        /* If we know that another node is waiting on our lock, kick
         * the downconvert thread * pre-emptively when we reach a release
         * condition. */
@@ -2065,8 +1996,6 @@ static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb,
 
        if (kick)
                ocfs2_wake_downconvert_thread(osb);
-
-       mlog_exit_void();
 }
 
 #define OCFS2_SEC_BITS   34
@@ -2095,8 +2024,6 @@ static void __ocfs2_stuff_meta_lvb(struct inode *inode)
        struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres;
        struct ocfs2_meta_lvb *lvb;
 
-       mlog_entry_void();
-
        lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
 
        /*
@@ -2128,8 +2055,6 @@ static void __ocfs2_stuff_meta_lvb(struct inode *inode)
 
 out:
        mlog_meta_lvb(0, lockres);
-
-       mlog_exit_void();
 }
 
 static void ocfs2_unpack_timespec(struct timespec *spec,
@@ -2145,8 +2070,6 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
        struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres;
        struct ocfs2_meta_lvb *lvb;
 
-       mlog_entry_void();
-
        mlog_meta_lvb(0, lockres);
 
        lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
@@ -2177,8 +2100,6 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
        ocfs2_unpack_timespec(&inode->i_ctime,
                              be64_to_cpu(lvb->lvb_ictime_packed));
        spin_unlock(&oi->ip_lock);
-
-       mlog_exit_void();
 }
 
 static inline int ocfs2_meta_lvb_is_trustable(struct inode *inode,
@@ -2205,8 +2126,6 @@ static int ocfs2_should_refresh_lock_res(struct ocfs2_lock_res *lockres)
        unsigned long flags;
        int status = 0;
 
-       mlog_entry_void();
-
 refresh_check:
        spin_lock_irqsave(&lockres->l_lock, flags);
        if (!(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH)) {
@@ -2227,7 +2146,7 @@ refresh_check:
 
        status = 1;
 bail:
-       mlog_exit(status);
+       mlog(0, "status %d\n", status);
        return status;
 }
 
@@ -2237,7 +2156,6 @@ static inline void ocfs2_complete_lock_res_refresh(struct ocfs2_lock_res *lockre
                                                   int status)
 {
        unsigned long flags;
-       mlog_entry_void();
 
        spin_lock_irqsave(&lockres->l_lock, flags);
        lockres_clear_flags(lockres, OCFS2_LOCK_REFRESHING);
@@ -2246,8 +2164,6 @@ static inline void ocfs2_complete_lock_res_refresh(struct ocfs2_lock_res *lockre
        spin_unlock_irqrestore(&lockres->l_lock, flags);
 
        wake_up(&lockres->l_event);
-
-       mlog_exit_void();
 }
 
 /* may or may not return a bh if it went to disk. */
@@ -2260,8 +2176,6 @@ static int ocfs2_inode_lock_update(struct inode *inode,
        struct ocfs2_dinode *fe;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 
-       mlog_entry_void();
-
        if (ocfs2_mount_local(osb))
                goto bail;
 
@@ -2330,7 +2244,6 @@ static int ocfs2_inode_lock_update(struct inode *inode,
 bail_refresh:
        ocfs2_complete_lock_res_refresh(lockres, status);
 bail:
-       mlog_exit(status);
        return status;
 }
 
@@ -2374,8 +2287,6 @@ int ocfs2_inode_lock_full_nested(struct inode *inode,
 
        BUG_ON(!inode);
 
-       mlog_entry_void();
-
        mlog(0, "inode %llu, take %s META lock\n",
             (unsigned long long)OCFS2_I(inode)->ip_blkno,
             ex ? "EXMODE" : "PRMODE");
@@ -2467,7 +2378,6 @@ bail:
        if (local_bh)
                brelse(local_bh);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -2517,7 +2427,6 @@ int ocfs2_inode_lock_atime(struct inode *inode,
 {
        int ret;
 
-       mlog_entry_void();
        ret = ocfs2_inode_lock(inode, NULL, 0);
        if (ret < 0) {
                mlog_errno(ret);
@@ -2545,7 +2454,6 @@ int ocfs2_inode_lock_atime(struct inode *inode,
        } else
                *level = 0;
 
-       mlog_exit(ret);
        return ret;
 }
 
@@ -2556,8 +2464,6 @@ void ocfs2_inode_unlock(struct inode *inode,
        struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_inode_lockres;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 
-       mlog_entry_void();
-
        mlog(0, "inode %llu drop %s META lock\n",
             (unsigned long long)OCFS2_I(inode)->ip_blkno,
             ex ? "EXMODE" : "PRMODE");
@@ -2565,8 +2471,6 @@ void ocfs2_inode_unlock(struct inode *inode,
        if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) &&
            !ocfs2_mount_local(osb))
                ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
-
-       mlog_exit_void();
 }
 
 int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno)
@@ -2617,8 +2521,6 @@ int ocfs2_super_lock(struct ocfs2_super *osb,
        int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
        struct ocfs2_lock_res *lockres = &osb->osb_super_lockres;
 
-       mlog_entry_void();
-
        if (ocfs2_is_hard_readonly(osb))
                return -EROFS;
 
@@ -2650,7 +2552,6 @@ int ocfs2_super_lock(struct ocfs2_super *osb,
                ocfs2_track_lock_refresh(lockres);
        }
 bail:
-       mlog_exit(status);
        return status;
 }
 
@@ -2869,8 +2770,15 @@ static void *ocfs2_dlm_seq_next(struct seq_file *m, void *v, loff_t *pos)
        return iter;
 }
 
-/* So that debugfs.ocfs2 can determine which format is being used */
-#define OCFS2_DLM_DEBUG_STR_VERSION 2
+/*
+ * Version is used by debugfs.ocfs2 to determine the format being used
+ *
+ * New in version 2
+ *     - Lock stats printed
+ * New in version 3
+ *     - Max time in lock stats is in usecs (instead of nsecs)
+ */
+#define OCFS2_DLM_DEBUG_STR_VERSION 3
 static int ocfs2_dlm_seq_show(struct seq_file *m, void *v)
 {
        int i;
@@ -2912,18 +2820,18 @@ static int ocfs2_dlm_seq_show(struct seq_file *m, void *v)
                seq_printf(m, "0x%x\t", lvb[i]);
 
 #ifdef CONFIG_OCFS2_FS_STATS
-# define lock_num_prmode(_l)           (_l)->l_lock_num_prmode
-# define lock_num_exmode(_l)           (_l)->l_lock_num_exmode
-# define lock_num_prmode_failed(_l)    (_l)->l_lock_num_prmode_failed
-# define lock_num_exmode_failed(_l)    (_l)->l_lock_num_exmode_failed
-# define lock_total_prmode(_l)         (_l)->l_lock_total_prmode
-# define lock_total_exmode(_l)         (_l)->l_lock_total_exmode
-# define lock_max_prmode(_l)           (_l)->l_lock_max_prmode
-# define lock_max_exmode(_l)           (_l)->l_lock_max_exmode
-# define lock_refresh(_l)              (_l)->l_lock_refresh
+# define lock_num_prmode(_l)           ((_l)->l_lock_prmode.ls_gets)
+# define lock_num_exmode(_l)           ((_l)->l_lock_exmode.ls_gets)
+# define lock_num_prmode_failed(_l)    ((_l)->l_lock_prmode.ls_fail)
+# define lock_num_exmode_failed(_l)    ((_l)->l_lock_exmode.ls_fail)
+# define lock_total_prmode(_l)         ((_l)->l_lock_prmode.ls_total)
+# define lock_total_exmode(_l)         ((_l)->l_lock_exmode.ls_total)
+# define lock_max_prmode(_l)           ((_l)->l_lock_prmode.ls_max)
+# define lock_max_exmode(_l)           ((_l)->l_lock_exmode.ls_max)
+# define lock_refresh(_l)              ((_l)->l_lock_refresh)
 #else
-# define lock_num_prmode(_l)           (0ULL)
-# define lock_num_exmode(_l)           (0ULL)
+# define lock_num_prmode(_l)           (0)
+# define lock_num_exmode(_l)           (0)
 # define lock_num_prmode_failed(_l)    (0)
 # define lock_num_exmode_failed(_l)    (0)
 # define lock_total_prmode(_l)         (0ULL)
@@ -2933,8 +2841,8 @@ static int ocfs2_dlm_seq_show(struct seq_file *m, void *v)
 # define lock_refresh(_l)              (0)
 #endif
        /* The following seq_print was added in version 2 of this output */
-       seq_printf(m, "%llu\t"
-                  "%llu\t"
+       seq_printf(m, "%u\t"
+                  "%u\t"
                   "%u\t"
                   "%u\t"
                   "%llu\t"
@@ -3054,8 +2962,6 @@ int ocfs2_dlm_init(struct ocfs2_super *osb)
        int status = 0;
        struct ocfs2_cluster_connection *conn = NULL;
 
-       mlog_entry_void();
-
        if (ocfs2_mount_local(osb)) {
                osb->node_num = 0;
                goto local;
@@ -3112,15 +3018,12 @@ bail:
                        kthread_stop(osb->dc_task);
        }
 
-       mlog_exit(status);
        return status;
 }
 
 void ocfs2_dlm_shutdown(struct ocfs2_super *osb,
                        int hangup_pending)
 {
-       mlog_entry_void();
-
        ocfs2_drop_osb_locks(osb);
 
        /*
@@ -3143,8 +3046,6 @@ void ocfs2_dlm_shutdown(struct ocfs2_super *osb,
        osb->cconn = NULL;
 
        ocfs2_dlm_shutdown_debug(osb);
-
-       mlog_exit_void();
 }
 
 static int ocfs2_drop_lock(struct ocfs2_super *osb,
@@ -3226,7 +3127,6 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb,
 
        ocfs2_wait_on_busy_lock(lockres);
 out:
-       mlog_exit(0);
        return 0;
 }
 
@@ -3284,8 +3184,6 @@ int ocfs2_drop_inode_locks(struct inode *inode)
 {
        int status, err;
 
-       mlog_entry_void();
-
        /* No need to call ocfs2_mark_lockres_freeing here -
         * ocfs2_clear_inode has done it for us. */
 
@@ -3310,7 +3208,6 @@ int ocfs2_drop_inode_locks(struct inode *inode)
        if (err < 0 && !status)
                status = err;
 
-       mlog_exit(status);
        return status;
 }
 
@@ -3352,8 +3249,6 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb,
        int ret;
        u32 dlm_flags = DLM_LKF_CONVERT;
 
-       mlog_entry_void();
-
        mlog(ML_BASTS, "lockres %s, level %d => %d\n", lockres->l_name,
             lockres->l_level, new_level);
 
@@ -3375,7 +3270,6 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb,
 
        ret = 0;
 bail:
-       mlog_exit(ret);
        return ret;
 }
 
@@ -3385,8 +3279,6 @@ static int ocfs2_prepare_cancel_convert(struct ocfs2_super *osb,
 {
        assert_spin_locked(&lockres->l_lock);
 
-       mlog_entry_void();
-
        if (lockres->l_unlock_action == OCFS2_UNLOCK_CANCEL_CONVERT) {
                /* If we're already trying to cancel a lock conversion
                 * then just drop the spinlock and allow the caller to
@@ -3416,8 +3308,6 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb,
 {
        int ret;
 
-       mlog_entry_void();
-
        ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb,
                               DLM_LKF_CANCEL);
        if (ret) {
@@ -3427,7 +3317,6 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb,
 
        mlog(ML_BASTS, "lockres %s\n", lockres->l_name);
 
-       mlog_exit(ret);
        return ret;
 }
 
@@ -3443,8 +3332,6 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb,
        int set_lvb = 0;
        unsigned int gen;
 
-       mlog_entry_void();
-
        spin_lock_irqsave(&lockres->l_lock, flags);
 
 recheck:
@@ -3619,14 +3506,14 @@ downconvert:
                                     gen);
 
 leave:
-       mlog_exit(ret);
+       if (ret)
+               mlog_errno(ret);
        return ret;
 
 leave_requeue:
        spin_unlock_irqrestore(&lockres->l_lock, flags);
        ctl->requeue = 1;
 
-       mlog_exit(0);
        return 0;
 }
 
@@ -3859,8 +3746,6 @@ static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres)
        struct mem_dqinfo *info = sb_dqinfo(oinfo->dqi_gi.dqi_sb,
                                            oinfo->dqi_gi.dqi_type);
 
-       mlog_entry_void();
-
        lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
        lvb->lvb_version = OCFS2_QINFO_LVB_VERSION;
        lvb->lvb_bgrace = cpu_to_be32(info->dqi_bgrace);
@@ -3869,8 +3754,6 @@ static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres)
        lvb->lvb_blocks = cpu_to_be32(oinfo->dqi_gi.dqi_blocks);
        lvb->lvb_free_blk = cpu_to_be32(oinfo->dqi_gi.dqi_free_blk);
        lvb->lvb_free_entry = cpu_to_be32(oinfo->dqi_gi.dqi_free_entry);
-
-       mlog_exit_void();
 }
 
 void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex)
@@ -3879,10 +3762,8 @@ void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex)
        struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb);
        int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
 
-       mlog_entry_void();
        if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb))
                ocfs2_cluster_unlock(osb, lockres, level);
-       mlog_exit_void();
 }
 
 static int ocfs2_refresh_qinfo(struct ocfs2_mem_dqinfo *oinfo)
@@ -3937,8 +3818,6 @@ int ocfs2_qinfo_lock(struct ocfs2_mem_dqinfo *oinfo, int ex)
        int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
        int status = 0;
 
-       mlog_entry_void();
-
        /* On RO devices, locking really isn't needed... */
        if (ocfs2_is_hard_readonly(osb)) {
                if (ex)
@@ -3961,7 +3840,6 @@ int ocfs2_qinfo_lock(struct ocfs2_mem_dqinfo *oinfo, int ex)
                ocfs2_qinfo_unlock(oinfo, ex);
        ocfs2_complete_lock_res_refresh(lockres, status);
 bail:
-       mlog_exit(status);
        return status;
 }
 
@@ -4007,8 +3885,6 @@ static void ocfs2_process_blocked_lock(struct ocfs2_super *osb,
         * considered valid until we remove the OCFS2_LOCK_QUEUED
         * flag. */
 
-       mlog_entry_void();
-
        BUG_ON(!lockres);
        BUG_ON(!lockres->l_ops);
 
@@ -4042,15 +3918,11 @@ unqueue:
        if (ctl.unblock_action != UNBLOCK_CONTINUE
            && lockres->l_ops->post_unlock)
                lockres->l_ops->post_unlock(osb, lockres);
-
-       mlog_exit_void();
 }
 
 static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
                                        struct ocfs2_lock_res *lockres)
 {
-       mlog_entry_void();
-
        assert_spin_locked(&lockres->l_lock);
 
        if (lockres->l_flags & OCFS2_LOCK_FREEING) {
@@ -4071,8 +3943,6 @@ static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
                osb->blocked_lock_count++;
        }
        spin_unlock(&osb->dc_task_lock);
-
-       mlog_exit_void();
 }
 
 static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb)
@@ -4080,8 +3950,6 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb)
        unsigned long processed;
        struct ocfs2_lock_res *lockres;
 
-       mlog_entry_void();
-
        spin_lock(&osb->dc_task_lock);
        /* grab this early so we know to try again if a state change and
         * wake happens part-way through our work  */
@@ -4105,8 +3973,6 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb)
                spin_lock(&osb->dc_task_lock);
        }
        spin_unlock(&osb->dc_task_lock);
-
-       mlog_exit_void();
 }
 
 static int ocfs2_downconvert_thread_lists_empty(struct ocfs2_super *osb)
index 254652a9b542687e1a08e0e52d7b28db20ed6ba3..745db42528d5fd2f875a099177158f347fd361e7 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/fs.h>
 #include <linux/types.h>
 
-#define MLOG_MASK_PREFIX ML_EXPORT
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -40,6 +39,7 @@
 
 #include "buffer_head_io.h"
 #include "suballoc.h"
+#include "ocfs2_trace.h"
 
 struct ocfs2_inode_handle
 {
@@ -56,10 +56,9 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,
        int status, set;
        struct dentry *result;
 
-       mlog_entry("(0x%p, 0x%p)\n", sb, handle);
+       trace_ocfs2_get_dentry_begin(sb, handle, (unsigned long long)blkno);
 
        if (blkno == 0) {
-               mlog(0, "nfs wants inode with blkno: 0\n");
                result = ERR_PTR(-ESTALE);
                goto bail;
        }
@@ -83,6 +82,7 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,
        }
 
        status = ocfs2_test_inode_bit(osb, blkno, &set);
+       trace_ocfs2_get_dentry_test_bit(status, set);
        if (status < 0) {
                if (status == -EINVAL) {
                        /*
@@ -90,18 +90,14 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,
                         * as an inode, we return -ESTALE to be
                         * nice
                         */
-                       mlog(0, "test inode bit failed %d\n", status);
                        status = -ESTALE;
-               } else {
+               } else
                        mlog(ML_ERROR, "test inode bit failed %d\n", status);
-               }
                goto unlock_nfs_sync;
        }
 
        /* If the inode allocator bit is clear, this inode must be stale */
        if (!set) {
-               mlog(0, "inode %llu suballoc bit is clear\n",
-                    (unsigned long long)blkno);
                status = -ESTALE;
                goto unlock_nfs_sync;
        }
@@ -114,8 +110,8 @@ unlock_nfs_sync:
 check_err:
        if (status < 0) {
                if (status == -ESTALE) {
-                       mlog(0, "stale inode ino: %llu generation: %u\n",
-                            (unsigned long long)blkno, handle->ih_generation);
+                       trace_ocfs2_get_dentry_stale((unsigned long long)blkno,
+                                                    handle->ih_generation);
                }
                result = ERR_PTR(status);
                goto bail;
@@ -130,8 +126,9 @@ check_err:
 check_gen:
        if (handle->ih_generation != inode->i_generation) {
                iput(inode);
-               mlog(0, "stale inode ino: %llu generation: %u\n",
-                    (unsigned long long)blkno, handle->ih_generation);
+               trace_ocfs2_get_dentry_generation((unsigned long long)blkno,
+                                                 handle->ih_generation,
+                                                 inode->i_generation);
                result = ERR_PTR(-ESTALE);
                goto bail;
        }
@@ -141,7 +138,7 @@ check_gen:
                mlog_errno(PTR_ERR(result));
 
 bail:
-       mlog_exit_ptr(result);
+       trace_ocfs2_get_dentry_end(result);
        return result;
 }
 
@@ -152,11 +149,8 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)
        struct dentry *parent;
        struct inode *dir = child->d_inode;
 
-       mlog_entry("(0x%p, '%.*s')\n", child,
-                  child->d_name.len, child->d_name.name);
-
-       mlog(0, "find parent of directory %llu\n",
-            (unsigned long long)OCFS2_I(dir)->ip_blkno);
+       trace_ocfs2_get_parent(child, child->d_name.len, child->d_name.name,
+                              (unsigned long long)OCFS2_I(dir)->ip_blkno);
 
        status = ocfs2_inode_lock(dir, NULL, 0);
        if (status < 0) {
@@ -178,7 +172,7 @@ bail_unlock:
        ocfs2_inode_unlock(dir, 0);
 
 bail:
-       mlog_exit_ptr(parent);
+       trace_ocfs2_get_parent_end(parent);
 
        return parent;
 }
@@ -193,9 +187,9 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len,
        u32 generation;
        __le32 *fh = (__force __le32 *) fh_in;
 
-       mlog_entry("(0x%p, '%.*s', 0x%p, %d, %d)\n", dentry,
-                  dentry->d_name.len, dentry->d_name.name,
-                  fh, len, connectable);
+       trace_ocfs2_encode_fh_begin(dentry, dentry->d_name.len,
+                                   dentry->d_name.name,
+                                   fh, len, connectable);
 
        if (connectable && (len < 6)) {
                *max_len = 6;
@@ -210,8 +204,7 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len,
        blkno = OCFS2_I(inode)->ip_blkno;
        generation = inode->i_generation;
 
-       mlog(0, "Encoding fh: blkno: %llu, generation: %u\n",
-            (unsigned long long)blkno, generation);
+       trace_ocfs2_encode_fh_self((unsigned long long)blkno, generation);
 
        len = 3;
        fh[0] = cpu_to_le32((u32)(blkno >> 32));
@@ -236,14 +229,14 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len,
                len = 6;
                type = 2;
 
-               mlog(0, "Encoding parent: blkno: %llu, generation: %u\n",
-                    (unsigned long long)blkno, generation);
+               trace_ocfs2_encode_fh_parent((unsigned long long)blkno,
+                                            generation);
        }
 
        *max_len = len;
 
 bail:
-       mlog_exit(type);
+       trace_ocfs2_encode_fh_type(type);
        return type;
 }
 
index 09e3fdfa6d33f603f6fe2a9bcdade3f979565e61..23457b491e8ce53ac5b71d9cd5fc2a5e1400a07f 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/types.h>
 #include <linux/fiemap.h>
 
-#define MLOG_MASK_PREFIX ML_EXTENT_MAP
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -39,6 +38,7 @@
 #include "inode.h"
 #include "super.h"
 #include "symlink.h"
+#include "ocfs2_trace.h"
 
 #include "buffer_head_io.h"
 
@@ -841,10 +841,9 @@ int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr,
        u64 p_block, p_count;
        int i, count, done = 0;
 
-       mlog_entry("(inode = %p, v_block = %llu, nr = %d, bhs = %p, "
-                  "flags = %x, validate = %p)\n",
-                  inode, (unsigned long long)v_block, nr, bhs, flags,
-                  validate);
+       trace_ocfs2_read_virt_blocks(
+            inode, (unsigned long long)v_block, nr, bhs, flags,
+            validate);
 
        if (((v_block + nr - 1) << inode->i_sb->s_blocksize_bits) >=
            i_size_read(inode)) {
@@ -897,7 +896,6 @@ int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr,
        }
 
 out:
-       mlog_exit(rc);
        return rc;
 }
 
index a6651956482e121b460ccadb5446892efee220a7..41565ae528566b3a5bfca14092aad21bba721812 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/quotaops.h>
 #include <linux/blkdev.h>
 
-#define MLOG_MASK_PREFIX ML_INODE
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -61,6 +60,7 @@
 #include "acl.h"
 #include "quota.h"
 #include "refcounttree.h"
+#include "ocfs2_trace.h"
 
 #include "buffer_head_io.h"
 
@@ -99,8 +99,10 @@ static int ocfs2_file_open(struct inode *inode, struct file *file)
        int mode = file->f_flags;
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
 
-       mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
-                  file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name);
+       trace_ocfs2_file_open(inode, file, file->f_path.dentry,
+                             (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                             file->f_path.dentry->d_name.len,
+                             file->f_path.dentry->d_name.name, mode);
 
        if (file->f_mode & FMODE_WRITE)
                dquot_initialize(inode);
@@ -135,7 +137,6 @@ static int ocfs2_file_open(struct inode *inode, struct file *file)
        }
 
 leave:
-       mlog_exit(status);
        return status;
 }
 
@@ -143,19 +144,19 @@ static int ocfs2_file_release(struct inode *inode, struct file *file)
 {
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
 
-       mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
-                      file->f_path.dentry->d_name.len,
-                      file->f_path.dentry->d_name.name);
-
        spin_lock(&oi->ip_lock);
        if (!--oi->ip_open_count)
                oi->ip_flags &= ~OCFS2_INODE_OPEN_DIRECT;
+
+       trace_ocfs2_file_release(inode, file, file->f_path.dentry,
+                                oi->ip_blkno,
+                                file->f_path.dentry->d_name.len,
+                                file->f_path.dentry->d_name.name,
+                                oi->ip_open_count);
        spin_unlock(&oi->ip_lock);
 
        ocfs2_free_file_private(inode, file);
 
-       mlog_exit(0);
-
        return 0;
 }
 
@@ -177,9 +178,11 @@ static int ocfs2_sync_file(struct file *file, int datasync)
        struct inode *inode = file->f_mapping->host;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 
-       mlog_entry("(0x%p, %d, 0x%p, '%.*s')\n", file, datasync,
-                  file->f_path.dentry, file->f_path.dentry->d_name.len,
-                  file->f_path.dentry->d_name.name);
+       trace_ocfs2_sync_file(inode, file, file->f_path.dentry,
+                             OCFS2_I(inode)->ip_blkno,
+                             file->f_path.dentry->d_name.len,
+                             file->f_path.dentry->d_name.name,
+                             (unsigned long long)datasync);
 
        if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) {
                /*
@@ -195,7 +198,8 @@ static int ocfs2_sync_file(struct file *file, int datasync)
        err = jbd2_journal_force_commit(journal);
 
 bail:
-       mlog_exit(err);
+       if (err)
+               mlog_errno(err);
 
        return (err < 0) ? -EIO : 0;
 }
@@ -251,8 +255,6 @@ int ocfs2_update_inode_atime(struct inode *inode,
        handle_t *handle;
        struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data;
 
-       mlog_entry_void();
-
        handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
        if (IS_ERR(handle)) {
                ret = PTR_ERR(handle);
@@ -280,7 +282,6 @@ int ocfs2_update_inode_atime(struct inode *inode,
 out_commit:
        ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
 out:
-       mlog_exit(ret);
        return ret;
 }
 
@@ -291,7 +292,6 @@ static int ocfs2_set_inode_size(handle_t *handle,
 {
        int status;
 
-       mlog_entry_void();
        i_size_write(inode, new_i_size);
        inode->i_blocks = ocfs2_inode_sector_count(inode);
        inode->i_ctime = inode->i_mtime = CURRENT_TIME;
@@ -303,7 +303,6 @@ static int ocfs2_set_inode_size(handle_t *handle,
        }
 
 bail:
-       mlog_exit(status);
        return status;
 }
 
@@ -375,8 +374,6 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
        struct ocfs2_dinode *di;
        u64 cluster_bytes;
 
-       mlog_entry_void();
-
        /*
         * We need to CoW the cluster contains the offset if it is reflinked
         * since we will call ocfs2_zero_range_for_truncate later which will
@@ -429,8 +426,6 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
 out_commit:
        ocfs2_commit_trans(osb, handle);
 out:
-
-       mlog_exit(status);
        return status;
 }
 
@@ -442,14 +437,14 @@ static int ocfs2_truncate_file(struct inode *inode,
        struct ocfs2_dinode *fe = NULL;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 
-       mlog_entry("(inode = %llu, new_i_size = %llu\n",
-                  (unsigned long long)OCFS2_I(inode)->ip_blkno,
-                  (unsigned long long)new_i_size);
-
        /* We trust di_bh because it comes from ocfs2_inode_lock(), which
         * already validated it */
        fe = (struct ocfs2_dinode *) di_bh->b_data;
 
+       trace_ocfs2_truncate_file((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                                 (unsigned long long)le64_to_cpu(fe->i_size),
+                                 (unsigned long long)new_i_size);
+
        mlog_bug_on_msg(le64_to_cpu(fe->i_size) != i_size_read(inode),
                        "Inode %llu, inode i_size = %lld != di "
                        "i_size = %llu, i_flags = 0x%x\n",
@@ -459,19 +454,14 @@ static int ocfs2_truncate_file(struct inode *inode,
                        le32_to_cpu(fe->i_flags));
 
        if (new_i_size > le64_to_cpu(fe->i_size)) {
-               mlog(0, "asked to truncate file with size (%llu) to size (%llu)!\n",
-                    (unsigned long long)le64_to_cpu(fe->i_size),
-                    (unsigned long long)new_i_size);
+               trace_ocfs2_truncate_file_error(
+                       (unsigned long long)le64_to_cpu(fe->i_size),
+                       (unsigned long long)new_i_size);
                status = -EINVAL;
                mlog_errno(status);
                goto bail;
        }
 
-       mlog(0, "inode %llu, i_size = %llu, new_i_size = %llu\n",
-            (unsigned long long)le64_to_cpu(fe->i_blkno),
-            (unsigned long long)le64_to_cpu(fe->i_size),
-            (unsigned long long)new_i_size);
-
        /* lets handle the simple truncate cases before doing any more
         * cluster locking. */
        if (new_i_size == le64_to_cpu(fe->i_size))
@@ -525,7 +515,6 @@ bail:
        if (!status && OCFS2_I(inode)->ip_clusters == 0)
                status = ocfs2_try_remove_refcount_tree(inode, di_bh);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -578,8 +567,6 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
        struct ocfs2_extent_tree et;
        int did_quota = 0;
 
-       mlog_entry("(clusters_to_add = %u)\n", clusters_to_add);
-
        /*
         * This function only exists for file systems which don't
         * support holes.
@@ -596,11 +583,6 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
 restart_all:
        BUG_ON(le32_to_cpu(fe->i_clusters) != OCFS2_I(inode)->ip_clusters);
 
-       mlog(0, "extend inode %llu, i_size = %lld, di->i_clusters = %u, "
-            "clusters_to_add = %u\n",
-            (unsigned long long)OCFS2_I(inode)->ip_blkno,
-            (long long)i_size_read(inode), le32_to_cpu(fe->i_clusters),
-            clusters_to_add);
        ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), bh);
        status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0,
                                       &data_ac, &meta_ac);
@@ -620,6 +602,12 @@ restart_all:
        }
 
 restarted_transaction:
+       trace_ocfs2_extend_allocation(
+               (unsigned long long)OCFS2_I(inode)->ip_blkno,
+               (unsigned long long)i_size_read(inode),
+               le32_to_cpu(fe->i_clusters), clusters_to_add,
+               why, restart_func);
+
        status = dquot_alloc_space_nodirty(inode,
                        ocfs2_clusters_to_bytes(osb->sb, clusters_to_add));
        if (status)
@@ -666,13 +654,11 @@ restarted_transaction:
 
        if (why != RESTART_NONE && clusters_to_add) {
                if (why == RESTART_META) {
-                       mlog(0, "restarting function.\n");
                        restart_func = 1;
                        status = 0;
                } else {
                        BUG_ON(why != RESTART_TRANS);
 
-                       mlog(0, "restarting transaction.\n");
                        /* TODO: This can be more intelligent. */
                        credits = ocfs2_calc_extend_credits(osb->sb,
                                                            &fe->id2.i_list,
@@ -689,11 +675,11 @@ restarted_transaction:
                }
        }
 
-       mlog(0, "fe: i_clusters = %u, i_size=%llu\n",
+       trace_ocfs2_extend_allocation_end(OCFS2_I(inode)->ip_blkno,
             le32_to_cpu(fe->i_clusters),
-            (unsigned long long)le64_to_cpu(fe->i_size));
-       mlog(0, "inode: ip_clusters=%u, i_size=%lld\n",
-            OCFS2_I(inode)->ip_clusters, (long long)i_size_read(inode));
+            (unsigned long long)le64_to_cpu(fe->i_size),
+            OCFS2_I(inode)->ip_clusters,
+            (unsigned long long)i_size_read(inode));
 
 leave:
        if (status < 0 && did_quota)
@@ -718,7 +704,6 @@ leave:
        brelse(bh);
        bh = NULL;
 
-       mlog_exit(status);
        return status;
 }
 
@@ -785,10 +770,11 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
        if (!zero_to)
                zero_to = PAGE_CACHE_SIZE;
 
-       mlog(0,
-            "abs_from = %llu, abs_to = %llu, index = %lu, zero_from = %u, zero_to = %u\n",
-            (unsigned long long)abs_from, (unsigned long long)abs_to,
-            index, zero_from, zero_to);
+       trace_ocfs2_write_zero_page(
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       (unsigned long long)abs_from,
+                       (unsigned long long)abs_to,
+                       index, zero_from, zero_to);
 
        /* We know that zero_from is block aligned */
        for (block_start = zero_from; block_start < zero_to;
@@ -928,9 +914,10 @@ static int ocfs2_zero_extend_range(struct inode *inode, u64 range_start,
        u64 next_pos;
        u64 zero_pos = range_start;
 
-       mlog(0, "range_start = %llu, range_end = %llu\n",
-            (unsigned long long)range_start,
-            (unsigned long long)range_end);
+       trace_ocfs2_zero_extend_range(
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       (unsigned long long)range_start,
+                       (unsigned long long)range_end);
        BUG_ON(range_start >= range_end);
 
        while (zero_pos < range_end) {
@@ -962,9 +949,9 @@ int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh,
        struct super_block *sb = inode->i_sb;
 
        zero_start = ocfs2_align_bytes_to_blocks(sb, i_size_read(inode));
-       mlog(0, "zero_start %llu for i_size %llu\n",
-            (unsigned long long)zero_start,
-            (unsigned long long)i_size_read(inode));
+       trace_ocfs2_zero_extend((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                               (unsigned long long)zero_start,
+                               (unsigned long long)i_size_read(inode));
        while (zero_start < zero_to_size) {
                ret = ocfs2_zero_extend_get_range(inode, di_bh, zero_start,
                                                  zero_to_size,
@@ -1113,30 +1100,20 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
        struct dquot *transfer_to[MAXQUOTAS] = { };
        int qtype;
 
-       mlog_entry("(0x%p, '%.*s')\n", dentry,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_setattr(inode, dentry,
+                           (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                           dentry->d_name.len, dentry->d_name.name,
+                           attr->ia_valid, attr->ia_mode,
+                           attr->ia_uid, attr->ia_gid);
 
        /* ensuring we don't even attempt to truncate a symlink */
        if (S_ISLNK(inode->i_mode))
                attr->ia_valid &= ~ATTR_SIZE;
 
-       if (attr->ia_valid & ATTR_MODE)
-               mlog(0, "mode change: %d\n", attr->ia_mode);
-       if (attr->ia_valid & ATTR_UID)
-               mlog(0, "uid change: %d\n", attr->ia_uid);
-       if (attr->ia_valid & ATTR_GID)
-               mlog(0, "gid change: %d\n", attr->ia_gid);
-       if (attr->ia_valid & ATTR_SIZE)
-               mlog(0, "size change...\n");
-       if (attr->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME))
-               mlog(0, "time change...\n");
-
 #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \
                           | ATTR_GID | ATTR_UID | ATTR_MODE)
-       if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) {
-               mlog(0, "can't handle attrs: 0x%x\n", attr->ia_valid);
+       if (!(attr->ia_valid & OCFS2_VALID_ATTRS))
                return 0;
-       }
 
        status = inode_change_ok(inode, attr);
        if (status)
@@ -1274,7 +1251,6 @@ bail:
                        mlog_errno(status);
        }
 
-       mlog_exit(status);
        return status;
 }
 
@@ -1287,8 +1263,6 @@ int ocfs2_getattr(struct vfsmount *mnt,
        struct ocfs2_super *osb = sb->s_fs_info;
        int err;
 
-       mlog_entry_void();
-
        err = ocfs2_inode_revalidate(dentry);
        if (err) {
                if (err != -ENOENT)
@@ -1302,8 +1276,6 @@ int ocfs2_getattr(struct vfsmount *mnt,
        stat->blksize = osb->s_clustersize;
 
 bail:
-       mlog_exit(err);
-
        return err;
 }
 
@@ -1314,8 +1286,6 @@ int ocfs2_permission(struct inode *inode, int mask, unsigned int flags)
        if (flags & IPERM_FLAG_RCU)
                return -ECHILD;
 
-       mlog_entry_void();
-
        ret = ocfs2_inode_lock(inode, NULL, 0);
        if (ret) {
                if (ret != -ENOENT)
@@ -1327,7 +1297,6 @@ int ocfs2_permission(struct inode *inode, int mask, unsigned int flags)
 
        ocfs2_inode_unlock(inode, 0);
 out:
-       mlog_exit(ret);
        return ret;
 }
 
@@ -1339,8 +1308,9 @@ static int __ocfs2_write_remove_suid(struct inode *inode,
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        struct ocfs2_dinode *di;
 
-       mlog_entry("(Inode %llu, mode 0%o)\n",
-                  (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_mode);
+       trace_ocfs2_write_remove_suid(
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       inode->i_mode);
 
        handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
        if (IS_ERR(handle)) {
@@ -1368,7 +1338,6 @@ static int __ocfs2_write_remove_suid(struct inode *inode,
 out_trans:
        ocfs2_commit_trans(osb, handle);
 out:
-       mlog_exit(ret);
        return ret;
 }
 
@@ -1547,8 +1516,9 @@ static int ocfs2_zero_partial_clusters(struct inode *inode,
         * partial clusters here. There's no need to worry about
         * physical allocation - the zeroing code knows to skip holes.
         */
-       mlog(0, "byte start: %llu, end: %llu\n",
-            (unsigned long long)start, (unsigned long long)end);
+       trace_ocfs2_zero_partial_clusters(
+               (unsigned long long)OCFS2_I(inode)->ip_blkno,
+               (unsigned long long)start, (unsigned long long)end);
 
        /*
         * If both edges are on a cluster boundary then there's no
@@ -1572,8 +1542,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode,
        if (tmpend > end)
                tmpend = end;
 
-       mlog(0, "1st range: start: %llu, tmpend: %llu\n",
-            (unsigned long long)start, (unsigned long long)tmpend);
+       trace_ocfs2_zero_partial_clusters_range1((unsigned long long)start,
+                                                (unsigned long long)tmpend);
 
        ret = ocfs2_zero_range_for_truncate(inode, handle, start, tmpend);
        if (ret)
@@ -1587,8 +1557,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode,
                 */
                start = end & ~(osb->s_clustersize - 1);
 
-               mlog(0, "2nd range: start: %llu, end: %llu\n",
-                    (unsigned long long)start, (unsigned long long)end);
+               trace_ocfs2_zero_partial_clusters_range2(
+                       (unsigned long long)start, (unsigned long long)end);
 
                ret = ocfs2_zero_range_for_truncate(inode, handle, start, end);
                if (ret)
@@ -1688,6 +1658,11 @@ static int ocfs2_remove_inode_range(struct inode *inode,
        ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh);
        ocfs2_init_dealloc_ctxt(&dealloc);
 
+       trace_ocfs2_remove_inode_range(
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       (unsigned long long)byte_start,
+                       (unsigned long long)byte_len);
+
        if (byte_len == 0)
                return 0;
 
@@ -1734,11 +1709,6 @@ static int ocfs2_remove_inode_range(struct inode *inode,
        trunc_end = (byte_start + byte_len) >> osb->s_clustersize_bits;
        cluster_in_el = trunc_end;
 
-       mlog(0, "Inode: %llu, start: %llu, len: %llu, cstart: %u, cend: %u\n",
-            (unsigned long long)OCFS2_I(inode)->ip_blkno,
-            (unsigned long long)byte_start,
-            (unsigned long long)byte_len, trunc_start, trunc_end);
-
        ret = ocfs2_zero_partial_clusters(inode, byte_start, byte_len);
        if (ret) {
                mlog_errno(ret);
@@ -2093,7 +2063,7 @@ static int ocfs2_prepare_inode_for_write(struct file *file,
        int ret = 0, meta_level = 0;
        struct dentry *dentry = file->f_path.dentry;
        struct inode *inode = dentry->d_inode;
-       loff_t saved_pos, end;
+       loff_t saved_pos = 0, end;
 
        /*
         * We start with a read level meta lock and only jump to an ex
@@ -2132,12 +2102,10 @@ static int ocfs2_prepare_inode_for_write(struct file *file,
 
                /* work on a copy of ppos until we're sure that we won't have
                 * to recalculate it due to relocking. */
-               if (appending) {
+               if (appending)
                        saved_pos = i_size_read(inode);
-                       mlog(0, "O_APPEND: inode->i_size=%llu\n", saved_pos);
-               } else {
+               else
                        saved_pos = *ppos;
-               }
 
                end = saved_pos + count;
 
@@ -2208,6 +2176,10 @@ static int ocfs2_prepare_inode_for_write(struct file *file,
                *ppos = saved_pos;
 
 out_unlock:
+       trace_ocfs2_prepare_inode_for_write(OCFS2_I(inode)->ip_blkno,
+                                           saved_pos, appending, count,
+                                           direct_io, has_refcount);
+
        if (meta_level >= 0)
                ocfs2_inode_unlock(inode, meta_level);
 
@@ -2233,10 +2205,11 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
        int full_coherency = !(osb->s_mount_opt &
                               OCFS2_MOUNT_COHERENCY_BUFFERED);
 
-       mlog_entry("(0x%p, %u, '%.*s')\n", file,
-                  (unsigned int)nr_segs,
-                  file->f_path.dentry->d_name.len,
-                  file->f_path.dentry->d_name.name);
+       trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry,
+               (unsigned long long)OCFS2_I(inode)->ip_blkno,
+               file->f_path.dentry->d_name.len,
+               file->f_path.dentry->d_name.name,
+               (unsigned int)nr_segs);
 
        if (iocb->ki_left == 0)
                return 0;
@@ -2402,7 +2375,6 @@ out_sems:
 
        if (written)
                ret = written;
-       mlog_exit(ret);
        return ret;
 }
 
@@ -2438,10 +2410,11 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
                .u.file = out,
        };
 
-       mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe,
-                  (unsigned int)len,
-                  out->f_path.dentry->d_name.len,
-                  out->f_path.dentry->d_name.name);
+
+       trace_ocfs2_file_splice_write(inode, out, out->f_path.dentry,
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       out->f_path.dentry->d_name.len,
+                       out->f_path.dentry->d_name.name, len);
 
        if (pipe->inode)
                mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT);
@@ -2485,7 +2458,6 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
                balance_dirty_pages_ratelimited_nr(mapping, nr_pages);
        }
 
-       mlog_exit(ret);
        return ret;
 }
 
@@ -2498,10 +2470,10 @@ static ssize_t ocfs2_file_splice_read(struct file *in,
        int ret = 0, lock_level = 0;
        struct inode *inode = in->f_path.dentry->d_inode;
 
-       mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", in, pipe,
-                  (unsigned int)len,
-                  in->f_path.dentry->d_name.len,
-                  in->f_path.dentry->d_name.name);
+       trace_ocfs2_file_splice_read(inode, in, in->f_path.dentry,
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       in->f_path.dentry->d_name.len,
+                       in->f_path.dentry->d_name.name, len);
 
        /*
         * See the comment in ocfs2_file_aio_read()
@@ -2516,7 +2488,6 @@ static ssize_t ocfs2_file_splice_read(struct file *in,
        ret = generic_file_splice_read(in, ppos, pipe, len, flags);
 
 bail:
-       mlog_exit(ret);
        return ret;
 }
 
@@ -2529,10 +2500,11 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
        struct file *filp = iocb->ki_filp;
        struct inode *inode = filp->f_path.dentry->d_inode;
 
-       mlog_entry("(0x%p, %u, '%.*s')\n", filp,
-                  (unsigned int)nr_segs,
-                  filp->f_path.dentry->d_name.len,
-                  filp->f_path.dentry->d_name.name);
+       trace_ocfs2_file_aio_read(inode, filp, filp->f_path.dentry,
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                       filp->f_path.dentry->d_name.len,
+                       filp->f_path.dentry->d_name.name, nr_segs);
+
 
        if (!inode) {
                ret = -EINVAL;
@@ -2578,8 +2550,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
        ocfs2_inode_unlock(inode, lock_level);
 
        ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos);
-       if (ret == -EINVAL)
-               mlog(0, "generic_file_aio_read returned -EINVAL\n");
+       trace_generic_file_aio_read_ret(ret);
 
        /* buffered aio wouldn't have proper lock coverage today */
        BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT));
@@ -2597,7 +2568,6 @@ bail:
        }
        if (rw_level != -1)
                ocfs2_rw_unlock(inode, rw_level);
-       mlog_exit(ret);
 
        return ret;
 }
index 1aa863dd901f783d71e54f19b37e78440fe46693..d8208b20dc532ea80a2f807d6b7ee39ee5c22306 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/types.h>
 #include <linux/highmem.h>
 
-#define MLOG_MASK_PREFIX ML_SUPER
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -37,6 +36,7 @@
 #include "heartbeat.h"
 #include "inode.h"
 #include "journal.h"
+#include "ocfs2_trace.h"
 
 #include "buffer_head_io.h"
 
@@ -66,7 +66,7 @@ void ocfs2_do_node_down(int node_num, void *data)
 
        BUG_ON(osb->node_num == node_num);
 
-       mlog(0, "ocfs2: node down event for %d\n", node_num);
+       trace_ocfs2_do_node_down(node_num);
 
        if (!osb->cconn) {
                /*
index 4068c6c4c6f64c56c6c2a675b82c5a4cf1934f83..177d3a6c2a5f4fdfc301ed3c9bb626a84594b93b 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <asm/byteorder.h>
 
-#define MLOG_MASK_PREFIX ML_INODE
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -53,6 +52,7 @@
 #include "uptodate.h"
 #include "xattr.h"
 #include "refcounttree.h"
+#include "ocfs2_trace.h"
 
 #include "buffer_head_io.h"
 
@@ -131,7 +131,8 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,
        struct super_block *sb = osb->sb;
        struct ocfs2_find_inode_args args;
 
-       mlog_entry("(blkno = %llu)\n", (unsigned long long)blkno);
+       trace_ocfs2_iget_begin((unsigned long long)blkno, flags,
+                              sysfile_type);
 
        /* Ok. By now we've either got the offsets passed to us by the
         * caller, or we just pulled them off the bh. Lets do some
@@ -152,16 +153,16 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,
        /* inode was *not* in the inode cache. 2.6.x requires
         * us to do our own read_inode call and unlock it
         * afterwards. */
-       if (inode && inode->i_state & I_NEW) {
-               mlog(0, "Inode was not in inode cache, reading it.\n");
-               ocfs2_read_locked_inode(inode, &args);
-               unlock_new_inode(inode);
-       }
        if (inode == NULL) {
                inode = ERR_PTR(-ENOMEM);
                mlog_errno(PTR_ERR(inode));
                goto bail;
        }
+       trace_ocfs2_iget5_locked(inode->i_state);
+       if (inode->i_state & I_NEW) {
+               ocfs2_read_locked_inode(inode, &args);
+               unlock_new_inode(inode);
+       }
        if (is_bad_inode(inode)) {
                iput(inode);
                inode = ERR_PTR(-ESTALE);
@@ -170,9 +171,8 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,
 
 bail:
        if (!IS_ERR(inode)) {
-               mlog(0, "returning inode with number %llu\n",
-                    (unsigned long long)OCFS2_I(inode)->ip_blkno);
-               mlog_exit_ptr(inode);
+               trace_ocfs2_iget_end(inode, 
+                       (unsigned long long)OCFS2_I(inode)->ip_blkno);
        }
 
        return inode;
@@ -192,18 +192,17 @@ static int ocfs2_find_actor(struct inode *inode, void *opaque)
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
        int ret = 0;
 
-       mlog_entry("(0x%p, %lu, 0x%p)\n", inode, inode->i_ino, opaque);
-
        args = opaque;
 
        mlog_bug_on_msg(!inode, "No inode in find actor!\n");
 
+       trace_ocfs2_find_actor(inode, inode->i_ino, opaque, args->fi_blkno);
+
        if (oi->ip_blkno != args->fi_blkno)
                goto bail;
 
        ret = 1;
 bail:
-       mlog_exit(ret);
        return ret;
 }
 
@@ -218,8 +217,6 @@ static int ocfs2_init_locked_inode(struct inode *inode, void *opaque)
        static struct lock_class_key ocfs2_quota_ip_alloc_sem_key,
                                     ocfs2_file_ip_alloc_sem_key;
 
-       mlog_entry("inode = %p, opaque = %p\n", inode, opaque);
-
        inode->i_ino = args->fi_ino;
        OCFS2_I(inode)->ip_blkno = args->fi_blkno;
        if (args->fi_sysfile_type != 0)
@@ -235,7 +232,6 @@ static int ocfs2_init_locked_inode(struct inode *inode, void *opaque)
                lockdep_set_class(&OCFS2_I(inode)->ip_alloc_sem,
                                  &ocfs2_file_ip_alloc_sem_key);
 
-       mlog_exit(0);
        return 0;
 }
 
@@ -246,9 +242,6 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
        struct ocfs2_super *osb;
        int use_plocks = 1;
 
-       mlog_entry("(0x%p, size:%llu)\n", inode,
-                  (unsigned long long)le64_to_cpu(fe->i_size));
-
        sb = inode->i_sb;
        osb = OCFS2_SB(sb);
 
@@ -300,20 +293,20 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
 
        inode->i_nlink = ocfs2_read_links_count(fe);
 
+       trace_ocfs2_populate_inode(OCFS2_I(inode)->ip_blkno,
+                                  le32_to_cpu(fe->i_flags));
        if (fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)) {
                OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SYSTEM_FILE;
                inode->i_flags |= S_NOQUOTA;
        }
-
+  
        if (fe->i_flags & cpu_to_le32(OCFS2_LOCAL_ALLOC_FL)) {
                OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP;
-               mlog(0, "local alloc inode: i_ino=%lu\n", inode->i_ino);
        } else if (fe->i_flags & cpu_to_le32(OCFS2_BITMAP_FL)) {
                OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP;
        } else if (fe->i_flags & cpu_to_le32(OCFS2_QUOTA_FL)) {
                inode->i_flags |= S_NOQUOTA;
        } else if (fe->i_flags & cpu_to_le32(OCFS2_SUPER_BLOCK_FL)) {
-               mlog(0, "superblock inode: i_ino=%lu\n", inode->i_ino);
                /* we can't actually hit this as read_inode can't
                 * handle superblocks today ;-) */
                BUG();
@@ -381,7 +374,6 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
        if (S_ISDIR(inode->i_mode))
                ocfs2_resv_set_type(&OCFS2_I(inode)->ip_la_data_resv,
                                    OCFS2_RESV_FLAG_DIR);
-       mlog_exit_void();
 }
 
 static int ocfs2_read_locked_inode(struct inode *inode,
@@ -394,8 +386,6 @@ static int ocfs2_read_locked_inode(struct inode *inode,
        int status, can_lock;
        u32 generation = 0;
 
-       mlog_entry("(0x%p, 0x%p)\n", inode, args);
-
        status = -EINVAL;
        if (inode == NULL || inode->i_sb == NULL) {
                mlog(ML_ERROR, "bad inode\n");
@@ -443,6 +433,9 @@ static int ocfs2_read_locked_inode(struct inode *inode,
                && !(args->fi_flags & OCFS2_FI_FLAG_ORPHAN_RECOVERY)
                && !ocfs2_mount_local(osb);
 
+       trace_ocfs2_read_locked_inode(
+               (unsigned long long)OCFS2_I(inode)->ip_blkno, can_lock);
+
        /*
         * To maintain backwards compatibility with older versions of
         * ocfs2-tools, we still store the generation value for system
@@ -534,7 +527,6 @@ bail:
        if (args && bh)
                brelse(bh);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -551,8 +543,6 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
        struct ocfs2_dinode *fe;
        handle_t *handle = NULL;
 
-       mlog_entry_void();
-
        fe = (struct ocfs2_dinode *) fe_bh->b_data;
 
        /*
@@ -600,7 +590,6 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
 out:
        if (handle)
                ocfs2_commit_trans(osb, handle);
-       mlog_exit(status);
        return status;
 }
 
@@ -696,8 +685,6 @@ static int ocfs2_check_orphan_recovery_state(struct ocfs2_super *osb,
 
        spin_lock(&osb->osb_lock);
        if (ocfs2_node_map_test_bit(osb, &osb->osb_recovering_orphan_dirs, slot)) {
-               mlog(0, "Recovery is happening on orphan dir %d, will skip "
-                    "this inode\n", slot);
                ret = -EDEADLK;
                goto out;
        }
@@ -706,6 +693,7 @@ static int ocfs2_check_orphan_recovery_state(struct ocfs2_super *osb,
        osb->osb_orphan_wipes[slot]++;
 out:
        spin_unlock(&osb->osb_lock);
+       trace_ocfs2_check_orphan_recovery_state(slot, ret);
        return ret;
 }
 
@@ -816,6 +804,10 @@ static int ocfs2_inode_is_valid_to_delete(struct inode *inode)
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 
+       trace_ocfs2_inode_is_valid_to_delete(current, osb->dc_task,
+                                            (unsigned long long)oi->ip_blkno,
+                                            oi->ip_flags);
+
        /* We shouldn't be getting here for the root directory
         * inode.. */
        if (inode == osb->root_inode) {
@@ -828,11 +820,8 @@ static int ocfs2_inode_is_valid_to_delete(struct inode *inode)
         * have to skip deleting this guy. That's OK though because
         * the node who's doing the actual deleting should handle it
         * anyway. */
-       if (current == osb->dc_task) {
-               mlog(0, "Skipping delete of %lu because we're currently "
-                    "in downconvert\n", inode->i_ino);
+       if (current == osb->dc_task)
                goto bail;
-       }
 
        spin_lock(&oi->ip_lock);
        /* OCFS2 *never* deletes system files. This should technically
@@ -847,11 +836,8 @@ static int ocfs2_inode_is_valid_to_delete(struct inode *inode)
        /* If we have allowd wipe of this inode for another node, it
         * will be marked here so we can safely skip it. Recovery will
         * cleanup any inodes we might inadvertantly skip here. */
-       if (oi->ip_flags & OCFS2_INODE_SKIP_DELETE) {
-               mlog(0, "Skipping delete of %lu because another node "
-                    "has done this for us.\n", inode->i_ino);
+       if (oi->ip_flags & OCFS2_INODE_SKIP_DELETE)
                goto bail_unlock;
-       }
 
        ret = 1;
 bail_unlock:
@@ -868,28 +854,27 @@ static int ocfs2_query_inode_wipe(struct inode *inode,
                                  struct buffer_head *di_bh,
                                  int *wipe)
 {
-       int status = 0;
+       int status = 0, reason = 0;
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
        struct ocfs2_dinode *di;
 
        *wipe = 0;
 
+       trace_ocfs2_query_inode_wipe_begin((unsigned long long)oi->ip_blkno,
+                                          inode->i_nlink);
+
        /* While we were waiting for the cluster lock in
         * ocfs2_delete_inode, another node might have asked to delete
         * the inode. Recheck our flags to catch this. */
        if (!ocfs2_inode_is_valid_to_delete(inode)) {
-               mlog(0, "Skipping delete of %llu because flags changed\n",
-                    (unsigned long long)oi->ip_blkno);
+               reason = 1;
                goto bail;
        }
 
        /* Now that we have an up to date inode, we can double check
         * the link count. */
-       if (inode->i_nlink) {
-               mlog(0, "Skipping delete of %llu because nlink = %u\n",
-                    (unsigned long long)oi->ip_blkno, inode->i_nlink);
+       if (inode->i_nlink)
                goto bail;
-       }
 
        /* Do some basic inode verification... */
        di = (struct ocfs2_dinode *) di_bh->b_data;
@@ -904,9 +889,7 @@ static int ocfs2_query_inode_wipe(struct inode *inode,
                 * ORPHANED_FL not.
                 */
                if (di->i_dyn_features & cpu_to_le16(OCFS2_HAS_REFCOUNT_FL)) {
-                       mlog(0, "Reflinked inode %llu is no longer orphaned.  "
-                            "it shouldn't be deleted\n",
-                            (unsigned long long)oi->ip_blkno);
+                       reason = 2;
                        goto bail;
                }
 
@@ -943,8 +926,7 @@ static int ocfs2_query_inode_wipe(struct inode *inode,
        status = ocfs2_try_open_lock(inode, 1);
        if (status == -EAGAIN) {
                status = 0;
-               mlog(0, "Skipping delete of %llu because it is in use on "
-                    "other nodes\n", (unsigned long long)oi->ip_blkno);
+               reason = 3;
                goto bail;
        }
        if (status < 0) {
@@ -953,11 +935,10 @@ static int ocfs2_query_inode_wipe(struct inode *inode,
        }
 
        *wipe = 1;
-       mlog(0, "Inode %llu is ok to wipe from orphan dir %u\n",
-            (unsigned long long)oi->ip_blkno,
-            le16_to_cpu(di->i_orphaned_slot));
+       trace_ocfs2_query_inode_wipe_succ(le16_to_cpu(di->i_orphaned_slot));
 
 bail:
+       trace_ocfs2_query_inode_wipe_end(status, reason);
        return status;
 }
 
@@ -967,8 +948,8 @@ bail:
 static void ocfs2_cleanup_delete_inode(struct inode *inode,
                                       int sync_data)
 {
-       mlog(0, "Cleanup inode %llu, sync = %d\n",
-            (unsigned long long)OCFS2_I(inode)->ip_blkno, sync_data);
+       trace_ocfs2_cleanup_delete_inode(
+               (unsigned long long)OCFS2_I(inode)->ip_blkno, sync_data);
        if (sync_data)
                write_inode_now(inode, 1);
        truncate_inode_pages(&inode->i_data, 0);
@@ -980,15 +961,15 @@ static void ocfs2_delete_inode(struct inode *inode)
        sigset_t oldset;
        struct buffer_head *di_bh = NULL;
 
-       mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino);
+       trace_ocfs2_delete_inode(inode->i_ino,
+                                (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                                is_bad_inode(inode));
 
        /* When we fail in read_inode() we mark inode as bad. The second test
         * catches the case when inode allocation fails before allocating
         * a block for inode. */
-       if (is_bad_inode(inode) || !OCFS2_I(inode)->ip_blkno) {
-               mlog(0, "Skipping delete of bad inode\n");
+       if (is_bad_inode(inode) || !OCFS2_I(inode)->ip_blkno)
                goto bail;
-       }
 
        dquot_initialize(inode);
 
@@ -1080,7 +1061,7 @@ bail_unlock_nfs_sync:
 bail_unblock:
        ocfs2_unblock_signals(&oldset);
 bail:
-       mlog_exit_void();
+       return;
 }
 
 static void ocfs2_clear_inode(struct inode *inode)
@@ -1088,11 +1069,9 @@ static void ocfs2_clear_inode(struct inode *inode)
        int status;
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
 
-       mlog_entry_void();
-
        end_writeback(inode);
-       mlog(0, "Clearing inode: %llu, nlink = %u\n",
-            (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_nlink);
+       trace_ocfs2_clear_inode((unsigned long long)oi->ip_blkno,
+                               inode->i_nlink);
 
        mlog_bug_on_msg(OCFS2_SB(inode->i_sb) == NULL,
                        "Inode=%lu\n", inode->i_ino);
@@ -1181,8 +1160,6 @@ static void ocfs2_clear_inode(struct inode *inode)
         */
        jbd2_journal_release_jbd_inode(OCFS2_SB(inode->i_sb)->journal->j_journal,
                                       &oi->ip_jinode);
-
-       mlog_exit_void();
 }
 
 void ocfs2_evict_inode(struct inode *inode)
@@ -1204,17 +1181,14 @@ int ocfs2_drop_inode(struct inode *inode)
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
        int res;
 
-       mlog_entry_void();
-
-       mlog(0, "Drop inode %llu, nlink = %u, ip_flags = 0x%x\n",
-            (unsigned long long)oi->ip_blkno, inode->i_nlink, oi->ip_flags);
+       trace_ocfs2_drop_inode((unsigned long long)oi->ip_blkno,
+                               inode->i_nlink, oi->ip_flags);
 
        if (oi->ip_flags & OCFS2_INODE_MAYBE_ORPHANED)
                res = 1;
        else
                res = generic_drop_inode(inode);
 
-       mlog_exit_void();
        return res;
 }
 
@@ -1226,11 +1200,11 @@ int ocfs2_inode_revalidate(struct dentry *dentry)
        struct inode *inode = dentry->d_inode;
        int status = 0;
 
-       mlog_entry("(inode = 0x%p, ino = %llu)\n", inode,
-                  inode ? (unsigned long long)OCFS2_I(inode)->ip_blkno : 0ULL);
+       trace_ocfs2_inode_revalidate(inode,
+               inode ? (unsigned long long)OCFS2_I(inode)->ip_blkno : 0ULL,
+               inode ? (unsigned long long)OCFS2_I(inode)->ip_flags : 0);
 
        if (!inode) {
-               mlog(0, "eep, no inode!\n");
                status = -ENOENT;
                goto bail;
        }
@@ -1238,7 +1212,6 @@ int ocfs2_inode_revalidate(struct dentry *dentry)
        spin_lock(&OCFS2_I(inode)->ip_lock);
        if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_DELETED) {
                spin_unlock(&OCFS2_I(inode)->ip_lock);
-               mlog(0, "inode deleted!\n");
                status = -ENOENT;
                goto bail;
        }
@@ -1254,8 +1227,6 @@ int ocfs2_inode_revalidate(struct dentry *dentry)
        }
        ocfs2_inode_unlock(inode, 0);
 bail:
-       mlog_exit(status);
-
        return status;
 }
 
@@ -1271,8 +1242,7 @@ int ocfs2_mark_inode_dirty(handle_t *handle,
        int status;
        struct ocfs2_dinode *fe = (struct ocfs2_dinode *) bh->b_data;
 
-       mlog_entry("(inode %llu)\n",
-                  (unsigned long long)OCFS2_I(inode)->ip_blkno);
+       trace_ocfs2_mark_inode_dirty((unsigned long long)OCFS2_I(inode)->ip_blkno);
 
        status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
                                         OCFS2_JOURNAL_ACCESS_WRITE);
@@ -1302,7 +1272,6 @@ int ocfs2_mark_inode_dirty(handle_t *handle,
 
        ocfs2_journal_dirty(handle, bh);
 leave:
-       mlog_exit(status);
        return status;
 }
 
@@ -1345,8 +1314,7 @@ int ocfs2_validate_inode_block(struct super_block *sb,
        int rc;
        struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
 
-       mlog(0, "Validating dinode %llu\n",
-            (unsigned long long)bh->b_blocknr);
+       trace_ocfs2_validate_inode_block((unsigned long long)bh->b_blocknr);
 
        BUG_ON(!buffer_uptodate(bh));
 
index 09de77ce002ab0f68e9e0783521f5eba3f6ae056..8f13c5989eaeeecd543be983cec37176c1c54ece 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/mount.h>
 #include <linux/compat.h>
 
-#define MLOG_MASK_PREFIX ML_INODE
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -46,6 +45,22 @@ static inline void __o2info_set_request_error(struct ocfs2_info_request *kreq,
 #define o2info_set_request_error(a, b) \
                __o2info_set_request_error((struct ocfs2_info_request *)&(a), b)
 
+static inline void __o2info_set_request_filled(struct ocfs2_info_request *req)
+{
+       req->ir_flags |= OCFS2_INFO_FL_FILLED;
+}
+
+#define o2info_set_request_filled(a) \
+               __o2info_set_request_filled((struct ocfs2_info_request *)&(a))
+
+static inline void __o2info_clear_request_filled(struct ocfs2_info_request *req)
+{
+       req->ir_flags &= ~OCFS2_INFO_FL_FILLED;
+}
+
+#define o2info_clear_request_filled(a) \
+               __o2info_clear_request_filled((struct ocfs2_info_request *)&(a))
+
 static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags)
 {
        int status;
@@ -59,7 +74,6 @@ static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags)
        *flags = OCFS2_I(inode)->ip_attr;
        ocfs2_inode_unlock(inode, 0);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -125,7 +139,6 @@ bail:
 
        brelse(bh);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -139,7 +152,8 @@ int ocfs2_info_handle_blocksize(struct inode *inode,
                goto bail;
 
        oib.ib_blocksize = inode->i_sb->s_blocksize;
-       oib.ib_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+
+       o2info_set_request_filled(oib);
 
        if (o2info_to_user(oib, req))
                goto bail;
@@ -163,7 +177,8 @@ int ocfs2_info_handle_clustersize(struct inode *inode,
                goto bail;
 
        oic.ic_clustersize = osb->s_clustersize;
-       oic.ic_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+
+       o2info_set_request_filled(oic);
 
        if (o2info_to_user(oic, req))
                goto bail;
@@ -187,7 +202,8 @@ int ocfs2_info_handle_maxslots(struct inode *inode,
                goto bail;
 
        oim.im_max_slots = osb->max_slots;
-       oim.im_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+
+       o2info_set_request_filled(oim);
 
        if (o2info_to_user(oim, req))
                goto bail;
@@ -211,7 +227,8 @@ int ocfs2_info_handle_label(struct inode *inode,
                goto bail;
 
        memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN);
-       oil.il_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+
+       o2info_set_request_filled(oil);
 
        if (o2info_to_user(oil, req))
                goto bail;
@@ -235,7 +252,8 @@ int ocfs2_info_handle_uuid(struct inode *inode,
                goto bail;
 
        memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1);
-       oiu.iu_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+
+       o2info_set_request_filled(oiu);
 
        if (o2info_to_user(oiu, req))
                goto bail;
@@ -261,7 +279,8 @@ int ocfs2_info_handle_fs_features(struct inode *inode,
        oif.if_compat_features = osb->s_feature_compat;
        oif.if_incompat_features = osb->s_feature_incompat;
        oif.if_ro_compat_features = osb->s_feature_ro_compat;
-       oif.if_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+
+       o2info_set_request_filled(oif);
 
        if (o2info_to_user(oif, req))
                goto bail;
@@ -286,7 +305,7 @@ int ocfs2_info_handle_journal_size(struct inode *inode,
 
        oij.ij_journal_size = osb->journal->j_inode->i_size;
 
-       oij.ij_req.ir_flags |= OCFS2_INFO_FL_FILLED;
+       o2info_set_request_filled(oij);
 
        if (o2info_to_user(oij, req))
                goto bail;
@@ -308,7 +327,7 @@ int ocfs2_info_handle_unknown(struct inode *inode,
        if (o2info_from_user(oir, req))
                goto bail;
 
-       oir.ir_flags &= ~OCFS2_INFO_FL_FILLED;
+       o2info_clear_request_filled(oir);
 
        if (o2info_to_user(oir, req))
                goto bail;
index faa2303dbf0a4b5bd0b21a013abee4af82dda47f..dcc2d9327150a7285af56b4bf9645a1bd46bf9a3 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/time.h>
 #include <linux/random.h>
 
-#define MLOG_MASK_PREFIX ML_JOURNAL
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -52,6 +51,7 @@
 #include "quota.h"
 
 #include "buffer_head_io.h"
+#include "ocfs2_trace.h"
 
 DEFINE_SPINLOCK(trans_inc_lock);
 
@@ -303,16 +303,15 @@ static int ocfs2_commit_cache(struct ocfs2_super *osb)
        unsigned int flushed;
        struct ocfs2_journal *journal = NULL;
 
-       mlog_entry_void();
-
        journal = osb->journal;
 
        /* Flush all pending commits and checkpoint the journal. */
        down_write(&journal->j_trans_barrier);
 
-       if (atomic_read(&journal->j_num_trans) == 0) {
+       flushed = atomic_read(&journal->j_num_trans);
+       trace_ocfs2_commit_cache_begin(flushed);
+       if (flushed == 0) {
                up_write(&journal->j_trans_barrier);
-               mlog(0, "No transactions for me to flush!\n");
                goto finally;
        }
 
@@ -331,13 +330,11 @@ static int ocfs2_commit_cache(struct ocfs2_super *osb)
        atomic_set(&journal->j_num_trans, 0);
        up_write(&journal->j_trans_barrier);
 
-       mlog(0, "commit_thread: flushed transaction %lu (%u handles)\n",
-            journal->j_trans_id, flushed);
+       trace_ocfs2_commit_cache_end(journal->j_trans_id, flushed);
 
        ocfs2_wake_downconvert_thread(osb);
        wake_up(&journal->j_checkpointed);
 finally:
-       mlog_exit(status);
        return status;
 }
 
@@ -425,9 +422,8 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks)
                return 0;
 
        old_nblocks = handle->h_buffer_credits;
-       mlog_entry_void();
 
-       mlog(0, "Trying to extend transaction by %d blocks\n", nblocks);
+       trace_ocfs2_extend_trans(old_nblocks, nblocks);
 
 #ifdef CONFIG_OCFS2_DEBUG_FS
        status = 1;
@@ -440,9 +436,7 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks)
 #endif
 
        if (status > 0) {
-               mlog(0,
-                    "jbd2_journal_extend failed, trying "
-                    "jbd2_journal_restart\n");
+               trace_ocfs2_extend_trans_restart(old_nblocks + nblocks);
                status = jbd2_journal_restart(handle,
                                              old_nblocks + nblocks);
                if (status < 0) {
@@ -453,8 +447,6 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks)
 
        status = 0;
 bail:
-
-       mlog_exit(status);
        return status;
 }
 
@@ -622,12 +614,9 @@ static int __ocfs2_journal_access(handle_t *handle,
        BUG_ON(!handle);
        BUG_ON(!bh);
 
-       mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %zu\n",
-                  (unsigned long long)bh->b_blocknr, type,
-                  (type == OCFS2_JOURNAL_ACCESS_CREATE) ?
-                  "OCFS2_JOURNAL_ACCESS_CREATE" :
-                  "OCFS2_JOURNAL_ACCESS_WRITE",
-                  bh->b_size);
+       trace_ocfs2_journal_access(
+               (unsigned long long)ocfs2_metadata_cache_owner(ci),
+               (unsigned long long)bh->b_blocknr, type, bh->b_size);
 
        /* we can safely remove this assertion after testing. */
        if (!buffer_uptodate(bh)) {
@@ -668,7 +657,6 @@ static int __ocfs2_journal_access(handle_t *handle,
                mlog(ML_ERROR, "Error %d getting %d access to buffer!\n",
                     status, type);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -737,13 +725,10 @@ void ocfs2_journal_dirty(handle_t *handle, struct buffer_head *bh)
 {
        int status;
 
-       mlog_entry("(bh->b_blocknr=%llu)\n",
-                  (unsigned long long)bh->b_blocknr);
+       trace_ocfs2_journal_dirty((unsigned long long)bh->b_blocknr);
 
        status = jbd2_journal_dirty_metadata(handle, bh);
        BUG_ON(status);
-
-       mlog_exit_void();
 }
 
 #define OCFS2_DEFAULT_COMMIT_INTERVAL  (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE)
@@ -775,8 +760,6 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty)
        struct ocfs2_super *osb;
        int inode_lock = 0;
 
-       mlog_entry_void();
-
        BUG_ON(!journal);
 
        osb = journal->j_osb;
@@ -820,10 +803,9 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty)
                goto done;
        }
 
-       mlog(0, "inode->i_size = %lld\n", inode->i_size);
-       mlog(0, "inode->i_blocks = %llu\n",
-                       (unsigned long long)inode->i_blocks);
-       mlog(0, "inode->ip_clusters = %u\n", OCFS2_I(inode)->ip_clusters);
+       trace_ocfs2_journal_init(inode->i_size,
+                                (unsigned long long)inode->i_blocks,
+                                OCFS2_I(inode)->ip_clusters);
 
        /* call the kernels journal init function now */
        j_journal = jbd2_journal_init_inode(inode);
@@ -833,8 +815,7 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty)
                goto done;
        }
 
-       mlog(0, "Returned from jbd2_journal_init_inode\n");
-       mlog(0, "j_journal->j_maxlen = %u\n", j_journal->j_maxlen);
+       trace_ocfs2_journal_init_maxlen(j_journal->j_maxlen);
 
        *dirty = (le32_to_cpu(di->id1.journal1.ij_flags) &
                  OCFS2_JOURNAL_DIRTY_FL);
@@ -859,7 +840,6 @@ done:
                }
        }
 
-       mlog_exit(status);
        return status;
 }
 
@@ -882,8 +862,6 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
        struct buffer_head *bh = journal->j_bh;
        struct ocfs2_dinode *fe;
 
-       mlog_entry_void();
-
        fe = (struct ocfs2_dinode *)bh->b_data;
 
        /* The journal bh on the osb always comes from ocfs2_journal_init()
@@ -906,7 +884,6 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
        if (status < 0)
                mlog_errno(status);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -921,8 +898,6 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
        struct inode *inode = NULL;
        int num_running_trans = 0;
 
-       mlog_entry_void();
-
        BUG_ON(!osb);
 
        journal = osb->journal;
@@ -939,10 +914,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
                BUG();
 
        num_running_trans = atomic_read(&(osb->journal->j_num_trans));
-       if (num_running_trans > 0)
-               mlog(0, "Shutting down journal: must wait on %d "
-                    "running transactions!\n",
-                    num_running_trans);
+       trace_ocfs2_journal_shutdown(num_running_trans);
 
        /* Do a commit_cache here. It will flush our journal, *and*
         * release any locks that are still held.
@@ -955,7 +927,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
         * completely destroy the journal. */
        if (osb->commit_task) {
                /* Wait for the commit thread */
-               mlog(0, "Waiting for ocfs2commit to exit....\n");
+               trace_ocfs2_journal_shutdown_wait(osb->commit_task);
                kthread_stop(osb->commit_task);
                osb->commit_task = NULL;
        }
@@ -998,7 +970,6 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
 done:
        if (inode)
                iput(inode);
-       mlog_exit_void();
 }
 
 static void ocfs2_clear_journal_error(struct super_block *sb,
@@ -1024,8 +995,6 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed)
        int status = 0;
        struct ocfs2_super *osb;
 
-       mlog_entry_void();
-
        BUG_ON(!journal);
 
        osb = journal->j_osb;
@@ -1059,7 +1028,6 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed)
                osb->commit_task = NULL;
 
 done:
-       mlog_exit(status);
        return status;
 }
 
@@ -1070,8 +1038,6 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full)
 {
        int status;
 
-       mlog_entry_void();
-
        BUG_ON(!journal);
 
        status = jbd2_journal_wipe(journal->j_journal, full);
@@ -1085,7 +1051,6 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full)
                mlog_errno(status);
 
 bail:
-       mlog_exit(status);
        return status;
 }
 
@@ -1124,8 +1089,6 @@ static int ocfs2_force_read_journal(struct inode *inode)
 #define CONCURRENT_JOURNAL_FILL 32ULL
        struct buffer_head *bhs[CONCURRENT_JOURNAL_FILL];
 
-       mlog_entry_void();
-
        memset(bhs, 0, sizeof(struct buffer_head *) * CONCURRENT_JOURNAL_FILL);
 
        num_blocks = ocfs2_blocks_for_bytes(inode->i_sb, inode->i_size);
@@ -1161,7 +1124,6 @@ static int ocfs2_force_read_journal(struct inode *inode)
 bail:
        for(i = 0; i < CONCURRENT_JOURNAL_FILL; i++)
                brelse(bhs[i]);
-       mlog_exit(status);
        return status;
 }
 
@@ -1185,7 +1147,7 @@ struct ocfs2_la_recovery_item {
  */
 void ocfs2_complete_recovery(struct work_struct *work)
 {
-       int ret;
+       int ret = 0;
        struct ocfs2_journal *journal =
                container_of(work, struct ocfs2_journal, j_recovery_work);
        struct ocfs2_super *osb = journal->j_osb;
@@ -1194,9 +1156,8 @@ void ocfs2_complete_recovery(struct work_struct *work)
        struct ocfs2_quota_recovery *qrec;
        LIST_HEAD(tmp_la_list);
 
-       mlog_entry_void();
-
-       mlog(0, "completing recovery from keventd\n");
+       trace_ocfs2_complete_recovery(
+               (unsigned long long)OCFS2_I(journal->j_inode)->ip_blkno);
 
        spin_lock(&journal->j_lock);
        list_splice_init(&journal->j_la_cleanups, &tmp_la_list);
@@ -1205,15 +1166,18 @@ void ocfs2_complete_recovery(struct work_struct *work)
        list_for_each_entry_safe(item, n, &tmp_la_list, lri_list) {
                list_del_init(&item->lri_list);
 
-               mlog(0, "Complete recovery for slot %d\n", item->lri_slot);
-
                ocfs2_wait_on_quotas(osb);
 
                la_dinode = item->lri_la_dinode;
-               if (la_dinode) {
-                       mlog(0, "Clean up local alloc %llu\n",
-                            (unsigned long long)le64_to_cpu(la_dinode->i_blkno));
+               tl_dinode = item->lri_tl_dinode;
+               qrec = item->lri_qrec;
+
+               trace_ocfs2_complete_recovery_slot(item->lri_slot,
+                       la_dinode ? le64_to_cpu(la_dinode->i_blkno) : 0,
+                       tl_dinode ? le64_to_cpu(tl_dinode->i_blkno) : 0,
+                       qrec);
 
+               if (la_dinode) {
                        ret = ocfs2_complete_local_alloc_recovery(osb,
                                                                  la_dinode);
                        if (ret < 0)
@@ -1222,11 +1186,7 @@ void ocfs2_complete_recovery(struct work_struct *work)
                        kfree(la_dinode);
                }
 
-               tl_dinode = item->lri_tl_dinode;
                if (tl_dinode) {
-                       mlog(0, "Clean up truncate log %llu\n",
-                            (unsigned long long)le64_to_cpu(tl_dinode->i_blkno));
-
                        ret = ocfs2_complete_truncate_log_recovery(osb,
                                                                   tl_dinode);
                        if (ret < 0)
@@ -1239,9 +1199,7 @@ void ocfs2_complete_recovery(struct work_struct *work)
                if (ret < 0)
                        mlog_errno(ret);
 
-               qrec = item->lri_qrec;
                if (qrec) {
-                       mlog(0, "Recovering quota files");
                        ret = ocfs2_finish_quota_recovery(osb, qrec,
                                                          item->lri_slot);
                        if (ret < 0)
@@ -1252,8 +1210,7 @@ void ocfs2_complete_recovery(struct work_struct *work)
                kfree(item);
        }
 
-       mlog(0, "Recovery completion\n");
-       mlog_exit_void();
+       trace_ocfs2_complete_recovery_end(ret);
 }
 
 /* NOTE: This function always eats your references to la_dinode and
@@ -1339,8 +1296,6 @@ static int __ocfs2_recovery_thread(void *arg)
        int rm_quota_used = 0, i;
        struct ocfs2_quota_recovery *qrec;
 
-       mlog_entry_void();
-
        status = ocfs2_wait_on_mount(osb);
        if (status < 0) {
                goto bail;
@@ -1372,15 +1327,12 @@ restart:
                 * clear it until ocfs2_recover_node() has succeeded. */
                node_num = rm->rm_entries[0];
                spin_unlock(&osb->osb_lock);
-               mlog(0, "checking node %d\n", node_num);
                slot_num = ocfs2_node_num_to_slot(osb, node_num);
+               trace_ocfs2_recovery_thread_node(node_num, slot_num);
                if (slot_num == -ENOENT) {
                        status = 0;
-                       mlog(0, "no slot for this node, so no recovery"
-                            "required.\n");
                        goto skip_recovery;
                }
-               mlog(0, "node %d was using slot %d\n", node_num, slot_num);
 
                /* It is a bit subtle with quota recovery. We cannot do it
                 * immediately because we have to obtain cluster locks from
@@ -1407,7 +1359,7 @@ skip_recovery:
                spin_lock(&osb->osb_lock);
        }
        spin_unlock(&osb->osb_lock);
-       mlog(0, "All nodes recovered\n");
+       trace_ocfs2_recovery_thread_end(status);
 
        /* Refresh all journal recovery generations from disk */
        status = ocfs2_check_journals_nolocks(osb);
@@ -1451,7 +1403,6 @@ bail:
        if (rm_quota)
                kfree(rm_quota);
 
-       mlog_exit(status);
        /* no one is callint kthread_stop() for us so the kthread() api
         * requires that we call do_exit().  And it isn't exported, but
         * complete_and_exit() seems to be a minimal wrapper around it. */
@@ -1461,19 +1412,15 @@ bail:
 
 void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num)
 {
-       mlog_entry("(node_num=%d, osb->node_num = %d)\n",
-                  node_num, osb->node_num);
-
        mutex_lock(&osb->recovery_lock);
-       if (osb->disable_recovery)
-               goto out;
 
-       /* People waiting on recovery will wait on
-        * the recovery map to empty. */
-       if (ocfs2_recovery_map_set(osb, node_num))
-               mlog(0, "node %d already in recovery map.\n", node_num);
+       trace_ocfs2_recovery_thread(node_num, osb->node_num,
+               osb->disable_recovery, osb->recovery_thread_task,
+               osb->disable_recovery ?
+               -1 : ocfs2_recovery_map_set(osb, node_num));
 
-       mlog(0, "starting recovery thread...\n");
+       if (osb->disable_recovery)
+               goto out;
 
        if (osb->recovery_thread_task)
                goto out;
@@ -1488,8 +1435,6 @@ void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num)
 out:
        mutex_unlock(&osb->recovery_lock);
        wake_up(&osb->recovery_event);
-
-       mlog_exit_void();
 }
 
 static int ocfs2_read_journal_inode(struct ocfs2_super *osb,
@@ -1563,7 +1508,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
         * If not, it needs recovery.
         */
        if (osb->slot_recovery_generations[slot_num] != slot_reco_gen) {
-               mlog(0, "Slot %u already recovered (old/new=%u/%u)\n", slot_num,
+               trace_ocfs2_replay_journal_recovered(slot_num,
                     osb->slot_recovery_generations[slot_num], slot_reco_gen);
                osb->slot_recovery_generations[slot_num] = slot_reco_gen;
                status = -EBUSY;
@@ -1574,7 +1519,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
 
        status = ocfs2_inode_lock_full(inode, &bh, 1, OCFS2_META_LOCK_RECOVERY);
        if (status < 0) {
-               mlog(0, "status returned from ocfs2_inode_lock=%d\n", status);
+               trace_ocfs2_replay_journal_lock_err(status);
                if (status != -ERESTARTSYS)
                        mlog(ML_ERROR, "Could not lock journal!\n");
                goto done;
@@ -1587,7 +1532,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
        slot_reco_gen = ocfs2_get_recovery_generation(fe);
 
        if (!(flags & OCFS2_JOURNAL_DIRTY_FL)) {
-               mlog(0, "No recovery required for node %d\n", node_num);
+               trace_ocfs2_replay_journal_skip(node_num);
                /* Refresh recovery generation for the slot */
                osb->slot_recovery_generations[slot_num] = slot_reco_gen;
                goto done;
@@ -1608,7 +1553,6 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
                goto done;
        }
 
-       mlog(0, "calling journal_init_inode\n");
        journal = jbd2_journal_init_inode(inode);
        if (journal == NULL) {
                mlog(ML_ERROR, "Linux journal layer error\n");
@@ -1628,7 +1572,6 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
        ocfs2_clear_journal_error(osb->sb, journal, slot_num);
 
        /* wipe the journal */
-       mlog(0, "flushing the journal.\n");
        jbd2_journal_lock_updates(journal);
        status = jbd2_journal_flush(journal);
        jbd2_journal_unlock_updates(journal);
@@ -1665,7 +1608,6 @@ done:
 
        brelse(bh);
 
-       mlog_exit(status);
        return status;
 }
 
@@ -1688,8 +1630,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb,
        struct ocfs2_dinode *la_copy = NULL;
        struct ocfs2_dinode *tl_copy = NULL;
 
-       mlog_entry("(node_num=%d, slot_num=%d, osb->node_num = %d)\n",
-                  node_num, slot_num, osb->node_num);
+       trace_ocfs2_recover_node(node_num, slot_num, osb->node_num);
 
        /* Should not ever be called to recover ourselves -- in that
         * case we should've called ocfs2_journal_load instead. */
@@ -1698,9 +1639,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb,
        status = ocfs2_replay_journal(osb, node_num, slot_num);
        if (status < 0) {
                if (status == -EBUSY) {
-                       mlog(0, "Skipping recovery for slot %u (node %u) "
-                            "as another node has recovered it\n", slot_num,
-                            node_num);
+                       trace_ocfs2_recover_node_skip(slot_num, node_num);
                        status = 0;
                        goto done;
                }
@@ -1735,7 +1674,6 @@ static int ocfs2_recover_node(struct ocfs2_super *osb,
        status = 0;
 done:
 
-       mlog_exit(status);
        return status;
 }
 
@@ -1808,8 +1746,8 @@ int ocfs2_mark_dead_nodes(struct ocfs2_super *osb)
                spin_lock(&osb->osb_lock);
                osb->slot_recovery_generations[i] = gen;
 
-               mlog(0, "Slot %u recovery generation is %u\n", i,
-                    osb->slot_recovery_generations[i]);
+               trace_ocfs2_mark_dead_nodes(i,
+                                           osb->slot_recovery_generations[i]);
 
                if (i == osb->slot_num) {
                        spin_unlock(&osb->osb_lock);
@@ -1845,7 +1783,6 @@ int ocfs2_mark_dead_nodes(struct ocfs2_super *osb)
 
        status = 0;
 bail:
-       mlog_exit(status);
        return status;
 }
 
@@ -1884,11 +1821,12 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb)
 
        os = &osb->osb_orphan_scan;
 
-       mlog(0, "Begin orphan scan\n");
-
        if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE)
                goto out;
 
+       trace_ocfs2_queue_orphan_scan_begin(os->os_count, os->os_seqno,
+                                           atomic_read(&os->os_state));
+
        status = ocfs2_orphan_scan_lock(osb, &seqno);
        if (status < 0) {
                if (status != -EAGAIN)
@@ -1918,7 +1856,8 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb)
 unlock:
        ocfs2_orphan_scan_unlock(osb, seqno);
 out:
-       mlog(0, "Orphan scan completed\n");
+       trace_ocfs2_queue_orphan_scan_end(os->os_count, os->os_seqno,
+                                         atomic_read(&os->os_state));
        return;
 }
 
@@ -2002,8 +1941,7 @@ static int ocfs2_orphan_filldir(void *priv, const char *name, int name_len,
        if (IS_ERR(iter))
                return 0;
 
-       mlog(0, "queue orphan %llu\n",
-            (unsigned long long)OCFS2_I(iter)->ip_blkno);
+       trace_ocfs2_orphan_filldir((unsigned long long)OCFS2_I(iter)->ip_blkno);
        /* No locking is required for the next_orphan queue as there
         * is only ever a single process doing orphan recovery. */
        OCFS2_I(iter)->ip_next_orphan = p->head;
@@ -2119,7 +2057,7 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
        struct inode *iter;
        struct ocfs2_inode_info *oi;
 
-       mlog(0, "Recover inodes from orphan dir in slot %d\n", slot);
+       trace_ocfs2_recover_orphans(slot);
 
        ocfs2_mark_recovering_orphan_dir(osb, slot);
        ret = ocfs2_queue_orphans(osb, slot, &inode);
@@ -2132,7 +2070,8 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
 
        while (inode) {
                oi = OCFS2_I(inode);
-               mlog(0, "iput orphan %llu\n", (unsigned long long)oi->ip_blkno);
+               trace_ocfs2_recover_orphans_iput(
+                                       (unsigned long long)oi->ip_blkno);
 
                iter = oi->ip_next_orphan;
 
@@ -2170,6 +2109,7 @@ static int __ocfs2_wait_on_mount(struct ocfs2_super *osb, int quota)
         * MOUNTED flag, but this is set right before
         * dismount_volume() so we can trust it. */
        if (atomic_read(&osb->vol_state) == VOLUME_DISABLED) {
+               trace_ocfs2_wait_on_mount(VOLUME_DISABLED);
                mlog(0, "mount error, exiting!\n");
                return -EBUSY;
        }
index ec6adbf8f5515afbaa7e8ffcb8a32b6a3c4e1ea8..210c35237548be82f9d99966beb166cdd2ffc87d 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/highmem.h>
 #include <linux/bitops.h>
 
-#define MLOG_MASK_PREFIX ML_DISK_ALLOC
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -43,6 +42,7 @@
 #include "suballoc.h"
 #include "super.h"
 #include "sysfile.h"
+#include "ocfs2_trace.h"
 
 #include "buffer_head_io.h"
 
@@ -201,8 +201,7 @@ void ocfs2_la_set_sizes(struct ocfs2_super *osb, int requested_mb)
        la_max_mb = ocfs2_clusters_to_megabytes(sb,
                                                ocfs2_local_alloc_size(sb) * 8);
 
-       mlog(0, "requested: %dM, max: %uM, default: %uM\n",
-            requested_mb, la_max_mb, la_default_mb);
+       trace_ocfs2_la_set_sizes(requested_mb, la_max_mb, la_default_mb);
 
        if (requested_mb == -1) {
                /* No user request - use defaults */
@@ -276,8 +275,8 @@ int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits)
 
        ret = 1;
 bail:
-       mlog(0, "state=%d, bits=%llu, la_bits=%d, ret=%d\n",
-            osb->local_alloc_state, (unsigned long long)bits, la_bits, ret);
+       trace_ocfs2_alloc_should_use_local(
+            (unsigned long long)bits, osb->local_alloc_state, la_bits, ret);
        spin_unlock(&osb->osb_lock);
        return ret;
 }
@@ -291,8 +290,6 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
        struct inode *inode = NULL;
        struct ocfs2_local_alloc *la;
 
-       mlog_entry_void();
-
        if (osb->local_alloc_bits == 0)
                goto bail;
 
@@ -364,9 +361,10 @@ bail:
        if (inode)
                iput(inode);
 
-       mlog(0, "Local alloc window bits = %d\n", osb->local_alloc_bits);
+       trace_ocfs2_load_local_alloc(osb->local_alloc_bits);
 
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
@@ -388,8 +386,6 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
        struct ocfs2_dinode *alloc_copy = NULL;
        struct ocfs2_dinode *alloc = NULL;
 
-       mlog_entry_void();
-
        cancel_delayed_work(&osb->la_enable_wq);
        flush_workqueue(ocfs2_wq);
 
@@ -482,8 +478,6 @@ out:
 
        if (alloc_copy)
                kfree(alloc_copy);
-
-       mlog_exit_void();
 }
 
 /*
@@ -502,7 +496,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,
        struct inode *inode = NULL;
        struct ocfs2_dinode *alloc;
 
-       mlog_entry("(slot_num = %d)\n", slot_num);
+       trace_ocfs2_begin_local_alloc_recovery(slot_num);
 
        *alloc_copy = NULL;
 
@@ -552,7 +546,8 @@ bail:
                iput(inode);
        }
 
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
@@ -570,8 +565,6 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb,
        struct buffer_head *main_bm_bh = NULL;
        struct inode *main_bm_inode;
 
-       mlog_entry_void();
-
        main_bm_inode = ocfs2_get_system_file_inode(osb,
                                                    GLOBAL_BITMAP_SYSTEM_INODE,
                                                    OCFS2_INVALID_SLOT);
@@ -620,7 +613,8 @@ out_mutex:
 out:
        if (!status)
                ocfs2_init_steal_slots(osb);
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
@@ -640,8 +634,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
        struct inode *local_alloc_inode;
        unsigned int free_bits;
 
-       mlog_entry_void();
-
        BUG_ON(!ac);
 
        local_alloc_inode =
@@ -712,10 +704,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
                        goto bail;
        }
 
-       if (ac->ac_max_block)
-               mlog(0, "Calling in_range for max block %llu\n",
-                    (unsigned long long)ac->ac_max_block);
-
        ac->ac_inode = local_alloc_inode;
        /* We should never use localalloc from another slot */
        ac->ac_alloc_slot = osb->slot_num;
@@ -729,10 +717,12 @@ bail:
                iput(local_alloc_inode);
        }
 
-       mlog(0, "bits=%d, slot=%d, ret=%d\n", bits_wanted, osb->slot_num,
-            status);
+       trace_ocfs2_reserve_local_alloc_bits(
+               (unsigned long long)ac->ac_max_block,
+               bits_wanted, osb->slot_num, status);
 
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
@@ -749,7 +739,6 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,
        struct ocfs2_dinode *alloc;
        struct ocfs2_local_alloc *la;
 
-       mlog_entry_void();
        BUG_ON(ac->ac_which != OCFS2_AC_USE_LOCAL);
 
        local_alloc_inode = ac->ac_inode;
@@ -788,7 +777,8 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,
        ocfs2_journal_dirty(handle, osb->local_alloc_bh);
 
 bail:
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
@@ -799,13 +789,11 @@ static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
        u32 count = 0;
        struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
 
-       mlog_entry_void();
-
        buffer = la->la_bitmap;
        for (i = 0; i < le16_to_cpu(la->la_size); i++)
                count += hweight8(buffer[i]);
 
-       mlog_exit(count);
+       trace_ocfs2_local_alloc_count_bits(count);
        return count;
 }
 
@@ -820,10 +808,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
        void *bitmap = NULL;
        struct ocfs2_reservation_map *resmap = &osb->osb_la_resmap;
 
-       mlog_entry("(numbits wanted = %u)\n", *numbits);
-
        if (!alloc->id1.bitmap1.i_total) {
-               mlog(0, "No bits in my window!\n");
                bitoff = -1;
                goto bail;
        }
@@ -883,8 +868,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
                }
        }
 
-       mlog(0, "Exiting loop, bitoff = %d, numfound = %d\n", bitoff,
-            numfound);
+       trace_ocfs2_local_alloc_find_clear_bits_search_bitmap(bitoff, numfound);
 
        if (numfound == *numbits)
                bitoff = startoff - numfound;
@@ -895,7 +879,10 @@ bail:
        if (local_resv)
                ocfs2_resv_discard(resmap, resv);
 
-       mlog_exit(bitoff);
+       trace_ocfs2_local_alloc_find_clear_bits(*numbits,
+               le32_to_cpu(alloc->id1.bitmap1.i_total),
+               bitoff, numfound);
+
        return bitoff;
 }
 
@@ -903,15 +890,12 @@ static void ocfs2_clear_local_alloc(struct ocfs2_dinode *alloc)
 {
        struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
        int i;
-       mlog_entry_void();
 
        alloc->id1.bitmap1.i_total = 0;
        alloc->id1.bitmap1.i_used = 0;
        la->la_bm_off = 0;
        for(i = 0; i < le16_to_cpu(la->la_size); i++)
                la->la_bitmap[i] = 0;
-
-       mlog_exit_void();
 }
 
 #if 0
@@ -952,18 +936,16 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
        void *bitmap;
        struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
 
-       mlog_entry("total = %u, used = %u\n",
-                  le32_to_cpu(alloc->id1.bitmap1.i_total),
-                  le32_to_cpu(alloc->id1.bitmap1.i_used));
+       trace_ocfs2_sync_local_to_main(
+            le32_to_cpu(alloc->id1.bitmap1.i_total),
+            le32_to_cpu(alloc->id1.bitmap1.i_used));
 
        if (!alloc->id1.bitmap1.i_total) {
-               mlog(0, "nothing to sync!\n");
                goto bail;
        }
 
        if (le32_to_cpu(alloc->id1.bitmap1.i_used) ==
            le32_to_cpu(alloc->id1.bitmap1.i_total)) {
-               mlog(0, "all bits were taken!\n");
                goto bail;
        }
 
@@ -985,8 +967,7 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
                                ocfs2_clusters_to_blocks(osb->sb,
                                                         start - count);
 
-                       mlog(0, "freeing %u bits starting at local alloc bit "
-                            "%u (la_start_blk = %llu, blkno = %llu)\n",
+                       trace_ocfs2_sync_local_to_main_free(
                             count, start - count,
                             (unsigned long long)la_start_blk,
                             (unsigned long long)blkno);
@@ -1007,7 +988,8 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
        }
 
 bail:
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
@@ -1132,7 +1114,8 @@ bail:
                *ac = NULL;
        }
 
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
@@ -1148,17 +1131,12 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
        struct ocfs2_dinode *alloc = NULL;
        struct ocfs2_local_alloc *la;
 
-       mlog_entry_void();
-
        alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
        la = OCFS2_LOCAL_ALLOC(alloc);
 
-       if (alloc->id1.bitmap1.i_total)
-               mlog(0, "asking me to alloc a new window over a non-empty "
-                    "one\n");
-
-       mlog(0, "Allocating %u clusters for a new window.\n",
-            osb->local_alloc_bits);
+       trace_ocfs2_local_alloc_new_window(
+               le32_to_cpu(alloc->id1.bitmap1.i_total),
+               osb->local_alloc_bits);
 
        /* Instruct the allocation code to try the most recently used
         * cluster group. We'll re-record the group used this pass
@@ -1220,13 +1198,13 @@ retry_enospc:
        ocfs2_resmap_restart(&osb->osb_la_resmap, cluster_count,
                             OCFS2_LOCAL_ALLOC(alloc)->la_bitmap);
 
-       mlog(0, "New window allocated:\n");
-       mlog(0, "window la_bm_off = %u\n",
-            OCFS2_LOCAL_ALLOC(alloc)->la_bm_off);
-       mlog(0, "window bits = %u\n", le32_to_cpu(alloc->id1.bitmap1.i_total));
+       trace_ocfs2_local_alloc_new_window_result(
+               OCFS2_LOCAL_ALLOC(alloc)->la_bm_off,
+               le32_to_cpu(alloc->id1.bitmap1.i_total));
 
 bail:
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
@@ -1243,8 +1221,6 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
        struct ocfs2_dinode *alloc_copy = NULL;
        struct ocfs2_alloc_context *ac = NULL;
 
-       mlog_entry_void();
-
        ocfs2_recalc_la_window(osb, OCFS2_LA_EVENT_SLIDE);
 
        /* This will lock the main bitmap for us. */
@@ -1324,7 +1300,8 @@ bail:
        if (ac)
                ocfs2_free_alloc_context(ac);
 
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
index b5cb3ede9408944d99abc7c7c3b28c01b1ddadeb..e57c804069ea6487c0a8eba6d203f88ccd8dd39a 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/fs.h>
 #include <linux/fcntl.h>
 
-#define MLOG_MASK_PREFIX ML_INODE
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
index 7e32db9c2c993b38e67f5d1282525f0a089b54b0..3e9393ca39ebd823772ae910cda1b4516d46fa62 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/signal.h>
 #include <linux/rbtree.h>
 
-#define MLOG_MASK_PREFIX ML_FILE_IO
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -42,6 +41,7 @@
 #include "inode.h"
 #include "mmap.h"
 #include "super.h"
+#include "ocfs2_trace.h"
 
 
 static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf)
@@ -49,13 +49,12 @@ static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf)
        sigset_t oldset;
        int ret;
 
-       mlog_entry("(area=%p, page offset=%lu)\n", area, vmf->pgoff);
-
        ocfs2_block_signals(&oldset);
        ret = filemap_fault(area, vmf);
        ocfs2_unblock_signals(&oldset);
 
-       mlog_exit_ptr(vmf->page);
+       trace_ocfs2_fault(OCFS2_I(area->vm_file->f_mapping->host)->ip_blkno,
+                         area, vmf->page, vmf->pgoff);
        return ret;
 }
 
index d6c25d76b537df58a92796b4258ccb2d83c523e2..28f2cc1080d8b16da36e4dee718d44f3690943c0 100644 (file)
@@ -42,7 +42,6 @@
 #include <linux/highmem.h>
 #include <linux/quotaops.h>
 
-#define MLOG_MASK_PREFIX ML_NAMEI
 #include <cluster/masklog.h>
 
 #include "ocfs2.h"
@@ -63,6 +62,7 @@
 #include "uptodate.h"
 #include "xattr.h"
 #include "acl.h"
+#include "ocfs2_trace.h"
 
 #include "buffer_head_io.h"
 
@@ -106,17 +106,15 @@ static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry,
        struct dentry *ret;
        struct ocfs2_inode_info *oi;
 
-       mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_lookup(dir, dentry, dentry->d_name.len,
+                          dentry->d_name.name,
+                          (unsigned long long)OCFS2_I(dir)->ip_blkno, 0);
 
        if (dentry->d_name.len > OCFS2_MAX_FILENAME_LEN) {
                ret = ERR_PTR(-ENAMETOOLONG);
                goto bail;
        }
 
-       mlog(0, "find name %.*s in directory %llu\n", dentry->d_name.len,
-            dentry->d_name.name, (unsigned long long)OCFS2_I(dir)->ip_blkno);
-
        status = ocfs2_inode_lock_nested(dir, NULL, 0, OI_LS_PARENT);
        if (status < 0) {
                if (status != -ENOENT)
@@ -182,7 +180,7 @@ bail_unlock:
 
 bail:
 
-       mlog_exit_ptr(ret);
+       trace_ocfs2_lookup_ret(ret);
 
        return ret;
 }
@@ -235,9 +233,9 @@ static int ocfs2_mknod(struct inode *dir,
        sigset_t oldset;
        int did_block_signals = 0;
 
-       mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, mode,
-                  (unsigned long)dev, dentry->d_name.len,
-                  dentry->d_name.name);
+       trace_ocfs2_mknod(dir, dentry, dentry->d_name.len, dentry->d_name.name,
+                         (unsigned long long)OCFS2_I(dir)->ip_blkno,
+                         (unsigned long)dev, mode);
 
        dquot_initialize(dir);
 
@@ -354,10 +352,6 @@ static int ocfs2_mknod(struct inode *dir,
                goto leave;
        did_quota_inode = 1;
 
-       mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry,
-                  inode->i_mode, (unsigned long)dev, dentry->d_name.len,
-                  dentry->d_name.name);
-
        /* do the real work now. */
        status = ocfs2_mknod_locked(osb, dir, inode, dev,
                                    &new_fe_bh, parent_fe_bh, handle,
@@ -436,9 +430,6 @@ leave:
        if (did_block_signals)
                ocfs2_unblock_signals(&oldset);
 
-       if (status == -ENOSPC)
-               mlog(0, "Disk is full\n");
-
        brelse(new_fe_bh);
        brelse(parent_fe_bh);
        kfree(si.name);
@@ -466,7 +457,8 @@ leave:
                iput(inode);
        }
 
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
 
        return status;
 }
@@ -577,7 +569,8 @@ leave:
                }
        }
 
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
@@ -615,10 +608,11 @@ static int ocfs2_mkdir(struct inode *dir,
 {
        int ret;
 
-       mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, mode,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_mkdir(dir, dentry, dentry->d_name.len, dentry->d_name.name,
+                         OCFS2_I(dir)->ip_blkno, mode);
        ret = ocfs2_mknod(dir, dentry, mode | S_IFDIR, 0);
-       mlog_exit(ret);
+       if (ret)
+               mlog_errno(ret);
 
        return ret;
 }
@@ -630,10 +624,11 @@ static int ocfs2_create(struct inode *dir,
 {
        int ret;
 
-       mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, mode,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_create(dir, dentry, dentry->d_name.len, dentry->d_name.name,
+                          (unsigned long long)OCFS2_I(dir)->ip_blkno, mode);
        ret = ocfs2_mknod(dir, dentry, mode | S_IFREG, 0);
-       mlog_exit(ret);
+       if (ret)
+               mlog_errno(ret);
 
        return ret;
 }
@@ -652,9 +647,9 @@ static int ocfs2_link(struct dentry *old_dentry,
        struct ocfs2_dir_lookup_result lookup = { NULL, };
        sigset_t oldset;
 
-       mlog_entry("(inode=%lu, old='%.*s' new='%.*s')\n", inode->i_ino,
-                  old_dentry->d_name.len, old_dentry->d_name.name,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_link((unsigned long long)OCFS2_I(inode)->ip_blkno,
+                        old_dentry->d_name.len, old_dentry->d_name.name,
+                        dentry->d_name.len, dentry->d_name.name);
 
        if (S_ISDIR(inode->i_mode))
                return -EPERM;
@@ -757,7 +752,8 @@ out:
 
        ocfs2_free_dir_lookup_result(&lookup);
 
-       mlog_exit(err);
+       if (err)
+               mlog_errno(err);
 
        return err;
 }
@@ -809,19 +805,17 @@ static int ocfs2_unlink(struct inode *dir,
        struct ocfs2_dir_lookup_result lookup = { NULL, };
        struct ocfs2_dir_lookup_result orphan_insert = { NULL, };
 
-       mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry,
-                  dentry->d_name.len, dentry->d_name.name);
+       trace_ocfs2_unlink(dir, dentry, dentry->d_name.len,
+                          dentry->d_name.name,
+                          (unsigned long long)OCFS2_I(dir)->ip_blkno,
+                          (unsigned long long)OCFS2_I(inode)->ip_blkno);
 
        dquot_initialize(dir);
 
        BUG_ON(dentry->d_parent->d_inode != dir);
 
-       mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno);
-
-       if (inode == osb->root_inode) {
-               mlog(0, "Cannot delete the root directory\n");
+       if (inode == osb->root_inode)
                return -EPERM;
-       }
 
        status = ocfs2_inode_lock_nested(dir, &parent_node_bh, 1,
                                         OI_LS_PARENT);
@@ -843,9 +837,10 @@ static int ocfs2_unlink(struct inode *dir,
        if (OCFS2_I(inode)->ip_blkno != blkno) {
                status = -ENOENT;
 
-               mlog(0, "ip_blkno %llu != dirent blkno %llu ip_flags = %x\n",
-                    (unsigned long long)OCFS2_I(inode)->ip_blkno,
-                    (unsigned long long)blkno, OCFS2_I(inode)->ip_flags);
+               trace_ocfs2_unlink_noent(
+                               (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                               (unsigned long long)blkno,
+                               OCFS2_I(inode)->ip_flags);
                goto leave;
        }
 
@@ -954,7 +949,8 @@ leave:
        ocfs2_free_dir_lookup_result(&orphan_insert);
        ocfs2_free_dir_lookup_result(&lookup);
 
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
 
        return status;
 }
@@ -975,9 +971,8 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
        struct buffer_head **tmpbh;
        struct inode *tmpinode;
 
-       mlog_entry("(inode1 = %llu, inode2 = %llu)\n",
-                  (unsigned long long)oi1->ip_blkno,
-                  (unsigned long long)oi2->ip_blkno);
+       trace_ocfs2_double_lock((unsigned long long)oi1->ip_blkno,
+                               (unsigned long long)oi2->ip_blkno);
 
        if (*bh1)
                *bh1 = NULL;
@@ -988,7 +983,6 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
        if (oi1->ip_blkno != oi2->ip_blkno) {
                if (oi1->ip_blkno < oi2->ip_blkno) {
                        /* switch id1 and id2 around */
-                       mlog(0, "switching them around...\n");
                        tmpbh = bh2;
                        bh2 = bh1;
                        bh1 = tmpbh;
@@ -1024,8 +1018,13 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
                        mlog_errno(status);
        }
 
+       trace_ocfs2_double_lock_end(
+                       (unsigned long long)OCFS2_I(inode1)->ip_blkno,
+                       (unsigned long long)OCFS2_I(inode2)->ip_blkno);
+
 bail:
-       mlog_exit(status);
+       if (status)
+               mlog_errno(status);
        return status;
 }
 
@@ -1067,10 +1066,9 @@ static int ocfs2_rename(struct inode *old_dir,
        /* At some point it might be nice to break this function up a
         * bit. */
 
-       mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p, from='%.*s' to='%.*s')\n",
-                  old_dir, old_dentry, new_dir, new_dentry,
-                  old_dentry->d_name.len, old_dentry->d_name.name,
-                  new_dentry->d_name.len, new_dentry->d_name.name);
+       trace_ocfs2_rename(old_dir, old_dentry, new_dir, new_dentry,
+                          old_dentry->d_name.len, old_dentry->d_name.name,
+                          new_dentry->d_name.len, new_dentry->d_name.name);
 
        dquot_initialize(old_dir);
        dquot_initialize(new_dir);
@@ -1227,16 +1225,15 @@ static int ocfs2_rename(struct inode *old_dir,
                if (!new_inode) {
                        status = -EACCES;
 
-                       mlog(0, "We found an inode for name %.*s but VFS "
-                            "didn't give us one.\n", new_dentry->d_name.len,
-                            new_dentry->d_name.name);
+                       trace_ocfs2_rename_target_exists(new_dentry->d_name.len,
+                                               new_dentry->d_name.name);
                        goto bail;
                }
 
                if (OCFS2_I(new_inode)->ip_blkno != newfe_blkno) {
                        status = -EACCES;
 
-                       mlog(0, "Inode %llu and dir %llu disagree. flags = %x\n",
+                       trace_ocfs2_rename_disagree(
                             (unsigned long long)OCFS2_I(new_inode)->ip_blkno,
                             (unsigned long long)newfe_blkno,
                             OCFS2_I(new_inode)->ip_flags);
@@ -1259,8 +1256,7 @@ static int ocfs2_rename(struct inode *old_dir,
 
                newfe = (struct ocfs2_dinode *) newfe_bh->b_data;
 
-               mlog(0, "aha rename over existing... new_blkno=%llu "
-                    "newfebh=%p bhblocknr=%llu\n",
+               trace_ocfs2_rename_over_existing(
                     (unsigned long long)newfe_blkno, newfe_bh, newfe_bh ?
                     (unsigned long long)newfe_bh->b_blocknr : 0ULL);
 
@@ -1476,7 +1472,8 @@ bail:
  &n