All of lore.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] use new fat_get_cluster (8/11)
Date: Tue, 22 Jul 2003 00:56:36 +0900	[thread overview]
Message-ID: <87smozvpor.fsf@devron.myhome.or.jp> (raw)

This uses new fat_get_cluster() in fat_bmap_cluster().
Another part removes unneeded error check of fat_get_entry() by using
fat_get_cluster().


 fs/fat/cache.c |   32 ++++++++++++--------------------
 fs/fat/misc.c  |    8 --------
 2 files changed, 12 insertions(+), 28 deletions(-)

diff -puN fs/fat/cache.c~fat_use-get_cluster1 fs/fat/cache.c
--- linux-2.6.0-test1/fs/fat/cache.c~fat_use-get_cluster1	2003-07-21 02:48:27.000000000 +0900
+++ linux-2.6.0-test1-hirofumi/fs/fat/cache.c	2003-07-21 02:48:27.000000000 +0900
@@ -332,28 +332,20 @@ int fat_get_cluster(struct inode *inode,
 static int fat_bmap_cluster(struct inode *inode, int cluster)
 {
 	struct super_block *sb = inode->i_sb;
-	int nr,count;
+	int ret, fclus, dclus;
 
-	if (!(nr = MSDOS_I(inode)->i_start)) return 0;
-	if (!cluster) return nr;
-	count = 0;
-	for (fat_cache_lookup(inode, cluster, &count, &nr);
-	     count < cluster;
-	     count++) {
-		nr = fat_access(sb, nr, -1);
-		if (nr == FAT_ENT_EOF) {
-			fat_fs_panic(sb, "%s: request beyond EOF (ino %lu)",
-				     __FUNCTION__, inode->i_ino);
-			return -EIO;
-		} else if (nr == FAT_ENT_FREE) {
-			fat_fs_panic(sb, "%s: invalid cluster chain (ino %lu)",
-				     __FUNCTION__, inode->i_ino);
-			return -EIO;
-		} else if (nr < 0)
-			return nr;
+	if (MSDOS_I(inode)->i_start == 0)
+		return 0;
+
+	ret = fat_get_cluster(inode, cluster, &fclus, &dclus);
+	if (ret < 0)
+		return ret;
+	else if (ret == FAT_ENT_EOF) {
+		fat_fs_panic(sb, "%s: request beyond EOF (i_pos %llu)",
+			     __FUNCTION__, MSDOS_I(inode)->i_pos);
+		return -EIO;
 	}
-	fat_cache_add(inode, cluster, nr);
-	return nr;
+	return dclus;
 }
 
 int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys)
diff -puN fs/fat/misc.c~fat_use-get_cluster1 fs/fat/misc.c
--- linux-2.6.0-test1/fs/fat/misc.c~fat_use-get_cluster1	2003-07-21 02:48:27.000000000 +0900
+++ linux-2.6.0-test1-hirofumi/fs/fat/misc.c	2003-07-21 02:48:27.000000000 +0900
@@ -330,15 +330,7 @@ static int fat_get_short_entry(struct in
 			       struct buffer_head **bh,
 			       struct msdos_dir_entry **de, loff_t *i_pos)
 {
-	struct super_block *sb = dir->i_sb;
-
 	while (fat_get_entry(dir, pos, bh, de, i_pos) >= 0) {
-		if (*pos >= FAT_MAX_DIR_SIZE) {
-			fat_fs_panic(sb, "Directory %llu: "
-				     "exceeded the maximum size of directory",
-				     MSDOS_I(dir)->i_pos);
-			return -EIO;
-		}
 		/* free entry or long name entry or volume label */
 		if (!IS_FREE((*de)->name) && !((*de)->attr & ATTR_VOLUME))
 			return 0;

_

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

                 reply	other threads:[~2003-07-21 15:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87smozvpor.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.