]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros
[mirror_ubuntu-artful-kernel.git] / drivers / staging / lustre / lustre / obdclass / linux / linux-obdo.c
CommitLineData
d7e09d03
PT
1/*
2 * GPL HEADER START
3 *
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
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.
9 *
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).
15 *
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.sun.com/software/products/lustre/docs/GPLv2.pdf
19 *
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
22 * have any questions.
23 *
24 * GPL HEADER END
25 */
26/*
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
29 *
30 * Copyright (c) 2011, 2012, Intel Corporation.
31 */
32/*
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
35 *
36 * lustre/obdclass/linux/linux-obdo.c
37 *
38 * Object Devices Class Driver
39 * These are the only exported functions, they provide some generic
40 * infrastructure for managing object devices
41 */
42
43#define DEBUG_SUBSYSTEM S_CLASS
44
45#include <linux/module.h>
610f7377
GKH
46#include "../../include/obd_class.h"
47#include "../../include/lustre/lustre_idl.h"
d7e09d03
PT
48
49#include <linux/fs.h>
50#include <linux/pagemap.h> /* for PAGE_CACHE_SIZE */
51
21aef7d9 52void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
d7e09d03
PT
53{
54 valid &= src->o_valid;
55
56 if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
57 CDEBUG(D_INODE,
55f5a824 58 "valid %#llx, cur time %lu/%lu, new %llu/%llu\n",
d7e09d03
PT
59 src->o_valid, LTIME_S(dst->i_mtime),
60 LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
61
62 if (valid & OBD_MD_FLATIME && src->o_atime > LTIME_S(dst->i_atime))
63 LTIME_S(dst->i_atime) = src->o_atime;
64 if (valid & OBD_MD_FLMTIME && src->o_mtime > LTIME_S(dst->i_mtime))
65 LTIME_S(dst->i_mtime) = src->o_mtime;
66 if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(dst->i_ctime))
67 LTIME_S(dst->i_ctime) = src->o_ctime;
68 if (valid & OBD_MD_FLSIZE)
69 i_size_write(dst, src->o_size);
70 /* optimum IO size */
71 if (valid & OBD_MD_FLBLKSZ && src->o_blksize > (1 << dst->i_blkbits))
72 dst->i_blkbits = ffs(src->o_blksize) - 1;
73
09cbfeaf
KS
74 if (dst->i_blkbits < PAGE_SHIFT)
75 dst->i_blkbits = PAGE_SHIFT;
d7e09d03
PT
76
77 /* allocation of space */
78 if (valid & OBD_MD_FLBLOCKS && src->o_blocks > dst->i_blocks)
79 /*
80 * XXX shouldn't overflow be checked here like in
81 * obdo_to_inode().
82 */
83 dst->i_blocks = src->o_blocks;
84}
85EXPORT_SYMBOL(obdo_refresh_inode);