136a580ebSKoji Sato /* 236a580ebSKoji Sato * direct.h - NILFS direct block pointer. 336a580ebSKoji Sato * 436a580ebSKoji Sato * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. 536a580ebSKoji Sato * 636a580ebSKoji Sato * This program is free software; you can redistribute it and/or modify 736a580ebSKoji Sato * it under the terms of the GNU General Public License as published by 836a580ebSKoji Sato * the Free Software Foundation; either version 2 of the License, or 936a580ebSKoji Sato * (at your option) any later version. 1036a580ebSKoji Sato * 1136a580ebSKoji Sato * This program is distributed in the hope that it will be useful, 1236a580ebSKoji Sato * but WITHOUT ANY WARRANTY; without even the implied warranty of 1336a580ebSKoji Sato * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1436a580ebSKoji Sato * GNU General Public License for more details. 1536a580ebSKoji Sato * 1636a580ebSKoji Sato * You should have received a copy of the GNU General Public License 1736a580ebSKoji Sato * along with this program; if not, write to the Free Software 1836a580ebSKoji Sato * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 1936a580ebSKoji Sato * 2036a580ebSKoji Sato * Written by Koji Sato <koji@osrg.net>. 2136a580ebSKoji Sato */ 2236a580ebSKoji Sato 2336a580ebSKoji Sato #ifndef _NILFS_DIRECT_H 2436a580ebSKoji Sato #define _NILFS_DIRECT_H 2536a580ebSKoji Sato 2636a580ebSKoji Sato #include <linux/types.h> 2736a580ebSKoji Sato #include <linux/buffer_head.h> 2836a580ebSKoji Sato #include "bmap.h" 2936a580ebSKoji Sato 3036a580ebSKoji Sato 3136a580ebSKoji Sato struct nilfs_direct; 3236a580ebSKoji Sato 3336a580ebSKoji Sato /** 3436a580ebSKoji Sato * struct nilfs_direct_operations - direct mapping operation table 3536a580ebSKoji Sato */ 3636a580ebSKoji Sato struct nilfs_direct_operations { 3736a580ebSKoji Sato __u64 (*dop_find_target)(const struct nilfs_direct *, __u64); 3836a580ebSKoji Sato void (*dop_set_target)(struct nilfs_direct *, __u64, __u64); 3936a580ebSKoji Sato int (*dop_propagate)(struct nilfs_direct *, struct buffer_head *); 4036a580ebSKoji Sato int (*dop_assign)(struct nilfs_direct *, __u64, __u64, 4136a580ebSKoji Sato struct buffer_head **, sector_t, 4236a580ebSKoji Sato union nilfs_binfo *); 4336a580ebSKoji Sato }; 4436a580ebSKoji Sato 4536a580ebSKoji Sato /** 4636a580ebSKoji Sato * struct nilfs_direct_node - direct node 4736a580ebSKoji Sato * @dn_flags: flags 4836a580ebSKoji Sato * @dn_pad: padding 4936a580ebSKoji Sato */ 5036a580ebSKoji Sato struct nilfs_direct_node { 5136a580ebSKoji Sato __u8 dn_flags; 5236a580ebSKoji Sato __u8 pad[7]; 5336a580ebSKoji Sato }; 5436a580ebSKoji Sato 5536a580ebSKoji Sato /** 5636a580ebSKoji Sato * struct nilfs_direct - direct mapping 5736a580ebSKoji Sato * @d_bmap: bmap structure 5836a580ebSKoji Sato * @d_ops: direct mapping operation table 5936a580ebSKoji Sato */ 6036a580ebSKoji Sato struct nilfs_direct { 6136a580ebSKoji Sato struct nilfs_bmap d_bmap; 6236a580ebSKoji Sato 6336a580ebSKoji Sato /* direct-mapping-specific members */ 6436a580ebSKoji Sato const struct nilfs_direct_operations *d_ops; 6536a580ebSKoji Sato }; 6636a580ebSKoji Sato 6736a580ebSKoji Sato 6836a580ebSKoji Sato #define NILFS_DIRECT_NBLOCKS (NILFS_BMAP_SIZE / sizeof(__le64) - 1) 6936a580ebSKoji Sato #define NILFS_DIRECT_KEY_MIN 0 7036a580ebSKoji Sato #define NILFS_DIRECT_KEY_MAX (NILFS_DIRECT_NBLOCKS - 1) 7136a580ebSKoji Sato 7236a580ebSKoji Sato 73*3033342aSRyusuke Konishi int nilfs_direct_init(struct nilfs_bmap *); 7436a580ebSKoji Sato int nilfs_direct_delete_and_convert(struct nilfs_bmap *, __u64, __u64 *, 75*3033342aSRyusuke Konishi __u64 *, int); 7636a580ebSKoji Sato 7736a580ebSKoji Sato 7836a580ebSKoji Sato #endif /* _NILFS_DIRECT_H */ 79