1ccd979bdSMark Fasheh /* -*- mode: c; c-basic-offset: 8; -*- 2ccd979bdSMark Fasheh * vim: noexpandtab sw=8 ts=8 sts=0: 3ccd979bdSMark Fasheh * 4ccd979bdSMark Fasheh * ocfs2_buffer_head.h 5ccd979bdSMark Fasheh * 6ccd979bdSMark Fasheh * Buffer cache handling functions defined 7ccd979bdSMark Fasheh * 8ccd979bdSMark Fasheh * Copyright (C) 2002, 2004 Oracle. All rights reserved. 9ccd979bdSMark Fasheh * 10ccd979bdSMark Fasheh * This program is free software; you can redistribute it and/or 11ccd979bdSMark Fasheh * modify it under the terms of the GNU General Public 12ccd979bdSMark Fasheh * License as published by the Free Software Foundation; either 13ccd979bdSMark Fasheh * version 2 of the License, or (at your option) any later version. 14ccd979bdSMark Fasheh * 15ccd979bdSMark Fasheh * This program is distributed in the hope that it will be useful, 16ccd979bdSMark Fasheh * but WITHOUT ANY WARRANTY; without even the implied warranty of 17ccd979bdSMark Fasheh * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18ccd979bdSMark Fasheh * General Public License for more details. 19ccd979bdSMark Fasheh * 20ccd979bdSMark Fasheh * You should have received a copy of the GNU General Public 21ccd979bdSMark Fasheh * License along with this program; if not, write to the 22ccd979bdSMark Fasheh * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 23ccd979bdSMark Fasheh * Boston, MA 021110-1307, USA. 24ccd979bdSMark Fasheh */ 25ccd979bdSMark Fasheh 26ccd979bdSMark Fasheh #ifndef OCFS2_BUFFER_HEAD_IO_H 27ccd979bdSMark Fasheh #define OCFS2_BUFFER_HEAD_IO_H 28ccd979bdSMark Fasheh 29ccd979bdSMark Fasheh #include <linux/buffer_head.h> 30ccd979bdSMark Fasheh 31ccd979bdSMark Fasheh void ocfs2_end_buffer_io_sync(struct buffer_head *bh, 32ccd979bdSMark Fasheh int uptodate); 33ccd979bdSMark Fasheh 3431d33073SJoel Becker static inline int ocfs2_read_block(struct inode *inode, 35ccd979bdSMark Fasheh u64 off, 360fcaa56aSJoel Becker struct buffer_head **bh); 37ccd979bdSMark Fasheh 38ccd979bdSMark Fasheh int ocfs2_write_block(struct ocfs2_super *osb, 39ccd979bdSMark Fasheh struct buffer_head *bh, 40ccd979bdSMark Fasheh struct inode *inode); 4131d33073SJoel Becker int ocfs2_read_blocks(struct inode *inode, 42ccd979bdSMark Fasheh u64 block, 43ccd979bdSMark Fasheh int nr, 44ccd979bdSMark Fasheh struct buffer_head *bhs[], 4531d33073SJoel Becker int flags); 46da1e9098SJoel Becker int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block, 47da1e9098SJoel Becker unsigned int nr, struct buffer_head *bhs[]); 48ccd979bdSMark Fasheh 49d659072fSTao Ma int ocfs2_write_super_or_backup(struct ocfs2_super *osb, 50d659072fSTao Ma struct buffer_head *bh); 51ccd979bdSMark Fasheh 52*d4a8c93cSJoel Becker #define OCFS2_BH_IGNORE_CACHE 1 53aa958874SMark Fasheh #define OCFS2_BH_READAHEAD 8 54ccd979bdSMark Fasheh 5531d33073SJoel Becker static inline int ocfs2_read_block(struct inode *inode, u64 off, 560fcaa56aSJoel Becker struct buffer_head **bh) 57ccd979bdSMark Fasheh { 58ccd979bdSMark Fasheh int status = 0; 59ccd979bdSMark Fasheh 60ccd979bdSMark Fasheh if (bh == NULL) { 61ccd979bdSMark Fasheh printk("ocfs2: bh == NULL\n"); 62ccd979bdSMark Fasheh status = -EINVAL; 63ccd979bdSMark Fasheh goto bail; 64ccd979bdSMark Fasheh } 65ccd979bdSMark Fasheh 66*d4a8c93cSJoel Becker status = ocfs2_read_blocks(inode, off, 1, bh, 0); 67ccd979bdSMark Fasheh 68ccd979bdSMark Fasheh bail: 69ccd979bdSMark Fasheh return status; 70ccd979bdSMark Fasheh } 71ccd979bdSMark Fasheh 72ccd979bdSMark Fasheh #endif /* OCFS2_BUFFER_HEAD_IO_H */ 73