Return-Path: william@bourbon.usc.edu Delivery-Date: Tue Nov 11 18:25:44 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id mAC2Pipp027370 for ; Tue, 11 Nov 2008 18:25:44 -0800 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id mAC2L3kl008620 for ; Tue, 11 Nov 2008 18:21:03 -0800 Message-Id: <200811120221.mAC2L3kl008620@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: CS551: Final Project 2 : Permanent Size Date: Tue, 11 Nov 2008 18:21:03 -0800 From: Bill Cheng Someone wrote: > What I mean with my question about cache and permanent storage was that > whenever we either cache a file or permanently store a file, the operation > would be saving the file in a directory. > Now, is it the case that if we cache it then we should store it in a > seperate directory, say "homedir/files/Cache" and when we store it > permanently we should store it in "homedir/files" ? > or is there any alternate way to implement "cache" rather than implementing > it as a directory which stores all files to be "cached" ? Please see http://merlot.usc.edu/cs551-f08/msgs/bill/420.txt. Also, I've talked about this at the beginning of yesterday's lecture. -- Bill Cheng // bill.cheng@usc.edu On Tue, Nov 11, 2008 at 8:21 AM, Bill Cheng wrote: > Someone wrote: > > > When storing the file, we have to check if the permanent storage has > space > > sufficient enough to store the file or not, but the PermSize key is > > obsolete. So how do we get the size of permanent storage ? > > It's difficult to do, especially when disk quota is > enforced. > > > Do we have to use start on our HomeDir to get this size ? or is there > any > > other way we need to handle this ? > > It's actually quite easy. When you write to the filesystem > and when you close the file you were writing to, you must > check the return code! If write() or close() is not > successful, you need to take appropriate action. If you are > interacting with the user, you need to tell the user. You > should probably also log the condition into the logfile so > you know what has failed. > > > Also, can you provide some details as to what does cache mean over here > ? > > If you decide to keep a file in HomeDir/files, if it's not > in the permanent space, then it's "cached". If this doesn't > make sense, please ask me a more specific question. > > > caching will also be in a way saving the file in the directory then how > do > > we differ the permanent storage and cache ? > > If a file is not stored in the perm space, then it goes into > the cache space. Slide 16 of lecture 18 says: > > If a node *initiates* a GET or a STORE, the file goes > into its permanent space. > > So, if you decide to keep a file for another other reason than > the one stated above, you should keep it in the cache space. > -- > Bill Cheng // bill.cheng@usc.edu