X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fliblustre%2Ffile.c;h=35bc6d9b2cf67bf3e2ff4d995aa58458e2703377;hb=6be01be8325fe9f2e579835757b2dd9922bdd693;hp=4810ef3a7c3952cff34699e004c912772a0c8464;hpb=6e3ec5812ebd1b5ecf7cae584f429b013ffe7431;p=fs%2Flustre-release.git diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index 4810ef3..35bc6d9 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -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. @@ -26,8 +24,10 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -49,17 +49,6 @@ #include #include -#include -#ifdef HAVE_XTIO_H -#include -#endif -#include -#include -#include -#ifdef HAVE_FILE_H -#include -#endif - #include "llite_lib.h" /* Pack the required supplementary groups into the supplied groups array. @@ -114,11 +103,6 @@ void llu_prep_md_op_data(struct md_op_data *op_data, struct inode *i1, op_data->op_data = NULL; } -void llu_finish_md_op_data(struct md_op_data *op_data) -{ - OBD_FREE_PTR(op_data); -} - void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid) @@ -135,16 +119,10 @@ void obdo_refresh_inode(struct inode *dst, if (valid & OBD_MD_FLATIME && src->o_atime > LTIME_S(st->st_atime)) LTIME_S(st->st_atime) = src->o_atime; - - /* mtime is always updated with ctime, but can be set in past. - As write and utime(2) may happen within 1 second, and utime's - mtime has a priority over write's one, leave mtime from mds - for the same ctimes. */ - if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(st->st_ctime)) { + if (valid & OBD_MD_FLMTIME && src->o_mtime > LTIME_S(st->st_mtime)) + LTIME_S(st->st_mtime) = src->o_mtime; + if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(st->st_ctime)) LTIME_S(st->st_ctime) = src->o_ctime; - if (valid & OBD_MD_FLMTIME) - LTIME_S(st->st_mtime) = src->o_mtime; - } if (valid & OBD_MD_FLSIZE && src->o_size > st->st_size) st->st_size = src->o_size; /* optimum IO size */ @@ -206,10 +184,8 @@ int llu_iop_open(struct pnode *pnode, int flags, mode_t mode) struct inode *inode = pnode->p_base->pb_ino; struct llu_inode_info *lli = llu_i2info(inode); struct intnl_stat *st = llu_i2stat(inode); - struct ll_file_data *fd; struct ptlrpc_request *request; struct lookup_intent *it; - struct lov_stripe_md *lsm; int rc = 0; ENTRY; @@ -237,10 +213,7 @@ int llu_iop_open(struct pnode *pnode, int flags, mode_t mode) if (!S_ISREG(st->st_mode)) GOTO(out_release, rc = 0); - fd = lli->lli_file_data; - - lsm = lli->lli_smd; - if (lsm) + if (lli->lli_has_smd) flags &= ~O_LOV_DELAY_CREATE; /*XXX: open_flags are overwritten and the previous ones are lost */ lli->lli_open_flags = flags & ~(O_CREAT | O_EXCL | O_TRUNC); @@ -310,10 +283,10 @@ int llu_objects_destroy(struct ptlrpc_request *req, struct inode *dir) GOTO(out_free_memmd, rc = -ENOMEM); oa->o_id = lsm->lsm_object_id; - oa->o_gr = lsm->lsm_object_gr; + oa->o_seq = lsm->lsm_object_seq; oa->o_mode = body->mode & S_IFMT; oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLGROUP; - + obdo_set_parent_fid(oa, &llu_i2info(dir)->lli_fid); if (body->valid & OBD_MD_FLCOOKIE) { oa->o_valid |= OBD_MD_FLCOOKIE; oti.oti_logcookies = @@ -327,7 +300,7 @@ int llu_objects_destroy(struct ptlrpc_request *req, struct inode *dir) } } - rc = obd_destroy(llu_i2obdexp(dir), oa, lsm, &oti, NULL, NULL); + rc = obd_destroy(NULL, llu_i2obdexp(dir), oa, lsm, &oti, NULL, NULL); OBDO_FREE(oa); if (rc) CERROR("obd destroy objid 0x"LPX64" error %d\n", @@ -360,10 +333,7 @@ int llu_som_update(struct inode *inode, struct md_op_data *op_data) old_flags & MF_GETATTR_LOCK); if (rc) { oa.o_valid = 0; - if (rc == -ENOENT) - CDEBUG(D_INODE, "objid "LPX64" is destroyed\n", - lli->lli_smd->lsm_object_id); - else + if (rc != -ENOENT) CERROR("inode_getattr failed (%d): unable to " "send a Size-on-MDS attribute update " "for inode %llu/%lu\n", rc,