Whamcloud - gitweb
LU-2110 mount: do not start osp twice
[fs/lustre-release.git] / lustre / obdclass / obdo.c
index 9da2405..e9c0b6c 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +26,8 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -41,9 +41,6 @@
  */
 
 #define DEBUG_SUBSYSTEM S_CLASS
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
 
 #ifndef __KERNEL__
 #include "../liblustre/llite_lib.h"
 #include <lustre/lustre_idl.h>
 #endif
 
-static void obdo_set_parent_fid(struct obdo *dst, struct lu_fid *parent)
+void obdo_set_parent_fid(struct obdo *dst, const struct lu_fid *parent)
 {
         dst->o_parent_oid = fid_oid(parent);
         dst->o_parent_seq = fid_seq(parent);
         dst->o_parent_ver = fid_ver(parent);
         dst->o_valid |= OBD_MD_FLGENER | OBD_MD_FLFID;
 }
+EXPORT_SYMBOL(obdo_set_parent_fid);
 
 /* WARNING: the file systems must take care not to tinker with
    attributes they don't manage (such as blocks). */
-void obdo_from_inode(struct obdo *dst, struct inode *src, struct lu_fid *parent,
-                     obd_flag valid)
+void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid)
 {
         obd_flag newvalid = 0;
 
@@ -85,7 +82,7 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, struct lu_fid *parent,
                 newvalid |= OBD_MD_FLCTIME;
         }
         if (valid & OBD_MD_FLSIZE) {
-                dst->o_size = src->i_size;
+                dst->o_size = i_size_read(src);
                 newvalid |= OBD_MD_FLSIZE;
         }
         if (valid & OBD_MD_FLBLOCKS) {  /* allocation of space (x512 bytes) */
@@ -118,8 +115,6 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, struct lu_fid *parent,
                 dst->o_flags = ll_inode_flags(src);
                 newvalid |= OBD_MD_FLFLAGS;
         }
-        if (parent)
-                obdo_set_parent_fid(dst, parent);
         dst->o_valid |= newvalid;
 }
 EXPORT_SYMBOL(obdo_from_inode);