/*
* This file is part of UBIFS.
*
* Copyright (C) 2006-2008 Nokia Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: Artem Bityutskiy (Битюцкий Артём)
* Adrian Hunter
*/
/*
* This file implements VFS file and inode operations of regular files, device
* nodes and symlinks as well as address space operations.
*
* UBIFS uses 2 page flags: PG_private and PG_checked. PG_private is set if the
* page is dirty and is used for budgeting purposes - dirty pages should not be
* budgeted. The PG_checked flag is set if full budgeting is required for the
* page e.g., when it corresponds to a file hole or it is just beyond the file
* size. The budgeting is done in 'ubifs_write_begin()', because it is OK to
* fail in this function, and the budget is released in 'ubifs_write_end()'. So
* the PG_private and PG_checked flags carry the information about how the page
* was budgeted, to make it possible to release the budget properly.
*
* A thing to keep in mind: inode's 'i_mutex' is locked in most VFS operations
* we implement. However, this is not true for '->writepage()', which might be
* called with 'i_mutex' unlocked. For example, when pdflush is performing
* write-back, it calls 'writepage()' with unlocked 'i_mutex', although the
* inode has 'I_LOCK' flag in this case. At "normal" work-paths 'i_mutex' is