mdio: Add 10GBASE-T SNR register definition
[linux-2.6/verdex.git] / fs / nilfs2 / seglist.h
blobd39df9144e994b231852be475b346741b3bcf310
1 /*
2 * seglist.h - expediential structure and routines to handle list of segments
3 * (would be removed in a future release)
5 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 * Written by Ryusuke Konishi <ryusuke@osrg.net>
24 #ifndef _NILFS_SEGLIST_H
25 #define _NILFS_SEGLIST_H
27 #include <linux/fs.h>
28 #include <linux/buffer_head.h>
29 #include <linux/nilfs2_fs.h>
30 #include "sufile.h"
32 struct nilfs_segment_entry {
33 __u64 segnum;
35 #define NILFS_SLH_FREED 0x0001 /* The segment was freed provisonally.
36 It must be cancelled if
37 construction aborted */
39 unsigned flags;
40 struct list_head list;
41 struct buffer_head *bh_su;
42 struct nilfs_segment_usage *raw_su;
46 void nilfs_dispose_segment_list(struct list_head *);
48 static inline struct nilfs_segment_entry *
49 nilfs_alloc_segment_entry(__u64 segnum)
51 struct nilfs_segment_entry *ent = kmalloc(sizeof(*ent), GFP_NOFS);
53 if (likely(ent)) {
54 ent->segnum = segnum;
55 ent->flags = 0;
56 ent->bh_su = NULL;
57 ent->raw_su = NULL;
58 INIT_LIST_HEAD(&ent->list);
60 return ent;
63 static inline int nilfs_open_segment_entry(struct nilfs_segment_entry *ent,
64 struct inode *sufile)
66 return nilfs_sufile_get_segment_usage(sufile, ent->segnum,
67 &ent->raw_su, &ent->bh_su);
70 static inline void nilfs_close_segment_entry(struct nilfs_segment_entry *ent,
71 struct inode *sufile)
73 if (!ent->bh_su)
74 return;
75 nilfs_sufile_put_segment_usage(sufile, ent->segnum, ent->bh_su);
76 ent->bh_su = NULL;
77 ent->raw_su = NULL;
80 static inline void nilfs_free_segment_entry(struct nilfs_segment_entry *ent)
82 kfree(ent);
85 #endif /* _NILFS_SEGLIST_H */