From patchwork Mon Mar 31 17:50:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 3917151 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AC888BF540 for ; Mon, 31 Mar 2014 17:50:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3EB220380 for ; Mon, 31 Mar 2014 17:50:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ADD6520364 for ; Mon, 31 Mar 2014 17:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753596AbaCaRuU (ORCPT ); Mon, 31 Mar 2014 13:50:20 -0400 Received: from mail-qc0-f177.google.com ([209.85.216.177]:40751 "EHLO mail-qc0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753558AbaCaRuS (ORCPT ); Mon, 31 Mar 2014 13:50:18 -0400 Received: by mail-qc0-f177.google.com with SMTP id w7so9230791qcr.22 for ; Mon, 31 Mar 2014 10:50:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Y3+bGJIj0t24GJuZTnrlsUYhjuPlNl+qfnsDjcR94wM=; b=jjfIWRc8T1NSlmzvGl99hyA0BoEUCNOZlSFbdxGXUerUNDGoH8MIs1XbwCzctgPk1r Q5SRQ9WZiG0PSa1VMc+9/Y1UfkSj7Tv1lc191diFGMdyEB1+WiauBoBk0O1RWd48JBxQ PMLFMsuEvjzyO4SpybMLNKbBNjavnuob5F437HlApG8HlFji/B5FBhWvvhQ0QeUyAbwk oK/kiNRdCYO2YKwPAVAd8fSzSLcKJb9YvIFFj/z+LaErib2GhzrRq4xJQtElzRm2AoPH h5Iv1H2AG2FHsMLg7INYH5N8p8wCKks27WeQRyNbsbPya0RGAKsjFXE4nLZL/dI6D5a+ 6Tqg== X-Gm-Message-State: ALoCoQkGDVgdAe4Y6drQQ4IF1pi4R9o52rPLuZvF/tYUuV9ZTkfbuu4Hy9pJlZnNKwwPGUoohHVG X-Received: by 10.224.5.136 with SMTP id 8mr29845030qav.42.1396288217756; Mon, 31 Mar 2014 10:50:17 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id i95sm14384104qge.5.2014.03.31.10.50.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Mar 2014 10:50:17 -0700 (PDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Tetsuo Handa Subject: [PATCH 1/4] cifs: convert booleans in cifsInodeInfo to a flags field Date: Mon, 31 Mar 2014 13:50:06 -0400 Message-Id: <1396288209-27328-2-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1396288209-27328-1-git-send-email-jlayton@redhat.com> References: <1396288209-27328-1-git-send-email-jlayton@redhat.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In later patches, we'll need to have a bitlock, so go ahead and convert these bools to use atomic bitops instead. Signed-off-by: Jeff Layton --- fs/cifs/cifsfs.c | 3 +-- fs/cifs/cifsglob.h | 5 +++-- fs/cifs/file.c | 4 ++-- fs/cifs/inode.c | 19 +++++++++++-------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 849f6132b327..8a7faf7bd9ee 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -251,8 +251,7 @@ cifs_alloc_inode(struct super_block *sb) * server, can not assume caching of file data or metadata. */ cifs_set_oplock_level(cifs_inode, 0); - cifs_inode->delete_pending = false; - cifs_inode->invalid_mapping = false; + cifs_inode->flags = 0; cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ cifs_inode->server_eof = 0; cifs_inode->uniqueid = 0; diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index c0f3718b77a8..0d4a1039ac27 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -1111,8 +1111,9 @@ struct cifsInodeInfo { __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ unsigned int oplock; /* oplock/lease level we have */ unsigned int epoch; /* used to track lease state changes */ - bool delete_pending; /* DELETE_ON_CLOSE is set */ - bool invalid_mapping; /* pagecache is invalid */ +#define CIFS_INO_DELETE_PENDING (1) +#define CIFS_INO_INVALID_MAPPING (2) + unsigned long flags; /* flags field */ unsigned long time; /* jiffies of last update of inode */ u64 server_eof; /* current file size on server -- protected by i_lock */ u64 uniqueid; /* server inode number */ diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 834fce759d80..784b17d510fc 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -392,7 +392,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) * again and get at least level II oplock. */ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) - CIFS_I(inode)->invalid_mapping = true; + set_bit(CIFS_INO_INVALID_MAPPING, &cifsi->flags); cifs_set_oplock_level(cifsi, 0); } spin_unlock(&cifs_file_list_lock); @@ -2562,7 +2562,7 @@ ssize_t cifs_user_writev(struct kiocb *iocb, const struct iovec *iov, written = cifs_iovec_write(iocb->ki_filp, iov, nr_segs, &pos); if (written > 0) { - CIFS_I(inode)->invalid_mapping = true; + set_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags); iocb->ki_pos = pos; } diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index a22d667f1069..3e9d8ba21f5c 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -117,7 +117,7 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr) cifs_dbg(FYI, "%s: invalidating inode %llu mapping\n", __func__, cifs_i->uniqueid); - cifs_i->invalid_mapping = true; + set_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags); } /* @@ -177,7 +177,10 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr) else cifs_i->time = jiffies; - cifs_i->delete_pending = fattr->cf_flags & CIFS_FATTR_DELETE_PENDING; + if (fattr->cf_flags & CIFS_FATTR_DELETE_PENDING) + set_bit(CIFS_INO_DELETE_PENDING, &cifs_i->flags); + else + clear_bit(CIFS_INO_DELETE_PENDING, &cifs_i->flags); cifs_i->server_eof = fattr->cf_eof; /* @@ -1121,7 +1124,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, } /* try to set DELETE_ON_CLOSE */ - if (!cifsInode->delete_pending) { + if (!test_bit(CIFS_INO_DELETE_PENDING, &cifsInode->flags)) { rc = CIFSSMBSetFileDisposition(xid, tcon, true, fid.netfid, current->tgid); /* @@ -1138,7 +1141,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, rc = -EBUSY; goto undo_rename; } - cifsInode->delete_pending = true; + set_bit(CIFS_INO_DELETE_PENDING, &cifsInode->flags); } out_close: @@ -1761,14 +1764,14 @@ cifs_invalidate_mapping(struct inode *inode) int rc = 0; struct cifsInodeInfo *cifs_i = CIFS_I(inode); - cifs_i->invalid_mapping = false; + clear_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags); if (inode->i_mapping && inode->i_mapping->nrpages != 0) { rc = invalidate_inode_pages2(inode->i_mapping); if (rc) { cifs_dbg(VFS, "%s: could not invalidate inode %p\n", __func__, inode); - cifs_i->invalid_mapping = true; + set_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags); } } @@ -1842,7 +1845,7 @@ int cifs_revalidate_file(struct file *filp) if (rc) return rc; - if (CIFS_I(inode)->invalid_mapping) + if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags)); rc = cifs_invalidate_mapping(inode); return rc; } @@ -1857,7 +1860,7 @@ int cifs_revalidate_dentry(struct dentry *dentry) if (rc) return rc; - if (CIFS_I(inode)->invalid_mapping) + if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags)); rc = cifs_invalidate_mapping(inode); return rc; }