4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2012, 2014, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
31 * lustre/include/lustre_log_user.h
33 * Userspace-usable portion of Generic infrastructure for managing
34 * a collection of logs.
35 * See lustre_log.h for more details.
38 #ifndef _LUSTRE_LOG_USER_H
39 #define _LUSTRE_LOG_USER_H
41 #include <uapi/linux/lustre_fid.h>
43 /* Lustre logs use FIDs constructed from oi_id and oi_seq directly,
44 * without attempting to use the IGIF and IDIF ranges as is done
45 * elsewhere, because of compatibility concerns (see lu-2888).
48 static inline void logid_to_fid(struct llog_logid *id, struct lu_fid *fid)
50 /* For compatibility purposes we identify pre-OSD (~< 2.3.51 MDS)
51 * logid's by non-zero ogen (inode generation) and convert them
53 if (id->lgl_ogen == 0) {
54 fid->f_seq = id->lgl_oi.oi.oi_seq;
55 fid->f_oid = id->lgl_oi.oi.oi_id;
58 lu_igif_build(fid, id->lgl_oi.oi.oi_id, id->lgl_ogen);
62 static inline void fid_to_logid(struct lu_fid *fid, struct llog_logid *id)
64 id->lgl_oi.oi.oi_seq = fid->f_seq;
65 id->lgl_oi.oi.oi_id = fid->f_oid;
69 static inline void logid_set_id(struct llog_logid *log_id, __u64 id)
71 log_id->lgl_oi.oi.oi_id = id;
74 static inline __u64 logid_id(struct llog_logid *log_id)
76 return log_id->lgl_oi.oi.oi_id;
79 #endif /* ifndef _LUSTRE_LOG_USER_H */