~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to fs/ocfs2/aops.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <linux/mpage.h>
30
30
#include <linux/quotaops.h>
31
31
 
32
 
#define MLOG_MASK_PREFIX ML_FILE_IO
33
32
#include <cluster/masklog.h>
34
33
 
35
34
#include "ocfs2.h"
45
44
#include "super.h"
46
45
#include "symlink.h"
47
46
#include "refcounttree.h"
 
47
#include "ocfs2_trace.h"
48
48
 
49
49
#include "buffer_head_io.h"
50
50
 
59
59
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
60
60
        void *kaddr;
61
61
 
62
 
        mlog_entry("(0x%p, %llu, 0x%p, %d)\n", inode,
63
 
                   (unsigned long long)iblock, bh_result, create);
 
62
        trace_ocfs2_symlink_get_block(
 
63
                        (unsigned long long)OCFS2_I(inode)->ip_blkno,
 
64
                        (unsigned long long)iblock, bh_result, create);
64
65
 
65
66
        BUG_ON(ocfs2_inode_is_fast_symlink(inode));
66
67
 
123
124
bail:
124
125
        brelse(bh);
125
126
 
126
 
        mlog_exit(err);
127
127
        return err;
128
128
}
129
129
 
136
136
        u64 p_blkno, count, past_eof;
137
137
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
138
138
 
139
 
        mlog_entry("(0x%p, %llu, 0x%p, %d)\n", inode,
140
 
                   (unsigned long long)iblock, bh_result, create);
 
139
        trace_ocfs2_get_block((unsigned long long)OCFS2_I(inode)->ip_blkno,
 
140
                              (unsigned long long)iblock, bh_result, create);
141
141
 
142
142
        if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE)
143
143
                mlog(ML_NOTICE, "get_block on system inode 0x%p (%lu)\n",
199
199
        }
200
200
 
201
201
        past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode));
202
 
        mlog(0, "Inode %lu, past_eof = %llu\n", inode->i_ino,
203
 
             (unsigned long long)past_eof);
 
202
 
 
203
        trace_ocfs2_get_block_end((unsigned long long)OCFS2_I(inode)->ip_blkno,
 
204
                                  (unsigned long long)past_eof);
204
205
        if (create && (iblock >= past_eof))
205
206
                set_buffer_new(bh_result);
206
207
 
208
209
        if (err < 0)
209
210
                err = -EIO;
210
211
 
211
 
        mlog_exit(err);
212
212
        return err;
213
213
}
214
214
 
278
278
        loff_t start = (loff_t)page->index << PAGE_CACHE_SHIFT;
279
279
        int ret, unlock = 1;
280
280
 
281
 
        mlog_entry("(0x%p, %lu)\n", file, (page ? page->index : 0));
 
281
        trace_ocfs2_readpage((unsigned long long)oi->ip_blkno,
 
282
                             (page ? page->index : 0));
282
283
 
283
284
        ret = ocfs2_inode_lock_with_page(inode, NULL, 0, page);
284
285
        if (ret != 0) {
323
324
out:
324
325
        if (unlock)
325
326
                unlock_page(page);
326
 
        mlog_exit(ret);
327
327
        return ret;
328
328
}
329
329
 
396
396
 */
397
397
static int ocfs2_writepage(struct page *page, struct writeback_control *wbc)
398
398
{
399
 
        int ret;
400
 
 
401
 
        mlog_entry("(0x%p)\n", page);
402
 
 
403
 
        ret = block_write_full_page(page, ocfs2_get_block, wbc);
404
 
 
405
 
        mlog_exit(ret);
406
 
 
407
 
        return ret;
 
399
        trace_ocfs2_writepage(
 
400
                (unsigned long long)OCFS2_I(page->mapping->host)->ip_blkno,
 
401
                page->index);
 
402
 
 
403
        return block_write_full_page(page, ocfs2_get_block, wbc);
408
404
}
409
405
 
410
406
/* Taken from ext3. We don't necessarily need the full blown
450
446
        int err = 0;
451
447
        struct inode *inode = mapping->host;
452
448
 
453
 
        mlog_entry("(block = %llu)\n", (unsigned long long)block);
 
449
        trace_ocfs2_bmap((unsigned long long)OCFS2_I(inode)->ip_blkno,
 
450
                         (unsigned long long)block);
454
451
 
455
452
        /* We don't need to lock journal system files, since they aren't
456
453
         * accessed concurrently from multiple nodes.
484
481
bail:
485
482
        status = err ? 0 : p_blkno;
486
483
 
487
 
        mlog_exit((int)status);
488
 
 
489
484
        return status;
490
485
}
491
486
 
616
611
{
617
612
        struct file *file = iocb->ki_filp;
618
613
        struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
619
 
        int ret;
620
 
 
621
 
        mlog_entry_void();
622
614
 
623
615
        /*
624
616
         * Fallback to buffered I/O if we see an inode without
631
623
        if (i_size_read(inode) <= offset)
632
624
                return 0;
633
625
 
634
 
        ret = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
635
 
                                   iov, offset, nr_segs,
636
 
                                   ocfs2_direct_IO_get_blocks,
637
 
                                   ocfs2_dio_end_io, NULL, 0);
638
 
 
639
 
        mlog_exit(ret);
640
 
        return ret;
 
626
        return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
 
627
                                    iov, offset, nr_segs,
 
628
                                    ocfs2_direct_IO_get_blocks,
 
629
                                    ocfs2_dio_end_io, NULL, 0);
641
630
}
642
631
 
643
632
static void ocfs2_figure_cluster_boundaries(struct ocfs2_super *osb,
1540
1529
        struct ocfs2_inode_info *oi = OCFS2_I(inode);
1541
1530
        struct ocfs2_dinode *di = NULL;
1542
1531
 
1543
 
        mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n",
1544
 
             (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos,
1545
 
             oi->ip_dyn_features);
 
1532
        trace_ocfs2_try_to_write_inline_data((unsigned long long)oi->ip_blkno,
 
1533
                                             len, (unsigned long long)pos,
 
1534
                                             oi->ip_dyn_features);
1546
1535
 
1547
1536
        /*
1548
1537
         * Handle inodes which already have inline data 1st.
1745
1734
 
1746
1735
        di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
1747
1736
 
 
1737
        trace_ocfs2_write_begin_nolock(
 
1738
                        (unsigned long long)OCFS2_I(inode)->ip_blkno,
 
1739
                        (long long)i_size_read(inode),
 
1740
                        le32_to_cpu(di->i_clusters),
 
1741
                        pos, len, flags, mmap_page,
 
1742
                        clusters_to_alloc, extents_to_split);
 
1743
 
1748
1744
        /*
1749
1745
         * We set w_target_from, w_target_to here so that
1750
1746
         * ocfs2_write_end() knows which range in the target page to
1757
1753
                 * ocfs2_lock_allocators(). It greatly over-estimates
1758
1754
                 * the work to be done.
1759
1755
                 */
1760
 
                mlog(0, "extend inode %llu, i_size = %lld, di->i_clusters = %u,"
1761
 
                     " clusters_to_add = %u, extents_to_split = %u\n",
1762
 
                     (unsigned long long)OCFS2_I(inode)->ip_blkno,
1763
 
                     (long long)i_size_read(inode), le32_to_cpu(di->i_clusters),
1764
 
                     clusters_to_alloc, extents_to_split);
1765
 
 
1766
1756
                ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode),
1767
1757
                                              wc->w_di_bh);
1768
1758
                ret = ocfs2_lock_allocators(inode, &et,
1944
1934
        memcpy(di->id2.i_data.id_data + pos, kaddr + pos, *copied);
1945
1935
        kunmap_atomic(kaddr, KM_USER0);
1946
1936
 
1947
 
        mlog(0, "Data written to inode at offset %llu. "
1948
 
             "id_count = %u, copied = %u, i_dyn_features = 0x%x\n",
 
1937
        trace_ocfs2_write_end_inline(
 
1938
             (unsigned long long)OCFS2_I(inode)->ip_blkno,
1949
1939
             (unsigned long long)pos, *copied,
1950
1940
             le16_to_cpu(di->id2.i_data.id_count),
1951
1941
             le16_to_cpu(di->i_dyn_features));
2049
2039
        .write_begin            = ocfs2_write_begin,
2050
2040
        .write_end              = ocfs2_write_end,
2051
2041
        .bmap                   = ocfs2_bmap,
2052
 
        .sync_page              = block_sync_page,
2053
2042
        .direct_IO              = ocfs2_direct_IO,
2054
2043
        .invalidatepage         = ocfs2_invalidatepage,
2055
2044
        .releasepage            = ocfs2_releasepage,